16

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?

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900

2 Answers2

25

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.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • 2
    It looks like `.DNX.` is RC1 AND `.DotNet. – Erik Philips May 18 '16 at 22:48
  • 3
    @ErikPhilips: I've just installed Microsoft Visual Studio Community 2015 Version 14.0.25422.01 Update 3 and folder name is DNX, i.e. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX – Michael Freidgeim Jul 17 '16 at 04:40
  • Marc, welcome to StackOverflow! Thanks for asking such a well-written question, and for posting what solved the problem for you. I wanted to let you know that, with a few restrictions, [you can fairly mark your own answer as accepted for your own questions](https://stackoverflow.blog/2009/01/accept-your-own-answers/). Marking accepted helps active users know that you don't still need help finishing things up, and that a great answer is available! *(Tone is a joke, natch, though no check had me wonder what was wrong with the answer until I saw the answer's user badge.)* – ruffin Jan 02 '17 at 14:03
  • 1
    @ruffin I ... I *think* you're having fun at me... I think :) marking as answered, ta – Marc Gravell Jan 02 '17 at 15:33
  • @MarcGravell Yes, sorry, just funnin'. Seems I've seen you around once or twice.. ;^D Thanks! (And thanks for all the backend help from your answers here over the years.) – ruffin Jan 02 '17 at 17:17
0

Install the Visual Studio 2015 Tools (Preview 2): https://go.microsoft.com/fwlink/?LinkId=827546

Then configure your global.json with the specific version in path C:\Program Files\dotnet\sdk

Works for me...