3

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?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
user1383839
  • 215
  • 4
  • 12
  • 1
    Was my edited answer accurate? Was the error message I describe below the one you have? – VonC Jan 15 '13 at 13:42

3 Answers3

5

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have checked all the above points , but did not found anything which has solved my problem. I'm still facing the same issue. – user1383839 Jan 15 '13 at 09:56
  • @user1383839 check also if the error message is complete (see an example of one starting like yours, but more complete: http://stackoverflow.com/q/1702620/6309) – VonC Jan 15 '13 at 10:25
  • @user1383839 see also http://stackoverflow.com/questions/982481/trying-to-build-and-publish-asp-net-website-from-command-line-using-aspnet-compi – VonC Jan 15 '13 at 10:26
1

I have resolved the issue by below changes:

Debug.AspNetCompiler.TargetPath = “c:\ccnet\PrecompiledWeb\SampleWeb\”
Release.AspNetCompiler.TargetPath = “c:\ccnet\PrecompiledWeb\SampleWeb\”
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user1383839
  • 215
  • 4
  • 12
0

Right click on Project in Solution Explorer Select Property Page Select MSBuild Options on the left hand side of dialog box Change path of OutputFolder - Make sure your path doesn't fall under same path tree