Skip to content

Restore error for exe that references exe #45557

Open
@jaredpar

Description

Describe the bug

When building a multi-targeted exe where one target is net472, referencing another exe and including xunit.v3 packages the following error will occur:

classlib net472 failed with 1 error(s) (0.0s)
C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1047: Assets file 'C:\Users\jaredpar\temp\example\classlib\obj\project.assets.json' doesn't have a target for 'net472/win-x86'. Ensure that restore has run and that you have included 'net472' in the TargetFrameworks for your project. You may also need to include 'win-x86' in your project's RuntimeIdentifiers.

To Reproduce

  1. Clone https://github.com/jaredpar/repro-build-win-x86-asset-error
  2. Run dotnet build

Note: this error will go away if you explicitly add the following to classlib.csproj

<OutputType>Exe</OutputType>

This is actually done by the props file pulled in via xunit.v3 but apparently it's not early enough to head off whatever issue this is.

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions