I am working on a MAUI app, and the following error started to appear without any identifiable cause (last update from main branch was 6 days ago and project is stable, been working on it fine during the last few days):
“a project with an Output type of Class Library cannot be started directly”
Only thread about this issue happening specifically with maui ( .NET MAUI App (exe) doesnt start after building (Release or Debug) ) says the fix is to include:
<WindowsPackageType>None</WindowsPackageType>
My csproj already includes:
<TargetFrameworks>net9.0;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<OutputType Condition="'$(TargetFramework)' != 'net9.0'">Exe</OutputType>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
(.net9 is for enabling UT)
And we also include the appropriate launchsettings config:
{
"profiles": {
"Windows Machine": {
"commandName": "Project",
"nativeDebugging": false
}
}
}
I have updated VS to the latest version, uninstalled the app from windows, deleted Bin/obj/.vs etc. I have no idea what could be causing the issue except weird VS stuff… Thanks for any input