Question

I have TeamCity running MSBuild task for an ASP.NET MVC 3 application. Now every now and then (seemingly randomly) it throws "ASPNETCOMPILER : error ASPRUNTIME: The application domain in which the thread was running has been unloaded.". It happens when MSBuild executes "MvcBuildViews" and runs aspnet_compiler.exe.

Now I know there is an "-errorstack" switch for aspnet_compiler.exe (http://msdn.microsoft.com/en-us/library/ms229863(vs.80).aspx) that can give me stack trace information about this error, but it seems that AspNetCompiler Task does not expose possibility to set this attribute (http://msdn.microsoft.com/en-us/library/ms164291.aspx).

So my question is - is there a way to pass any custom attribute to existing MSBuild Task or I have to run aspnet_compiler.exe manually outside MSBuild to enable -errorstack feature ?

Was it helpful?

Solution

We had found a reason for this error (but not really how to add a custom attributes to MSBuild Tasks). It seems that this exception is happening when build servers are running low on memory.

OTHER TIPS

You can achieve this by using the Exec MSBuild task in your csproj file. For example the original task:

<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />

becomes:

<Exec Command="$(MSBuildFrameworkToolsPath)\aspnet_compiler.exe -v temp -errorstack -p $(WebProjectOutputDir)" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top