Testing a .NET 7 WASM application #1029
-
I'm having trouble unit testing a Blazor WASM application. Basically, as soon as I add a project reference to the test project, I'm getting the following error:
As you can see, the "two" assets are exactly the same asset. I'm kind of at a loss. My WASM app targets .NET 7, so the test project has to target .NET 7 as well. Is this perhaps the problem? I know the Getting Started docs want the project to target .NET 6, but that's not really an option for me. I'm using Visual Studio 17.5.2, in case that's relevant. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
Hey @PMJMendes ,
To help you further: Can you provide both |
Beta Was this translation helpful? Give feedback.
Hey @PMJMendes ,
bUnit
targets multiple frameworks likenet6.0
andnet7.0
so you can and should target the version your production code is running. So in your case both projects should targetnet7.0
.To help you further: Can you provide both
csproj
files? Also if you calldotnet test
ordotnet build
in your root directory, does it compile cleanly?