How to specify a CompilerVersion for aspnet_compiler.exe without a web.config?
-
05-07-2019 - |
Question
When you precompile a directory that doesn't contain a web.config
, the aspnet_compiler.exe
defaults to CompilerVersion
2.0 and 3.5 code fails to compile. Is the following minimal web.config
the only way to specify the CompilerVersion
?
<?xml version="1.0"?>
<configuration>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
</configuration>
We integrated asp.net precompilation with our build and integration environments and don't use web.config
s for our control library components
Solution
Here you can find its parameters. Also note that ASP.NET Compilation tool is not available with versions of ASP.NET earlier than ASP.NET version 2.0.
For .NET 2.0 these are the steps you need to do
- Start > run and type cmd.
- set path=%windir%\Microsoft.NET\Framework\v2.0.50727
- aspnet_compiler –v / –p c:\myproject\testsite c:\testcompile
I think that for other versions of .NET you have to cd to corresponding directory.
Also read this. You might find it useful.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow