Josef Pfleger
Josef Pfleger

Reputation: 74527

How to specify a CompilerVersion for aspnet_compiler.exe without a web.config?

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.configs for our control library components

Upvotes: 2

Views: 3859

Answers (1)

Sorantis
Sorantis

Reputation: 14722

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.

Upvotes: 2

Related Questions