Search code examples
msbuildcruisecontrol.netclearcase

Cruise control ASPNETCOMPILER : error ASPRUNTIME: The precompilation target directory


I'm receiving the below error, when I'm trying to build a solution file through CruiseControl and MSBuild version 4

ASPNETCOMPILER : error ASPRUNTIME: The precompilation target directory

Where does it come from and how to avoid it?


Solution

  • You need to double check the precompilation directory location.

    You need either:

    • to delete its content (as in "ASPNETCOMPILER : error ASPRUNTIME: Target Directory not empty")
    • check if its path (Debug.AspNetCompiler.TargetPath or Release.AspNetCompiler.TargetPath in the solution file) is writable (for instance, you cannot write in the root directory of a dynamic view in ClearCase: M:\MyView)
    • check if the Cruise Control has access to your view (especially if it is a dynamic view)

    As illustrated in "Trying to Build and Publish Asp.net website from command line using aspnet_compiler", the error message is usually more complete, similar to:

    Error: error ASPRUNTIME: The precompilation target directory
    (c:\Inetpub\wwwroot\WebsiteOne) 
    cannot be in the same tree as the source application directory 
    (c:\inetpub\wwwroot\WebsiteOne).
    

    From the blog post "Getting Started with CruiseControl.NET":

    For web solutions, update the TargetPath for the Debug and/or Release build of the application to be outside of the source application directory.
    Otherwise, you will receive the following error:

    ASPNETCOMPILER : error ASPRUNTIME: The precompilation target directory cannot be in the same tree as the source application directory.
    

    This can be done by modifying the following in the solution file:

    Debug.AspNetCompiler.TargetPath = “c:\ccnet\PrecompiledWeb\SampleWeb\”
    Release.AspNetCompiler.TargetPath = “c:\ccnet\PrecompiledWeb\SampleWeb\”
    

    Alternative, one may update the Output location found in the application MSBuild properties.

    You may be wondering why an updated solution won’t be updated with the next scheduled build. As it works out (and makes sense) only changes which are applied to source control are pulled onto the build box.