Getting "ApplicationHost.cs file not found" when trying to start existing project on macOS

1.3k Views Asked by At

ASP.NET newbie here.

Never faced it before, but right now I've faced a critical need to make some adjustments to an existing application. My platform is OS X. I understand that ASP.NET is mostly for windows, but still researched an internet and it looked for me, that it's still possible to run it on my mac.

When I run a project, I get an error:

ApplicationHost.cs file is not found

My Call Stack looks like:

System.Web.Hosting.ApplicationHost.CreateApplicationHost(System.RuntimeType hostType, string virtualDir, string physicalDir)
Mono.WebServer.VPathToHost.CreateHost(Mono.WebServer.ApplicationServer server, Mono.WebServer.XSPWebSource webSource)
Mono.WebServer.XSP.Server.DebugMain(string[] args, bool root, Mono.WebServer.IApplicationHost ext_apphost, bool quiet)
Mono.WebServer.XSP.Server.DebugMain(string[] args)
Mono.WebServer.XSP.Server.Main( Parameters)

I've researched XSP server, but looks like it was removed from homebrew, so I feel myself stucked. Is there any way to run this on Mac without windows virtual machine?

I am ready to provide any additional info you need, but I just don't know what exactly is important to know

Thanks in advance for any kind of help

2

There are 2 best solutions below

0
Евгений Белушко On BEST ANSWER

As I have heard using Mono is not comfortable approach It seems like there are two solutions

  1. To use Windows to continue development on Windows
  2. To porte project to ASP.NET Core
1
AudioBubble On

While working on ASP.NET WebForms (aspx) has it quirks in VS Mac, it can work to some extend. You'll get some unclear error messages like this one.

In my case it was "just" an error in the web.config file (I did put the connection string element incorrectly inside the system.web).

So my advise is: Use VS in Windows if you can, but you can use VS Mac if you don't mind errors like these.

To solve your problem: rewind back what you changed until this error popped up. It may be in your web.config also.