I upgraded DNVM with dnvm upgrade -Unstable
. Running dnvm list
shows this to be active: 1.0.0-beta6-12120.
I created a new project using the ASP.NET 5 Preview Template for Web Site and verified that it would build.
I changed the project.json to reference beta6:
"dependencies": {
"EntityFramework.SqlServer": "7.0.0-beta6",
"EntityFramework.Commands": "7.0.0-beta6",
"Microsoft.AspNet.Mvc": "6.0.0-beta6",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta6",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta6",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta6",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta6",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta6",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
"Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta6",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta6",
"Microsoft.Framework.Logging": "1.0.0-beta6",
"Microsoft.Framework.Logging.Console": "1.0.0-beta6"
}
But the build fails with runtime library conflicts:
1>MSBUILD : DNX 4.5.1 error CS0433: The type 'AssemblyFileVersionAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>MSBUILD : DNX 4.5.1 error CS0433: The type 'AssemblyVersionAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>MSBUILD : DNX 4.5.1 error CS0433: The type 'AssemblyInformationalVersionAttribute' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>MSBUILD : DNX 4.5.1 error CS0518: Predefined type 'System.String' is not defined or imported
1>MSBUILD : DNX 4.5.1 error CS0518: Predefined type 'System.String' is not defined or imported
1>MSBUILD : DNX 4.5.1 error CS0518: Predefined type 'System.String' is not defined or imported
1>MSBUILD : DNX 4.5.1 error CS0518: Predefined type 'System.Void' is not defined or imported
1>MSBUILD : DNX 4.5.1 error CS0518: Predefined type 'System.Void' is not defined or imported
1>MSBUILD : DNX 4.5.1 error CS0518: Predefined type 'System.Boolean' is not defined or imported
How can this be resolved?
From the command line do a dnu restore
. This will force an update of dependency resolution. Pretty much anytime you change the runtime either upgrading to a new one or switching the active runtime I would do a restore.
Visual studio uses the sdk property to determine which runtime to use when building and restoring. This can be different than the runtime set active by dnvm. Setting the active runtime in dnvm does not change the runtime used by the IDE. Setting the target in VS does not change the active runtime on the command line.
To change the runtime used by Visual Studio either:
Edit the global.json (solution level file) manually. Set or change the value for "sdk" to the desired version of the runtime. This sets the defaults for all projects and it can be overridden at the project level below.
OR
Right click on a project > Properties > Application
Check Use specific DNX version
.
Set to desired version, platform, and architecture
In your project.json file(s), try using beta6-*
instead of just beta6
. That means it will reference the most recent build of it.
Check what runtime directories are in C:\Users\MyUser\.dnx\runtimes
. Mine include the following:
dnx-clr-win-x86.1.0.0-beta6 <-- I made this one via a rename.
dnx-clr-win-x86.1.0.0-beta6-12085
dnx-clr-win-x86.1.0.0-beta6-12120
In my global.json
file, which is in the same directory as the *.sln
, I make sure to reference one of the runtimes like this:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta6-12120"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With