Troubleshooting TeamCity MSBuild error ASPPARSE: Could not load type
July 15, 2010I’ve recently been experimenting with automated builds for an ASP.NET MVC project with the following setup:
- Build Server: TeamCity 5.1.2
- Build runner: MSBuild
- Build project: Visual Studio 2010 Web Deployment Project
- MSBuild/framework versions: .NET 4
- Application details: ASP.NET MVC 2 Web Application .NET 4 project w/ various referenced projects and assemblies
I initially got TeamCity up and working with a Visual Studio 2010 Solution build runner and was successful in building my application, but I wanted to get it up and running with the MSBuild runner so I could pass along some targets and command line parameters like I could do when building the Web Deployment Project through msbuild.exe in a command window. After hours of troubleshooting, I finally have it working and if you’re having the same problem maybe this post will help.
Build errors
When I ran a build with the TeamCity MSBuild runner I kept getting the following error:
[Project "MyProjectName.wdproj.teamcity.patch.tcprojx" (TargetName target(s)):] /MyProjectName.csproj/global.asax(1, 0): error ASPPARSE: Could not load type 'MyProjectName.MvcApplication'.
Go ahead and Google that. If you got here from a search similar to “TeamCity ASPPARSE Could not load type”, we’ve read all the same articles by now, and if you’re in the same situation as me none of them seemed to help.
The error “Could not load type” hints that perhaps TeamCity can’t find the appropriate DLL and there are some discussions on the matter, though with completely different scenarios. None of these fixed my problem.
- ASP.NET MVC 1.0 AfterBuilding Views fails on TFS Build
- ASPNETCOMPILER error ASPCONFIG: Could not load file or assembly...
- error ASPPARSE: Could not load type 'Global'
BuildInParallel=”true”
It wasn’t until I ran across this thread on the ASP.NET forums where someone suggested including this BeforeBuild target:
<Target Name="BeforeBuild">
<MSBuild Projects ="..\WebAppProjDir\ProjName.csproj" BuildInParallel="true" />
</Target>
And my TeamCity build configuration now works! Why? I have no idea, and I’m sorry if you came here for a real understanding of it because I don’t have one yet. The MSDN docs even state “BuildInParallel: If true, the projects specified in the Projects parameter are built in parallel if it is possible. Default is true.” Furthermore, it’s apparently meant to speed up build times in multi-processor systems, not have anything to do with the success or failure of a build.
Nevertheless, adding this target to my Web Deployment Project file was the only thing I could do to get TeamCity to play nice with my MSBuild runner configuration. I’m fairly new to TeamCity and MSBuild so I trust that I’m probably doing something (or ten things) wrong elsewhere. I’m learning as I go. Regardless, if you happen to have a similar problem, I hope this article may have helped.
Tags: TeamCity, MSBuild
Categories: Troubleshooting



View Comments & Reactions >>