When attempting to compile the solution with MSBUILD 16 I would see the following error output by the ASPNETCOMPILER.
"C:\MyProject\solution.metaproj" (default target) (22) ->
(Build target) ->
/localhost_12345/WebPage.aspx(1): error ASPPARSE: The virtual path '/UserControls/TheUserControl.ascx' maps to another application, which is not allowed. [C:\MyProject\solution.metaproj]
/localhost_12345/WebPage.aspx(2): error ASPPARSE: Unknown server tag 'uc1:TheUserControl'. [C:\MyProject\solution.metaproj]
It was failing on a Web Forms page that referenced a custom user control.
My solution was mapped with a virtual path defined but this was by design and worked fine when the application is started directly from Visual Studio 2019 with IIS Express.
I needed it to compile the page for the current solution configuration without changing the mapping.
Project("{guid}") = "applicationname", "applicationname", "{guid}"
ProjectSection(WebsiteProperties) = preProject
Debug.AspNetCompiler.VirtualPath = "/localhost_12345"
Debug.AspNetCompiler.PhysicalPath = "Subdirectory\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_12345\"
Release.AspNetCompiler.VirtualPath = "/localhost_12345"
Release.AspNetCompiler.PhysicalPath = "Subdirectory\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_12345\"
SlnRelativePath = "Subdirectory\"
EndProjectSection
EndProject
The following code was the problem
<%@ Register TagPrefix="uc1" TagName="TheUserControl" Src="/DependencyDirectory/TheUserControl.ascx" %>
The fix was to prefix a tilde character '~' at the beginning of the user control path.
<%@ Register TagPrefix="uc1" TagName="TheUserControl" Src="~/DependencyDirectory/TheUserControl.ascx" %>