I am trying to run the AspNet5Localization example project from here https://github.com/damienbod/AspNet5Localization/tree/rc2
However, when I open the solution a warning box appears:
DNX SDC version dnx-clr-win-x86.1.0.0-rc2-16444 is required by your solution but is not installed on this machine. Do you want to install it now? If you select No, 'dnx-clr-win-x86.1.0.0-rc1-update1' will be used as the solution DNX SDK version for this session.
I choose Yes.
Then another info box appears:
DNX SDK version dnx-clr-win-x86.1.0.0-rc2-16444 failed to install. The solution will use DNX SDK version dnx-clr-win-x86.1.0.0-rc1-update1 for this session.
Because I have installed dnx-clr-win-x86.1.0.0-rc2-16357 I change the "Soltion DNX SDK version" to 1.0.0-rc2-16357 from project properties.
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-update1 clr x64 win
1.0.0-rc1-update1 clr x86 win default
1.0.0-rc1-update1 coreclr x64 win
1.0.0-rc1-update1 coreclr x86 win
1.0.0-rc2-16357 clr x86 win
However, regardless this change, it fails to restore the packages.
I see the following error:
System.ArgumentException: More than one runtime.json file has declared imports for 'win7-x86'
Parameter name: runtimeName
at Microsoft.Dnx.Tooling.RestoreCommand.FindRuntimeDependencies(String runtimeName, List`1 runtimeFiles, Dictionary`2 effectiveRuntimeSpecs, HashSet`1 allRuntimeNames, Func`2 circularImport)
at Microsoft.Dnx.Tooling.RestoreCommand.FindRuntimeDependencies(String runtimeName, List`1 runtimeFiles, Dictionary`2 effectiveRuntimeSpecs, HashSet`1 allRuntimeNames)
at Microsoft.Dnx.Tooling.RestoreCommand.<RestoreForProject>d__69.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Dnx.Tooling.RestoreCommand.<>c__DisplayClass68_0.<<Execute>b__2>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Dnx.Tooling.RestoreCommand.<Execute>d__68.MoveNext()
----------
Restore failed
More than one runtime.json file has declared imports for 'win7-x86'
How can I compile and run this example project?
How can I compile and run this example project?
One. Run the following three commands from the command line. This upgrades our dnvm
and adds the recent development releases. Make sure to turn off anti-virus; my anti-virus blocked several .NET files.
set DNX_UNSTABLE_FEED=https://www.myget.org/F/aspnetcidev/api/v2
dnvm upgrade -unstable
dnvm install 1.0.0-rc2-16549 -runtime coreclr -unstable
Two. Open AspNet5Localization/src/AspNet5Localization/project.json
. Add the following dependency. This fixes the runtime.json error. It does that by providing runtime information required to resolve target framework, platform, and runtime specific implementations of .NETCore packages.
"Microsoft.NETCore.Platforms": "1.0.1-*"
Three. Open AspNet5Localization/NuGet.config
. Make sure that the asp.nuget.org and nuget.org feeds are NOT commented out. Those feeds provide us with Newtonsoft.Json, Remotion.Linq, Ix-Async, and some Microsoft.CodeAnalysis packages. When you are done, the NuGet.config looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources
remove the <clear/> line below -->
<clear />
<add key="MyGet aspnetcidev"
value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="api.nuget.org"
value="https://api.nuget.org/v3/index.json" />
<add key="nuget.org"
value="https://www.nuget.org/api/v2/" />
</packageSources>
</configuration>
At this point, dnu restore
will now work but dnu build
will not.
Four. Open AspNet5Localization/src/AspNet5Localization/Controllers/BoxesController.cs
. Responds to recent renaming by finding and replacing the following.
HttpNotFound --> NotFound
HttpBadRequest --> BadRequest
Five Restore and build the AspNet5Localization/src/Localization.SqlLocalizer
project.
$ cd src\Localization.SqlLocalizer
$ dnu restore
$ dnu build
Six Restore and build the AspNet5Localization/src/AspNet5Localization
project.
$ cd src\AspNet5Localization
$ dnu restore
$ dnu build
$ dnx web
You will see the following result.
Note 01. This is what dnvm list
looks like on my machine:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-update1 coreclr x64 win
1.0.0-rc2-16549 clr x86 win default
* 1.0.0-rc2-16549 coreclr x64 win
Note 02. When you build, you will get two warnings that Microsoft.Extensions.CodeGeneration and Microsoft.Extensions.CodeGenerators.Mvc do not support dnx451. To get rid of those errors, open project.json. Either delete those two dependencies or delete the dnx451 framework.
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