dotnet / dotnet/sdk

Restore error for exe that references exe

Open
#45,557 0 comments 0 reactions 1 assignee Claimed by @joeloff View on GitHub
Area-NetSDK untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

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](https://github.com/jaredpar/repro-build-win-x86-asset-error/blob/master/classlib/classlib.csproj#L9) the following to `classlib.csproj`

```xml
Exe
```

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.