Project has no runnable target frameworks defined

I've just upgraded a console app in Rider from Core 3.1 to 6.0 and when I try and run it, Rider says, "Project has no runnable target frameworks defined". What could this mean? Here is my csproj:
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<UseStyleCop>false</UseStyleCop>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Settings.PeerApplication\Settings.PeerApplication.csproj" />
<ProjectReference Include="..\..\src\Settings.Peer\Settings.Peer.csproj" />
<ProjectReference Include="..\..\src\Settings.Services.Abstractions\Settings.Services.Abstractions.csproj" />
<ProjectReference Include="..\..\src\Settings.Services\Settings.Services.csproj" />
</ItemGroup>

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

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<UseStyleCop>false</UseStyleCop>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Settings.PeerApplication\Settings.PeerApplication.csproj" />
<ProjectReference Include="..\..\src\Settings.Peer\Settings.Peer.csproj" />
<ProjectReference Include="..\..\src\Settings.Services.Abstractions\Settings.Services.Abstractions.csproj" />
<ProjectReference Include="..\..\src\Settings.Services\Settings.Services.csproj" />
</ItemGroup>

</Project>
12 Replies
Angius
Angius3y ago
Show your csproj
Cisien
Cisien3y ago
do you have .net 6 installed?
Brady Kelly
Brady KellyOP3y ago
Yes, I have .net 6 installed. I've upgraded all other projects in the solution and they build fine, and the entry point project runs fine Although it's a console application, the output assembly is a dll, and I can't find a setting that might cause that
Cisien
Cisien3y ago
show your csproj
Brady Kelly
Brady KellyOP3y ago
There is my csproj. I've upgraded all the Nuget packages to their latest available versions
Cisien
Cisien3y ago
<OutputType>Exe</OutputType> should go in the first PropertyGroup section
Brady Kelly
Brady KellyOP3y ago
I've put it there with no difference. Here is my current run config:
Cisien
Cisien3y ago
tests should be run with <test framework of choice> however you set that up in rider, i'm not sure
Brady Kelly
Brady KellyOP3y ago
I was just thinking, maybe the tests in the dll are rather intended for the Azure build pipeline and not for me, but surely the developer should also be able to run them locally I just tried Rider's "Run all tests in solution" and it finds no tests Now that I look inside the project (duh, only now) I can't find any classes decorated by a fixture attribute, only this:
public class PeerControllerTests : IClassFixture<WebApplicationFactory<LexisNexis.Settings.PeerApplication.Startup>>
{
protected PeerControllerTests(WebApplicationFactory<LexisNexis.Settings.PeerApplication.Startup> factory)
{
Environment.SetEnvironmentVariable("ASSET_GROUP", "playback");
Factory = factory;
}

protected WebApplicationFactory<LexisNexis.Settings.PeerApplication.Startup> Factory { get; }
}
public class PeerControllerTests : IClassFixture<WebApplicationFactory<LexisNexis.Settings.PeerApplication.Startup>>
{
protected PeerControllerTests(WebApplicationFactory<LexisNexis.Settings.PeerApplication.Startup> factory)
{
Environment.SetEnvironmentVariable("ASSET_GROUP", "playback");
Factory = factory;
}

protected WebApplicationFactory<LexisNexis.Settings.PeerApplication.Startup> Factory { get; }
}
I've just wasted an hour or two trying to get a test project that contains no tests to run
Cisien
Cisien3y ago
you can run them with dotnet test, no? nice
Brady Kelly
Brady KellyOP3y ago
I did learn something though - the Rider test runner looks in the dll for tests and not the exe
Cisien
Cisien3y ago
test projects are usually DLLs they aren't intended to execute on their own

Did you find this page helpful?