This error listed in the title might be a 'virtual' error. This article will give an explanation.
Introduction
Yes, I got this error previously,
and was stuck for a long time without a solution until the error was gone accidentally.
Yes, if you google, you can find out a ton of questions about this, and the same amount of solutions (see references below for examples), but they might not or never work.
Actually, this error might be a virtual error, at least for me it is true. I would share my experience, in order for some or, might be, most of you, not to waste time on it.
My Solution
Actually, I did nothing, just moved the project closer to the C Drive root, the problem is gone.
The project used to be under the folder,
C:\Users\username\source\repos\Projects\Project_Categaries/Active/ProjectName
I moved it to the folder,
C:\Users\username\source\repos\
then the error is gone.
I did several tests, the project, and the error message indeed was dependent on the path length.
My Analysis
This project was obtained as a zip file. The problem probably was caused by the zip-unzip process. When I used another zip tool, I did have the experience, the file name is too, like these,
or,
However, we used Microsoft Windows 10 built-in zip-unzip tool for this project,
- Right-click the file you want to zip, and then select Send to > Compressed (zipped) folder.
- To unzip the entire folder, right-click to select Extract All, and then follow the instructions.
Zip
Microsoft zip-unzip tool didn't give any error hint.
Summary
The error "Creating a virtual directory failed" might be a fake error or a virtual error. In my experience, it is possibly caused by the reason of fine name too long when unzipping the file to a long name folder. Moving the project closer to the Drive root could solve the problem.
The following references give a lot of other reasons for this kind of error, that might not be true.
Reference