I'm trying to use the AspNetCompiler task within a custom msbuild file to precompile an 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 v2.0.50727 aspnet_compiler. Is there a way to force it to use the v4.0.30319 aspnet_compiler? The reason I am asking is because I am getting 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 runs fine which makes sense because I am using system.web.extensions in the web.config and the 2.0 aspnet_compiler doesn't know what that is.
ToolPath works for the AspNetCompiler task, but the right thing to do is just set the ToolsVersion="4.0" attribute on your Project element- this will cause all built-in tools to use the correct version and doesn't require the hardcoding of paths.