Invalid version of aspnetcompiler when using msbuild 4.0

I am trying to use the AspNetCompiler task in a custom msbuild file to precompile the asp.net 4.0 website. However, when I run:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe custom.msbuild /t:PrecompileWeb

It uses the aspnet_compiler v2.0.50727 file. Is there a way to get it to use aspnet_compiler v4.0.30319? The reason I ask is because I get this error:

ASPCONFIG: Unrecognized configuration section system.web.extensions.

However, if I run:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -p .\My.Web.Site -f .\.PRECOMPILATION -v /

It works fine, which makes sense because I use system.web.extensions in the web.config file, and 2.0 aspnet_compiler does not know what it is.

+3
source share
2 answers

ToolPath AspNetCompiler, - ToolsVersion = "4.0" Project - hardcoding .

+11

, , , - :

http://blogs.msdn.com/b/webdevtools/archive/2010/05/14/the-aspnet-compiler-build-task-in-visual-studio-2010-asp-net-mvc-2-projects.aspx

ToolPath AspNetCompiler :

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="PrecompileWeb">
        <AspNetCompiler
            VirtualPath="/MyWebSite"
            PhysicalPath="c:\inetpub\wwwroot\MyWebSite\"
            TargetPath="c:\precompiledweb\MyWebSite\"
            Force="true"
            Debug="true"
            ToolPath="C:\Windows\Microsoft.NET\Framework\v4.0.30319\"
        />
    </Target>
</Project>
+4

Source: https://habr.com/ru/post/1756045/


All Articles