Visual Studio 2019 Publishing Problems in the local dev env
Incorrect compiler version injected into web.config
We had a .NET web project referencing a number of other projects contained in the same solution. The "main" web project did not have any references to Microsoft.CodeDom.Providers.DotNetCompilerPlatform while the referenced modules did - version 3.6.0. When the web project was published to the local development website the following was injected into the web projects web.config for version 2.0.0 of Microsoft.CodeDom.Providers.DotNetCompilerPlatform:
<compiler language="c#;cs;csharp" extension=".cs"
compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
The site would not start up as it could not find assemblies related to version 2 of Microsoft.CodeDom.Providers.DotNetCompilerPlatform.
Fix was to add a reference to the Microsoft.CodeDom.Providers.DotNetCompilerPlatform version 3.6.0 nuget package in the web project.
We experienced a similar issue related to the Microsoft.Extensions.Configuration.Abstractions assembly - fix again was to add a reference in the web project to its nuget package in the same version as used in the other projects.
App_Config folder created as file
Occasionally the App_Config folder is created as a file which causes the deployment project to fail as it cannot copy configuration files to the folder as it is a file - why this happens I do not know but the quick solution is to delete the App_Config "file" and re-run the deployment project