Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my project.json / xproj project not open in Visual Studio 15 (preview)?

I have an existing solution involving multiple project.json (and corresponding xproj) projects that I have been working on for some time. It works fine in Visual Studio 2015, but it fails to load in VS 15 (preview), just showing a failed load icon for each. No messages are printed.

What is happening, and how can I fix it?

like image 762
Marc Gravell Avatar asked Apr 01 '16 08:04

Marc Gravell


1 Answers

It is possible that your xproj were created (automatically) with early versions of the dnx tooling. This used particular MSBuild imports that were supported at the time, but which have been replaced as the DNX tooling has evolved (and more recently: been replaced with DotNet).

Backwards compatibility was kept in VS 2015, but support for these old xproj has not been preserved in VS 15. As such, you will either need to edit your xproj, or (simpler) just delete the .xproj and .xproj.user, remove the project from the solution, and re-add it; this will recreate the xproj with the current tooling.

If you want to hand edit it, you should replace:

<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props"
    Condition="'$(VSToolsPath)' != ''" />
...
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" 
    Condition="'$(VSToolsPath)' != ''" />

with either:

<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props"
    Condition="'$(VSToolsPath)' != ''" />
...
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" 
    Condition="'$(VSToolsPath)' != ''" />

or:

<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props"
    Condition="'$(VSToolsPath)' != ''" />
...
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets"
    Condition="'$(VSToolsPath)' != ''" />

As you can see, this reflects the evolution of the tooling. The first option is no longer supported in VS 15. The final option is probably closest to what RTM will look like, but does not work in VS 2015 with the current tooling. So... you probably want the middle option for now.

like image 68
Marc Gravell Avatar answered Nov 19 '22 21:11

Marc Gravell