添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Is 'Microsoft.AspNetCore.Razor.Tools' obsolete for .net core 3.1? Then which package to use instead?

Ask Question

I am starting a new project in ASP.NET Core 3.1 . In the model project they used these 3 packages in project_name.json file:

"Microsoft.AspNetCore.Razor.Tools ": { "version": "1.0.0-preview2-final", "type": "build" },

"Microsoft.AspNetCore.StaticFiles": "1.0.0",

"Microsoft.AspNetCore.Mvc": "1.0.1"

And there was a tools section in project_name.json file :

"tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final"}

which adds ' "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final" ' .

I want to install the packages from NuGet package manager simply. But I am not finding:

Microsoft.AspNetCore.Razor.Tools

package there. I looked out what's its replacement but didn't come up with one.

And, there was a package 'Microsoft.AspNetCore.Mvc.Core' that I replaced for ' "Microsoft.AspNetCore.Mvc": "1.0.1" '.

So, the questions are,

  • What is the replacement for 'Microsoft.AspNetCore.Razor.Tools' ? Is the package like 'Microsoft.AspNetCore.Razor' in NuGet the replacement? Or should I add it manually in .csproj ? If 'yes' then I think that the package is a little outdated as it last was updated in 2016. And, can I do that manually in .csproj as I can do in project_name.json ?

  • How to configure the tools section? As there are no tools section now in the .csproj file like project_name.json file has.

  • Is 'Microsoft.AspNetCore.Mvc.Core' is replacment for 'Microsoft.AspNetCore.Mvc' ?

  • Thank you .

    What is the replacement for 'Microsoft.AspNetCore.Razor.Tools'? Is the package like 'Microsoft.AspNetCore.Razor' in NuGet the replacement? Or should I add it manually in .csproj? If 'yes' then I think that the package is a little outdated as it last was updated in 2016. And, can I do that manually in .csproj as I can do in project_name.json?

    Actually , the package Microsoft.AspNetCore.Razor.Tools exists under nuget.org and it is just a preview version.

    In Nuget package management UI , it has a set switch to separate the official and preview nuget packages.

    You can refer to this:

    Besides, you can add reference node directly in xxx.csproj file. The UI function is just download the related nuget package into the local and then modify xxx.csproj to add the Reference elements.

    Add like these in your xxx.csproj :

    <ItemGroup>   
        <PackageReference Include="Microsoft.AspNetCore.Razor.Tools" Version="1.0.0-preview2-final" />    
    </ItemGroup>
      

    How to configure the tools section? As there are no tools section now in the .csproj file like project_name.json file has.

    So far, the latest Net Core does not support project.json format.Instead, they migrate it into xxx.csproj file.

    So in the new Net Core 3.1 project, you should change xxx.csproj to add them.

    This document shows how to migrate each node in project.json file to xxx.csproj file.

    About tools section, you can see this, use DotNetCliToolReference selection in xxx.csproj file.

    Solution

    For your issue, you should add like this in your xxx.csproj file:

    <ItemGroup>
      <DotNetCliToolReference Include="Microsoft.AspNetCore.Server.IISIntegration.Tools" Version="1.0.0-preview2-final" />
    </ItemGroup>
    

    Then you can use it.

    Is 'Microsoft.AspNetCore.Mvc.Core' is replacment for 'Microsoft.AspNetCore.Mvc'?

    They are quite different from each other. Each has its own feature.

    It refers to the priority introduction of the user experience, based on the user experience constantly improve the nuget package features. To a certain extent, the author will synthesize all the points in the launch of the final release version. All of these are up to the author. – Mr Qian Jun 4, 2020 at 9:35 after fixing all the issue they gave me 'RAZOR SDK1006 Detected Razor language version downgrade. This is typically caused by a reference to the Microsoft.AspNetCore.Razor.Design package. Consider removing this package reference' warning at last. The part of the project I am solving is slimier to this: link. Should I install 'Microsoft.AspNetCore.Razor.Design'? – username_allowed Jun 4, 2020 at 10:13

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.