0

I'm trying to build a solution in Visual Studio (2022) for Mac and getting this error Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5/aspnet_compiler.exe is invalid. The project's target framework on .Net 4.6.1.

The executable "aspnet_compiler.exe" is not there in the folder Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5 or in any of the subfolders under the directory /mono.

Please help if you have come across this issue. I can provide additional information if required.

missingsemicolon
  • 480
  • 1
  • 10
  • 23
  • Stop building Windows only projects (WebForms) on Mac, and that's all you should know. BTW, read https://halfblood.pro/the-end-of-mono/ to learn more about why you should leave Mono behind. – Lex Li Jun 26 '23 at 17:22
  • Mono was required to be installed for building the project in VS for Mac. The project is not specifically built for Windows only as it is a web app which is used by Mac end users as well. – missingsemicolon Jun 26 '23 at 17:27
  • Mono is only required to build Xamarin based projects, which will be deprecated next year. All other supported projects like .NET Core based are built by .NET Core SDK. VS for Mac itself does not depend on Mono either. You are building a Windows only project, as long as it targets .NET Framework 4.6.1 and use the ASP.NET precompiler `aspnet_compiler.exe`. Mono is going away and it is useless to argue about it. – Lex Li Jun 26 '23 at 17:31
  • ok thanks. I'm new to Mac so please bare with questions. I installed Mono because there were error messages on the solution explorer against each project in the solution. The error message was "This project requires Mono to be be installed" which is why I installed Mono. How do I get / use aspnet_compiler.exe for mac? I searched but I could not find anything relevant to it. – missingsemicolon Jun 26 '23 at 17:50
  • Also I'm not arguing about using it. I'm just following the instructions on VS for Mac and going from there. – missingsemicolon Jun 26 '23 at 17:53
  • Use a Windows machine please. You won’t find any good on Mac for such projects. – Lex Li Jun 26 '23 at 18:32

1 Answers1

0

In case anyone is looking for an answer, I had to remove the AspNetCompiler task from the project file (.csproj) in order to build the project locally on Mac. We are using this task only to identify compile-time bugs before deploying into production environment. As I removed the task locally, I won't see compilation errors on markup files (.aspx, .ashx) but any errors will be highlighted during deployment via Azure DevOps pipeline which is using Windows-2019 VMImage for building the project.

pool:
  vmImage: 'windows-2019'

If you are using ASPNetCompiler task for other reasons described in this article https://learn.microsoft.com/en-us/previous-versions/aspnet/bb398860(v=vs.100) then you will have to migrate your project to .Net Core or use Windows machine. Here is an article which includes more information on these options: Can you install and run apps built on the .NET framework on a Mac?

missingsemicolon
  • 480
  • 1
  • 10
  • 23