1

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.

enter image description here

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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>

1 Comment

"The runtimeIdentifier must be specified in the .csprof file:" - no it does not. Maybe it can't be specified for nuget action in TC but in general - no, runtime identifier can be specified as parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.