Retrace will reach End of Life on March 31, 2027. Click here to learn more.

Using xproj and csproj with .NET Core v1 & VS2015

By: mwatson
  |  July 11, 2016
Using xproj and csproj with .NET Core v1 & VS2015

.NET Core is here! We have been busy doing quite a bit of work with it. We have multiple client libraries for sending data to the Stackify API (for metrics, errors, logs, etc.). To ensure that all of our customers can send us data for their .NET Core apps, we have ported them over. So what’s the issue? How do you use both csproj and xproj?

We need csproj so we can build our apps with our existing toolchain, which relies on msbuild. We also need to reference some shared libraries across multiple different apps. Luckily, with Core 1.0 you can use both csproj and xproj at the same time by having different solution files.

Another major obstacle is the project.json file. This file is new for most developers working with .NET Core, but it isn’t actually new (it is also being utilized by universal Windows apps). If you add a project.json file to your application folder, your csproj will start trying to use it. It actually works great and can replace your packages.config and do a good job of setting project package dependencies for non core apps.

Another issue you run into is as soon as you add a .NET Core framework target to project.json, your csproj won’t know what the heck to do it with it.

Enter the Workaround!

The way to fix this is to have two “project.json” files:

  1. The first file is a csproj that basically does nothing. Name it something like “projectname.project.json.”
  2. The second file should be named the normal project.json for your actual Core app. Luckily there is some hackery in msbuild and the Visual Studio tools that allows this to work.

Here is how our this sample project “Profiler.Models” looks on disk:

In this example, Profiler.Models.project.json is picked up by our csproj project. Our xproj for .NET Core properly reads the “project json,” and both can compile and build correctly. MSBuild can still build our normal solution with all our csproj based projects. Mission accomplished!

Here is what your “Profiler.Models.project.json” type file should contain. It is just a simple placeholder config.

{  “runtimes”: {    “win”: {}  },  “frameworks”: {    “net45”: {}  }}

I did see a little oddity when trying to add a new package dependency to my csproj. It added it to my Profiler.Models.project.json and things got a little weird, so watch out for that. I ended up deleting all my project.json files in the folder temporarily, adding the package to my csproj and then reverting my project.json deletes via git so they came right back. I kept my Profiler.Models.project.json clean and empty. You might be able to actually use it to manage all the dependencies for your cspoj.

Both Prefix & Retrace APM work with .NET Core!

 

Stackify Retrace APM for .NET Core

Improve Your Code with Retrace APM

Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.

Learn More
situs toto pucuk4d indobet toto slot slot depo 10k toto toto toto bobatoto daftar logototo situs toto situs toto patentoto situs toto slot 4D toto bayitoto mawar800 login popotogel prize hongkong malam ini joker11 lingkartoto depo 5k panen100 semibola popo togel https://asupantoto.co/ slot pascol4d login pascol4d login sbobet88 sbobet88 https://nolimithoki.dev/ dinasti33 slot slot88 slot jepang slot depo 5k pucuk4d https://www.juara288.asia/ slot 4d RP888 toto toto pascol4d situs toto kari4d flokitoto slot gacor logototo slot depo 5k bobatoto bobatoto bobatoto sontogel mpo slot situs toto slot situs slot nobu99 logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo bobatoto istanaslot rp888 www.pajaktoto.io kari4d kari4d kari4d kari4d pascol4d pascol4d pascol4d toto slot slot gacor bento11 link KARI4D PUCUK4D pascol4d situs slot toto slot titi4d slot gacor toto toto slot toto jinhoki situs slot situs slot situs slot AMANAHTOTO https://www.asupan188.dev/ slot gacor gampang menang toto slot gacor bwo303 situs toto toto slot slot gacor slot88 slot gacor situs slot link slot situs toto slot gacor slot gacor pucuk4d PASCOL4D situs slot link slot pentaslot pajaktoto slotvip toto togel situs toto toto slot situs slot situs slot situs slot toto slot gacor slot777 situs slot link slot slot thailand situs judi bola situs toto roma77 slot jpmania toto228 RUSIA777 slot gacor POPOTOGEL : Situs Resmi Bandar Toto Togel Macau dengan Prediksi Gokil Pasti Akurat PARLAY slot gacor slot gacor slot gacor link slot BUNGASLOT slot slot gacor situs slot slot gacor slot gacor sejukbos situs slot link slot slot gacor gacor gacor Slot88 Slot88 coloktoto toto slot slot gacor situs slot gacor situs toto slot gacor toto toto toto slot gacor slot88 slot777 slot pulsa ayamtoto StreamEast slot777 slot88 link slot gacor situs gacor slot gacor slot gacor toto slot slot gacor leon188 slot gacor bandarqq jpmania slot gacor slot gacor Slot88 https://ini777gold.com nenek188 slot gacor slot gacor slot gacor NKRISLOT Slot88 situs slot slot gacor poker online slot88 rp888 Slot88
situs toto pucuk4d indobet toto slot slot depo 10k toto toto toto bobatoto daftar logototo situs toto situs toto patentoto situs toto slot 4D toto bayitoto mawar800 login popotogel prize hongkong malam ini joker11 lingkartoto depo 5k panen100 semibola popo togel https://asupantoto.co/ slot pascol4d login pascol4d login sbobet88 sbobet88 https://nolimithoki.dev/ dinasti33 slot slot88 slot jepang slot depo 5k pucuk4d https://www.juara288.asia/ slot 4d RP888 toto toto pascol4d situs toto kari4d flokitoto slot gacor logototo slot depo 5k bobatoto bobatoto bobatoto sontogel mpo slot situs toto slot situs slot nobu99 logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo logototo bobatoto istanaslot rp888 www.pajaktoto.io kari4d kari4d kari4d kari4d pascol4d pascol4d pascol4d toto slot slot gacor bento11 link KARI4D PUCUK4D pascol4d situs slot toto slot titi4d slot gacor toto toto slot toto jinhoki situs slot situs slot situs slot AMANAHTOTO https://www.asupan188.dev/ slot gacor gampang menang toto slot gacor bwo303 situs toto toto slot slot gacor slot88 slot gacor situs slot link slot situs toto slot gacor slot gacor pucuk4d PASCOL4D situs slot link slot pentaslot pajaktoto slotvip toto togel situs toto toto slot situs slot situs slot situs slot toto slot gacor slot777 situs slot link slot slot thailand situs judi bola situs toto roma77 slot jpmania toto228 RUSIA777 slot gacor POPOTOGEL : Situs Resmi Bandar Toto Togel Macau dengan Prediksi Gokil Pasti Akurat PARLAY slot gacor slot gacor slot gacor link slot BUNGASLOT slot slot gacor situs slot slot gacor slot gacor sejukbos situs slot link slot slot gacor gacor gacor Slot88 Slot88 coloktoto toto slot slot gacor situs slot gacor situs toto slot gacor toto toto toto slot gacor slot88 slot777 slot pulsa ayamtoto StreamEast slot777 slot88 link slot gacor situs gacor slot gacor slot gacor toto slot slot gacor leon188 slot gacor bandarqq jpmania slot gacor slot gacor Slot88 https://ini777gold.com nenek188 slot gacor slot gacor slot gacor NKRISLOT Slot88 situs slot slot gacor poker online slot88 rp888 Slot88