✅ Can no longer run console app after adding unit tests
I made a little test project that I've slowly been building onto. It's gotten big enough now that I've added NUnit unit tests to make it easier, but I seem to have done it wrong and now the app won't open. When I hit run it brings up a configuration window with the error on the bottom
Error: Project has no runnable target frameworks defined
. The Target framework parameter shows net6.0 though, so I'm not sure what the problem is.
Here's what the csproj file looks like
I added in the Microsoft.NET.Test.Sdk
to get the unit tests to appear in the test runner, but it also causes this error running it normally. Comparing it to a freshly made unit test project, the csproj looks about the same. I've definitely done something wrong in adding the nunit packages, but I have no idea what.6 Replies
Your tests should be in a separate project
Ah. Wasn't aware of that, coming from Unity.
That's... slightly annoying, but oh well.
Thanks.
it's not, tests have absolutely no business being in your release code
It's annoying in that I now need two projects open that I need to swap between.
That's the normal flow of most development
Are you not using a proper IDE?
You can have multiple projects in the same solution
Rider and VS will display both just fine
Even run the console app of one and the unit tests of the other?
Huh. Ok then.