How to solve System.IO.DirectoryNotFoundException trying to debug ASP.NET Web App on Visual Studio for Mac

  Uncategorised

I have an ASP.NET Web Application that was written on a Windows Machine and targeting .NET Framework 4.5.1. I am trying to get this code to run on a Mac since some members of our development team use Macs. I have installed Visual Studio for Mac and it is currently at the very latest version (8.7.8 build 4).

The Nuget packages install without problem and I am able to build my project without errors on the Mac. When I start the debugger my Web Browser opens as expected pointing to http://127.0.0.1:8080/

After a long time trying to load the Web App, however, I get an error 500:

System.IO.DirectoryNotFoundException
Could not find a part of the path '/Users/stanley/Projects/my-project/MyProject.Web/bin'.

(And yes, path /Users/stanley/Projects/my-project/MyProject.Web/bin/ does exist although I’m not certain that this is where the Web Server should be looking.)
It is clear to me that the path uses the forward-slash Unix-style path delimiters but for some reason the path ends with a Windows-style back-slash. So I am guessing I might need to do some configuration on either the XSP Web Server or a Project Setting or a Visual Studio Setting or something, but I have no idea what or where I need to check? I have simply installed Visual Studio for Mac, downloaded my source code and compiled it. So it is very possible that I’m missing some other configuration steps.

For reference I am including the first line of the stack trace as well:

at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x0002a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerator.Unix.cs:89

Any suggestions what could be wrong or what I can try to fix it?

Source: Visual Studio Questions

One Reply to “How to solve System.IO.DirectoryNotFoundException trying to debug ASP.NET Web App on Visual Studio for Mac”

  • did u ever get a response to this query? I’m having a similar problem, asp.net website written in VS on a mac, and unable to debug any pages that reside in a folder in the root directory

LEAVE A COMMENT