.NET / C# Error on Mac: Failed to sign apphost … requires at least macOS12.0 …

Now, I am still on my „old“ MacBook Pro 11,1 – and I am back to Big Sur. Monterey installed fine, but sleep / wake up didn’t work normally, so I reverted back to Big Sur. That being said – I am now very soon two OS iterations behind and I may have to think about a new machine …

I learn how to code in C# right now and I will do a students project on .NET MAUI, so I installed the .NET framework (6.0) and Visual Studio for Mac (Preview) on my machine. At first it worked fine, but after some update (maybe a macOS update), my command line training programs won’t run anymore.

The complete error message reads like this: „Error NETSDK1177: Failed to sign apphost with error code 0: Executable requires at least macOS 12.0, but is being run on macOS 11.7, and so is exiting.
/Users/xxx/development/csharp/training/…/obj/Debug/net6.0/apphost: the codesign_allocate helper tool cannot be found or used   (NETSDK1177) (ParseDates)“

After some searching, I found the solution: you have to modify the .csproj file of your project and add this line inside the <Property Group> :

<UseAppHost>false</UseAppHost>

Note: most IDEs do not show this file in the files list. In Visual Studio, you have to right click the project name and select „Edit project file“.

Thanks to FaltuTech.com Blog for the solution.