TeamCity - ASPNETCOMPILER error ASPRUNTIME: Object reference not set to an instance of an object.

Hi,

I'm having trouble building a project in Team City that builds perfectly fine under Visual Studio 2013.

Here is a quick run down of the setup i'm using in TeamCity:

The name of our solution has been renamed to <OUR_SOLUTION> in the examples below.
________________________________________________________

Source Control: Visual Sourcesafe is being used as the Source Control Solution.


Build: MSBuild is being used
     Runner type: MSBuild
     Step name: Build package
     Execute step: Even if some of the previous steps failed
     Build file path: <OUR_SOLUTION>/<OUR_SOLUTION>.sln
     Working directory: (Empty)
     MSBuild version: Microsoft .NET Framework 4.0
     MSBuild ToolsVersion: 4.0
     Run platform: x86
     Targets: (Empty)
     Command line parameters: (Empty)
     Reduce test failure feedback time: (No)
     .NET Coverage tool: <No .NET Coverage>


Environment Variables
     env.MSBuild = c:\Windows\Microsoft.NET\Framework\v4.0.30319


System Properties
     system.Configuration = Debug
     system.DeployOnBuild = true
     system.nodereuse = false

     system.Platform = Any CPU
________________________________________________________

When I try and compile the project I get the following error message:

ASPNETCOMPILER error ASPRUNTIME: Object reference not set to an instance of an object.

Output from the Build Log is at the end of the post.

Unfortunately i've been trying to fix this issue for a while and i've tried the majority of the suggested fixes out out there (clearing *.compiled files, compression on the TC folder, stopping McAfee Real Time scanning (we excluded the folder from scanning on the TC server)).

So, i've come to a bit of a dead end and wondered if anyone here had any ideas on why the project may be building perfectly in VS2013 but not in Team City?

We are currently using the Professional Service License version of Team City.

If you need any more information please let me know.

Regards,

Alex.

[14:48:10]W:      [Step 1/1] MSBuild output
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\Intelligence.aspx.cs(218): warning CS0168: The variable 'e' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\SuppressionHistory.aspx.cs(63): warning CS0472: The result of the expression is always 'true' since a value of type 'int' is never equal to 'null' of type 'int?' [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\SuppressionHistory.aspx.cs(100): warning CS0472: The result of the expression is always 'true' since a value of type 'int' is never equal to 'null' of type 'int?' [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\Training.aspx.cs(166): warning CS0168: The variable 'tEx' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\Training.aspx.cs(214): warning CS0168: The variable 'e' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\Login.aspx.cs(116): warning CS0168: The variable 'ex' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\Login.aspx.cs(242): warning CS0168: The variable 'ex' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\Login.aspx.cs(406): warning CS0168: The variable 'ex' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\Login.aspx.cs(432): warning CS0168: The variable 'ex' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\CampaignArea.aspx.cs(251): warning CS0168: The variable 'e' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\CampaignArea.aspx.cs(522): warning CS0252: Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string' [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\CampaignArea.aspx.cs(518): warning CS0219: The variable 'strStandardMailingType' is assigned but its value is never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\CampaignArea.aspx.cs(519): warning CS0219: The variable 'iPageNumber' is assigned but its value is never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\CampaignArea.aspx.cs(520): warning CS0219: The variable 'iPageSize' is assigned but its value is never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\TacticalCampaign.aspx.cs(275): warning CS0168: The variable 'e' is declared but never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\LiveLeads.aspx.cs(218): warning CS0414: The field 'LiveLeads.m_oResultsDS' is assigned but its value is never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\LiveLeads.aspx.cs(219): warning CS0414: The field 'LiveLeads.m_oTOC' is assigned but its value is never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]   d:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\LiveLeads.aspx.cs(220): warning CS0414: The field 'LiveLeads.m_arrRecordIDs' is assigned but its value is never used [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]
[14:48:10]W:           [MSBuild output]
[14:48:10]W:           [MSBuild output] "D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.sln.teamcity" (TeamCity_Generated_Build target) (1) ->
[14:48:10]W:           [MSBuild output] "D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.sln" (default target) (2) ->
[14:48:10]W:           [MSBuild output] "D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj" (default target) (10) ->
[14:48:10]W:           [MSBuild output] (Build target) ->
[14:48:10]W:           [MSBuild output]   ASPNETCOMPILER : error ASPRUNTIME: Object reference not set to an instance of an object. [D:\TeamCity\buildAgent\work\3d43719b1b5b690f\<OUR_SOLUTION>\<OUR_SOLUTION>.metaproj]
[14:48:10]W:           [MSBuild output]
[14:48:10]W:           [MSBuild output]     71 Warning(s)
[14:48:10]W:           [MSBuild output]     1 Error(s)
[14:48:10]W:           [MSBuild output]
[14:48:10]W:           [MSBuild output] Time Elapsed 00:03:18.83
[14:48:10]i:      [Step 1/1] ##teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_1' value='201502.0']
[14:48:10]i: ##teamcity[buildStatisticValue key='buildStageDuration:buildFinishing' value='15.0']
[14:48:10] : Publishing internal artifacts
[14:48:10] :      [Publishing internal artifacts] Sending using WebPublisher
[14:48:10] :      [Publishing internal artifacts] Sending using ArtifactsCachePublisher
[14:48:10]i: ##teamcity[buildStatisticValue key='buildStageDuration:artifactsPublishing' value='157.0']
[14:48:10] : Build finished

3 comments
Comment actions Permalink

Hello,

Please try to run the same build using MSBuild.exe via command line on the same machine as TeamCity agent and under the same use. Please follow this guideline. Does the build run successfully from command line?
Also see the solution in probably the related issue.

0
Comment actions Permalink

Hi Alina,

Thanks for the help.

Just to keep you updated I followed the instructutions to test the build via the command line and using the aspnet_compiler.exe the build was successful on the Team City server.

Following the advice in the article I changed the Build Runner Type to a Command Line runner using that Command Line script as input. The build is now working successfully. :)

It was obviously the MSBuild settings that were causing the issue although I believe installing the Windows SDK on the Team City server and enabling permissions for the TeamCity user also contributed.

Many thanks for your help.

Regards,

Alex.

0
Comment actions Permalink

Thank you for the update. Don't hesitate to contact us on further questions!

0

Please sign in to leave a comment.