Last post Jan 30, 2017 06:09 AM by edwardf
Jan 30, 2017 04:52 AM|edwardf|LINK
When trying to precompile one MVC site with ASPNET_Compiler, it appears to be trying to compile against the .NET 2.0 Framework despite the tool clearly stating the 4.0 version in the first line of the output.
This obviously results in strange warnings and errors such as:
(0): warning CS1684: Reference to type 'System.Web.IHtmlString' claims it is def
ined in 'c:\Windows\assembly\GAC_64\System.Web\22.214.171.124__b03f5f7f11d50a3a\System.
Web.dll', but it could not be found
The web.config for the affected site clearly references the .NET 4.0 framework, specifically 4.5.2:
<httpRuntime targetFramework="4.5.2" requestValidationMode="2.0" maxRequestLength="65536" />
<compilation targetFramework="4.5.2" batch="true" numRecompilesBeforeAppRestart="250" optimizeCompilations="true">
Other sites on the same Server 2012 R2 machine targeting .NET 4.0 also able to precompile fine.
I even went as far as using aspnet_regiis to remove .NET 2.0 from IIS, which had no effect.
Actually uninstalling .NET 3.5 using Windows got it to work, but we need .NET 3.5 to be installed on this machine.
Jan 30, 2017 06:09 AM|edwardf|LINK
Issue turned out to be caused by an old version of Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll getting into the bin directory.
When it was removed the precompilation worked against .NET 4.0.