© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
12 replies
LukeJ

✅ 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
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
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="LanguageExt.Core" Version="4.4.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221221-03" />
    <PackageReference Include="NUnit" Version="3.13.3" />
    <PackageReference Include="NUnit.Console" Version="3.16.2" />
  </ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="LanguageExt.Core" Version="4.4.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221221-03" />
    <PackageReference Include="NUnit" Version="3.13.3" />
    <PackageReference Include="NUnit.Console" Version="3.16.2" />
  </ItemGroup>

</Project>

I added in the
Microsoft.NET.Test.Sdk
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.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Structuring Unit Tests
C#CC# / help
13mo ago
✅ Unit tests not appearing
C#CC# / help
3y ago