Compile error Program does not contain a static 'Main' method suitable for an entry point
I'm trying to add TUnit testing to my already existing Blazor hybrid + Web API project but I keep receiving the error CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point
Even in a completely new web api project it keeps throwing this error.
I am not sure what is expected here since the documentation says:
And then remove any automatically generated Program.cs or main method, as this'll be taken care of by the TUnit package.
In visual studio there isn't even a "Use testing platform server mode" anymore in the insiders version. Primarily I use Rider which I already enabled the Testing platform support.
This is the Tests.csproj it references the main project.
The main project does include a Program.Main
The Tests project does not.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Name\InsertProjectName.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
<PackageReference Include="TUnit" Version="1.2.3" />
</ItemGroup>
</Project>
So have I forgotten something, is it not compatible with the latest version or did I do something wrong? The template seems to have the same error.
Using the latest version of Rider (2025.3.0.1), Visual Studio Community 2026 (11206.111) and TUnit 1.2.3.
Try adding output type exe.
If not, do you have a directory build props file configuring stuff?
Adding <OutputType>exe</OutputType> to the Tests project does not seem to fix it.
I don't have any Directory.Build.props file.
The templates from TUnit.Templates 1.2.3 gave me the same error.
So I'm uncertain where this originates from.
@maskedmouse I'm gonna need a reproduction project