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

2

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?

Fiscus answered 1/4, 2016 at 8:13 Comment(0)
F
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.

Fiscus answered 1/4, 2016 at 8:13 Comment(5)
It looks like .DNX.<whatever> is RC1 AND .DotNet.<whatever is RC2. (I upgraded, someone else didn't and we couldn't figure out why newer projects didn't open but the old ones did.Year
@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\DNXWhitford
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. 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.)Bolger
@Bolger I ... I think you're having fun at me... I think :) marking as answered, taFiscus
@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.)Bolger
L
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...

Laity answered 12/7, 2017 at 3:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.