You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when adding a dependency to a project that has its output set to Exe, the command fails with this message :
[pathtodotnetsdk]\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1047: Assets file '[pathtodependency]\obj\project.assets.json' doesn't have a target for 'net8.0/[host-rid]'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project. You may also need to include '[host-rid]' in your project's RuntimeIdentifiers.
Workaround: adding this to the dotnet publish line: -p:RuntimeIdentifiers=[targetrid]
That makes it work, but it should not be needed when one is already specifying the target via -r. It is of course far from obvious, so took a while to find the workaround.
The text was updated successfully, but these errors were encountered:
With regular dependencies, running dotnet publish works:
dotnet publish LoopControl -c Release -r [targetrid] --self-contained -p:PublishSingleFile=true
However, when adding a dependency to a project that has its output set to Exe, the command fails with this message :
[pathtodotnetsdk]\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1047: Assets file '[pathtodependency]\obj\project.assets.json' doesn't have a target for 'net8.0/[host-rid]'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project. You may also need to include '[host-rid]' in your project's RuntimeIdentifiers.
Workaround: adding this to the dotnet publish line:
-p:RuntimeIdentifiers=[targetrid]
That makes it work, but it should not be needed when one is already specifying the target via -r. It is of course far from obvious, so took a while to find the workaround.
The text was updated successfully, but these errors were encountered: