【发布时间】:2017-12-12 04:06:48
【问题描述】:
我已添加对我的 project.csproj 文件的引用,如 S.O. 和 ms 文档 tutorial 所示:
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />
</ItemGroup>
运行dotnet restore 声称成功。但是找不到 dotnet aspnet-codegenerator 命令,并且在管理 nuget 包中,未安装 CodeGeneration.Tools 并且手动安装会出现错误:
Package restore failed. Rolling back package changes for 'ContosoUniversity'.
这似乎是由于我不了解或不知道如何解决的版本兼容性问题。我已经在我的依赖项中安装了 Microsoft.NETCore.App 2.0.3
和 Microsoft.NETCore.APP 2.0.3,其他一切都是 2.0.1。 (CodeGeneration.Design、CodeGeneration.Utils 等...并在包管理控制台运行 Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Tools 抛出错误:
GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.visualstudio.web.codegeneration.tools/index.json
OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.visualstudio.web.codegeneration.tools/index.json 166ms
Restoring packages for C:\Users\sticker592\Documents\Visual Studio 2017\Projects\ContosoUniversity\ContosoUniversity\ContosoUniversity.csproj...
Install-Package : Detected package downgrade: Microsoft.NETCore.App from 2.0.3 to 2.0.0. Reference the package directly from the project to
select a different version.
ContosoUniversity -> Microsoft.VisualStudio.Web.CodeGeneration.Tools 2.0.1 -> Microsoft.NETCore.App (>= 2.0.3)
ContosoUniversity -> Microsoft.NETCore.App (>= 2.0.0)
At line:1 char:1
+ Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Tools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package : Package restore failed. Rolling back package changes for 'ContosoUniversity'.
At line:1 char:1
+ Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Tools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
将所有内容降级到 2.0.0 允许我在 Nuget 中安装 CodeGeneration.Tools 但我仍然收到错误:dotnet : No executable found matching command "dotnet-aspnet-codegenerator"
【问题讨论】:
标签: asp.net