3

I want to update my C# web application to the next asp.net version.

I ran

dnvm use  1.0.0-rc1-update1 -r clr arch x64 -p

and dnvm list shows that the active version has been set to rc1-update1

Now I want to update my VS2015 solution to use rc1-update1

I edited project.json to update the version from rc1-final to rc1-update1

however VS now indicates "package restore failed". and I have error messages like this.

Severity    Code    Description Project File    Line    Suppression State
Error   CS0234  The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)    MyBootStrap.DNX 4.5.1    

Hovering my mouse over the edited dependencies in project.json shows

enter image description here

I must be missing a step. How do I upgrade my project to use the Active Version of the framework?

[Update] When I create a new web application from the template I notice that it is still using rc1-final.

There is also a message in the Solution Explorer window "Package restore failed" The Output shows the following

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External;
%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\git
C:\Users\kirsten\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnx.exe "C:\Users\kirsten\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\lib\Microsoft.Dnx.Tooling\Microsoft.Dnx.Tooling.dll" 
restore "E:\EShared\Dev2016\MyBootStrap\src\MyBootStrap" -f "C:\Program Files (x86)\Microsoft Web Tools\DNU"
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
  CACHE https://www.nuget.org/api/v2/
Restoring packages for E:\EShared\Dev2016\MyBootStrap\src\MyBootStrap\project.json
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.Diagnostics'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.IISPlatformHandler'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.Mvc'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.Mvc.TagHelpers'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.Server.Kestrel'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.StaticFiles'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.AspNet.Tooling.Razor'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Extensions.Configuration.FileProviderExtensions'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Extensions.Configuration.Json'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Extensions.Logging'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Extensions.Logging.Console'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Extensions.Logging.Debug'
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.VisualStudio.Web.BrowserLink.Loader'
Unable to locate Dependency Microsoft.AspNet.Diagnostics >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.AspNet.IISPlatformHandler >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.AspNet.Mvc >= 6.0.0-rc1-update1
Unable to locate Dependency Microsoft.AspNet.Mvc.TagHelpers >= 6.0.0-rc1-update1
Unable to locate Dependency Microsoft.AspNet.Server.Kestrel >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.AspNet.StaticFiles >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.AspNet.Tooling.Razor >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.Extensions.Configuration.FileProviderExtensions >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.Extensions.Configuration.Json >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.Extensions.Logging >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.Extensions.Logging.Console >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.Extensions.Logging.Debug >= 1.0.0-rc1-update1
Unable to locate Dependency Microsoft.VisualStudio.Web.BrowserLink.Loader >= 14.0.0-rc1-update1
Writing lock file E:\EShared\Dev2016\MyBootStrap\src\MyBootStrap\project.lock.json
Restore complete, 413ms elapsed

from this I see it is trying to run the x86 version of dnx. Why would that be?

[Update] I am wondering why it would be using nuget.org/api/v2 so I reinstalled nuget using extension manager. It shows version 3.3.0.167 in Extension Manager, yet the output window for Package Manager still metions V2.

I am running Windows 7

[Update] project.json is

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-update1",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-update1",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-update1",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-update1",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-update1",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-update1",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-update1",
    "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-update1",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-update1",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-update1",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-update1",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-update1",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-update1"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}

Here is my NuGet.Config file

    <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <add key="SBD" value="E:\EShared\NuGet" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  </packageSources>
  <activePackageSource>
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  </activePackageSource>
</configuration>

Here is my package sources

The SBD one is just a few we developed in house. I don't think it should affect things.

enter image description here

Kirsten
  • 15,730
  • 41
  • 179
  • 318
  • i also tried rebooting. – Kirsten Jan 01 '16 at 07:09
  • 2
    These asp.net assemblies are just not published to Nuget (yet), rc1-final is the last available version. This is supposed to not work. – Hans Passant Jan 01 '16 at 10:05
  • 1
    @kirsteng: Do you just *manually* modified version numbers of **all** dependencies? Every dll can be *separately* developed and published on NuGet. Some dlls have still the name -bata8, another have -rc1-final and only some from there was updated Update1 and have -rc1-update1 in the version number. Could you post the `project.json` (not as a picture) or post the link to the test project which one can use? By the way there are **separate NuGet repositories** for different state of ASP.NET 5. I would recommend you to read [the answer](http://stackoverflow.com/a/34421286/315935). – Oleg Jan 01 '16 at 11:39
  • Thanks @Oleg I posted project.json above. Will read the link you sent. – Kirsten Jan 01 '16 at 20:30
  • 1
    @kirsteng: It's not important. You can use `https://api.nuget.org/v3/index.json` in Visual Studio 2015+ to use NuGet V3 feed and to use `https://www.nuget.org/api/v2/` in Visual Studio 2012+ to use NuGet V2 feed. It's important that you will access **the same NuGet packages** which you can find on `https://www.nuget.org/packages/`. I think that you mix some different things. I will write the answer to clear that. – Oleg Jan 01 '16 at 22:26
  • Thanks @Oleg, I accidentally deleted my comment that you answered.. which I add back now. - Why would my NuGet package sources be using V2? I see from your link you suggest api.nuget.org/v3/index.json – Kirsten Jan 01 '16 at 22:32
  • Strange that the Nuget package sources did not update to V3 when I updated to VS2015 – Kirsten Jan 01 '16 at 22:34

2 Answers2

6

It seems you have mixed the version of dnx (Microsoft .NET Execution environment), the version of dnvm (.NET Version Manager) with the version number of the assemblies.

ASP.NET has a modular structure. This has advantages and disadvantages. First of all you can examine your current dnvm (.NET Version Manager) by using:

dnvm version

You can use

dnvm update-self

to update it to the latest version.

In the same way you can use

dnvm list

to see all dnx (Microsoft .NET Execution environment) installed in your profile. %USERPROFILE%\.dnx\runtimes. You will have a folder for every installed version of dnx. By using dnvm use 1.0.0-rc1-update1 -r clr arch x64 -p you change the PATH. You can see the current versions dnx used by default

dnx --version

It uses the dnx.exe from the subdirectory of %USERPROFILE%\.dnx\runtimes, which you included in PATH by dnvm use ....

If you use Visual Studio Project then you create typically global.json which contains

{
  "projects": [
    "src"
  ],
  "sdk": {
    "version": "1.0.0-rc1-update1"
  }
}

Such a setting informs the version of dnx, which should be used during building of the solution/project.

All above steps have no relation to versions of a lot of existing packages currently released. You can go to the page https://www.nuget.org/packages/ and to search for the names of packages. The same packages will be found if you use https://www.nuget.org/api/v2/ or https://api.nuget.org/v3/index.json in NuGet configuration. You can examine http://myget.org/gallery/aspnetmaster to see the current version of ASP.NET 5 assemblies of the "master" builds (stable build) and you can examine http://myget.org/gallery/aspnetvnext to see the latest (unstable from GitHub dev). One can find a lot of other feeds under https://www.myget.org/gallery/, but in my opinion only https://api.nuget.org/v3/index.json and https://www.myget.org/F/aspnetmaster/api/v3/index.json should be used if you want use the latest stable release of ASP.NET 5.

You will see that the latest stable release from http://myget.org/gallery/aspnetmaster have the name "1.0.0-rc1-final", but there are still a lot of assemblies, which have another version as *-rc1-final. In the same way unstable build from http://myget.org/gallery/aspnetvnext have today the name "v1.0.0-rc2-16357", but there are a lot of assemblies, which have another version as *-rc2-16357.

In other words you should not just change the names of all dependencies to use version "*-rc1-update1". You can open "Manage NuGet Packages..." in context menu, check "Include prerelease" and choose "Updates" tab to see whether a new package, which you included in "dependencies" of package.json, is released. Only if you find some new package then you can update it, but the usage of-rc1-update1 for all packages will produce an error.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thank you for your complete answer. Personnally, I had to copy paste the package feed [here](http://myget.org/gallery/aspnetmaster) to the Package Sources Settings of NuGet, and it worked. – Christopher J. May 01 '16 at 15:46
  • 1
    @ChristopherJ.: There are many other feeds, which will be used by Microsoft to publish some more recent packages: https://www.myget.org/F/aspnetvolatiledev/api/v3/index.json, https://www.myget.org/F/dotnet-core/api/v3/index.json, https://www.myget.org/F/aspnet-contrib/api/v3/index.json, https://www.myget.org/F/azureadwebstacknightly/api/v3/index.json, https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/. The best choice depends on many criteria. It's just important to know the importance of the configuration of NuGet feeds. – Oleg May 01 '16 at 16:13
2

Some tools choose the framework according to aliases. In command line, check if you have alias "default" assigned to 1.0.0-rc1-update1 clr x64 version. If not run the following command.

dnvm alias default 1.0.0-rc1-update1 -a x64 -r clr

This should fix the problem.