5

We use a CI server (Jenkins) to compile an ASP.NET project and deploy to our web servers.

I want to precompile the site before deployment to increase performance, so I've set the PrecompileBeforePublish property in the Publish Profile (.pubxml).

However, when Jenkins runs the build, the AspNetPreCompile task fails with the error:

AspNetPreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe
-v /
-p c:\jenkins\workspace\DeployJob\MyProject\obj\Release\AspnetCompileMerge\Source
-c
c:\jenkins\workspace\DeployJob\MyProject\obj\Release\AspnetCompileMerge\TempBuildDir

ASPNETCOMPILER : error ASPRUNTIME: The current identity (JenkinsUser) does not have write access to 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files'.

Note that this is not the machine where the web site will be deployed to, it is just a build server. I could grant the current identity (JenkinsUser) access to the Temporary ASP.NET Files folder, but I'd rather not have to mess around with filesystem permissions on a box that is just acting as a dumb Jenkins slave.

Is there any way around this? Why is aspnet_compiler trying to write the site to the Temporary ASP.NET Files folder, and is there any way to make it use a different temporary directory instead, such as %TEMP%?

Brant Bobby
  • 14,107
  • 14
  • 75
  • 114
  • No clue why, but this is default behavior. Other then placing a ntfs junction, don't know of a way to redirect this without changing the standard ASP.NET behavior on the machine. – jessehouwing Oct 24 '13 at 17:03

1 Answers1

4

I guess you could play around with this:

  <AspNetCompiler ToolPath="C:\Windows\Microsoft.NET\Framework\v2.0.50727"  VirtualPath="temp"  PhysicalPath="$(ProjectDir)\..\Web" /> 

But you're gonna have to give ~some directory the rights.

It's just one of those "live with it" things.........my instructions document for setting up a CI machine has the "give rights to asp.net directory" as you explain.

granadaCoder
  • 21,474
  • 7
  • 81
  • 117