views:

698

answers:

1

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

A: 

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.

Sorantis
Thanks, but I had already looked at the *available* documentation (command line options etc.) but what I am looking for is a way to do it without a web.config, hence the question.
Josef
Well, IMHO there's no other way of doing this.Either you compile your project using commands, or use web.config.What you can do is create pre-build action script, and compile project in different directory, then use this compiled version for further actions.
Sorantis