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

dotnet test -f net472 fails with net472/win-x86 error #1465

Closed
AArnott opened this issue Dec 26, 2024 · 5 comments
Closed

dotnet test -f net472 fails with net472/win-x86 error #1465

AArnott opened this issue Dec 26, 2024 · 5 comments

Comments

@AArnott
Copy link
Contributor

AArnott commented Dec 26, 2024

I have a multitargeting test project: net472 and net8.0.
Both run tests fine with Visual Studio Test Explorer. But from the CLI, dotnet test only works on the .NET 8 target. The .NET Framework target fails with:

Nerdbank.MessagePack.Analyzers.Tests net472 failed with 1 error(s) (0.1s)
C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1047: Assets file 'D:\source\Nerdbank.MessagePack\obj\test\Nerdbank.MessagePack.Analyzers.Tests\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.

Does TUnit really bring in native binaries such that I need to commit my .NET Framework test projects to architecture specific builds?

@thomhurst
Copy link
Owner

I'd need to investigate. I don't see what's causing this. Can you create a minimal repro

@AArnott
Copy link
Contributor Author

AArnott commented Dec 26, 2024

It turns out it's about as minimal as you can possibly imagine. This reproduces it.

repro1465.zip

Just run dotnet test in the directory after unzipping.

@thomhurst
Copy link
Owner

Cheers. I'm out today but will take a look when I get a chance

@thomhurst
Copy link
Owner

Hmm yeah weird. dotnet test -r win-x86 works. Only thing I can think is this must be some testing platform issue? I'll ask.

@thomhurst
Copy link
Owner

So just seems to be the Output type isn't set properly for net framework. I've added a FAQ section to the docs to tell people to add this if it's missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants