英文:
How to specify runtimeIdentifier and targetFramework values when using Nuget Restore in TeamCity
问题
我已经在TeamCity中设置了MSBuild来还原一个项目,指定了所需的runtimeIdentifier
和targetFramework
值,一切都还原得很顺利。
然而,当我尝试在TeamCity的NuGet安装程序中配置相同的还原时,尝试发布后会出现以下消息:
....obj\project.assets.json' doesn't have a target for 'net6.0/win-x64'. Ensure that restore has run and that you have included 'net6.0' in the TargetFrameworks for your project. You may also need to include 'win-x64' in your project's RuntimeIdentifiers.
我应该如何在TeamCity的NuGet Installer部分中指定这些参数以确保项目恢复时具有正确的目标?
NuGet是使用MSBuild还原的,所以我假设有一种方法可以做到这一点。通过“命令行参数”部分传递参数并不起作用。
英文:
I have TeamCity setup to restore a project using MSBuild, specifying the runtimeIdentifier
and targetFramework
values required, and everything restores smoothly.
However when I try to configure the same restore using the NuGet installer within team city, I get the following message after trying to publish:
....obj\project.assets.json' doesn't have a target for 'net6.0/win-x64'. Ensure that restore has run and that you have included 'net6.0' in the TargetFrameworks for your project. You may also need to include 'win-x64' in your project's RuntimeIdentifiers.
How and were do I specify these parameters in the NuGet Installer section of TeamCity, so that the project is restored with the correct targeting?
NuGet is restoring with MSBuild, so I'm presuming there is some way of doing this. Passing the params via the 'Command line parameters' section does not work.
答案1
得分: 1
你可以切换到 dotnet restore
并传递 --runtime
参数给它:
dotnet restore -r win-x64
目前没有找到关于它的具体文档,但似乎使用 使用 .NET Core 插件 并使用相应的命令应该能解决问题。
英文:
You can switch to dotnet restore
and pass --runtime
parameter to it:
dotnet restore -r win-x64
Could not find specific docs for it but it seems that using .NET Core plugin with corresponding command should do the trick.
答案2
得分: 0
如此看来,似乎不太可能。必须在.csproj文件中指定runtimeIdentifier和targetFramework:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Configurations>Debug;Release;Staging</Configurations>
</PropertyGroup>
英文:
So, it doesn't look possible. The runtimeIdentifier and targetFramework must be specified in the .csprof file:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Configurations>Debug;Release;Staging</Configurations>
</PropertyGroup>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论