Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Exe project dependency when setting -r in dotnet publish #47651

Open
freddyrios opened this issue Mar 17, 2025 · 0 comments
Open

Error with Exe project dependency when setting -r in dotnet publish #47651

freddyrios opened this issue Mar 17, 2025 · 0 comments
Assignees
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@freddyrios
Copy link

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.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants