Search code examples
asp.netvisual-studiovisual-studio-2015asp.net-corednvm

How to set dnvm version for Visual Studio 2015


I downloaded beta8 for ASP.NET 5 and am trying to set it as the default for new Visual Studio projects. Using the Developer command prompt for Visual Studio 2015 I did:

dnvm use 1.0.0-beta8 -arch x64 -p

My command prompt now displays:

c:\>dnvm list

Active Version     Runtime Architecture Location                         Alias
------ -------     ------- ------------ --------                         -----
       1.0.0-beta5 clr     x64          C:\Users\username\.dnx\runtimes
       1.0.0-beta5 clr     x86          C:\Users\username\.dnx\runtimes
       1.0.0-beta5 coreclr x64          C:\Users\username\.dnx\runtimes
       1.0.0-beta5 coreclr x86          C:\Users\username\.dnx\runtimes
       1.0.0-beta7 clr     x86          C:\Users\username\.dnx\runtimes
  *    1.0.0-beta8 clr     x64          C:\Users\username\.dnx\runtimes
       1.0.0-beta8 clr     x86          C:\Users\username\.dnx\runtimes def...

However, when I now open Visual Studio 2015 and create a new ASP.NET 5 Web Application project, my global.json still says architecture x86 (the previous version), and my project does not build. Under References it says (Errors - see Error list) but there are too many errors to count. Doing 'Restore Packages' appears to do nothing.

How do I set Visual Studio 2015 to use this current version with x64 architecture (the architecture of my machine) and to create new projects so that they build successfully out of the box (like the previous version I was using)?


Solution

  • First check it you have correct (beta8) version of VS tooling installed. Installing beta8 framework is not enough to run projects from VS and beta8 tooling is not the same as beta8 DNX. This step is crucial for building and running beta8 projects under VS. If your project does not build and run out of the box this is most likely what causes problems. You may check your version of ASP.NET and Web Tools under About Visual Studio in Help menu. See this answer for screenshot:

    https://stackoverflow.com/a/33158692/926875.

    You may find beta 8 VS tooling under:

    http://www.microsoft.com/en-us/download/details.aspx?id=49442

    I don't know if it is possible at all to force visual studio to run x64 framework. People seem to struggle with it for some time. See this questions for reference:

    How to force Visual Studio to use x64 DNX SDK architecture

    https://stackoverflow.com/questions/33013936/visual-studio-2015-nuget-package-restore-uses-x86-by-default?s=2|0.5929

    If you need your project to be run under x64 from visual studio you may go to properties of your project and check "Use specific runtime".

    From my experience most of the times architecture of dnx is not what causes issues. To make sure if this is not the case at first I would suggest using dnu restore and dnu build and then dnx run (or web or anything that runs your project) from command line and see if your project builds this way.