Running MVC 6 ASP.NET 5 localization example for dnx rc2

后端 未结 1 811
情话喂你
情话喂你 2021-01-18 19:28

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 wa

相关标签:
1条回答
  • 2021-01-18 20:22

    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.

    0 讨论(0)
提交回复
热议问题