Error when building solutions

I created an MSBuild project that builds a solution. It seems to build fine, but at the end, MSBuild encounters the following error:

An unhandled exception of type 'Microsoft.Build.Shared.InternalErrorException' occurred in MSBuild.exe

Additional information: Internal MSBuild Error: The number of projects officially loaded at the beginning of the build should match the number of projects officially loaded at the end of the build.

Any ideas as to what causes this error?

<ProjectDefaultTargets="Build"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<
OutputPath>t:\test\</OutputPath>
<CodePath>C:\code\</CodePath>
</
PropertyGroup>

<TargetName="Test1">
<
MSBuildProjects="$(CodePath)Database\Test1.sln"/>
</
Target>

<TargetName="Test2">
<
MSBuildProjects="$(CodePath)Server\Test2.sln"/>
</
Target>

<TargetName="Build">
<
MSBuildProjects="$(MSBuildProjectFullPath)"Targets="Test1;Test2"RunEachTargetSeparately="false"StopOnFirstFailure="true"Properties="OutputPath=$(OutputPath)"/>

</Target>

</Project>

[5028 byte] By [Gerhardo] at [2008-2-12]
# 1
Hi Gerhardo,

I don't think we've seen this problem before. and I cannot reproduce it with trivial solutions and your master MSBuild project. Can you give me more details about the solutions you're building - number of projects, types of projects, etc. Can you reproduce the problem with 2 new solutions with just one project each? I'd really appreciate your help in diagnosing this.

thanks,
Lukasz

LukaszGwozdz at 2007-9-8 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 2

Hi Lukasz

I can re-produce it pretty easily with the following profile:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="Test1">
<MSBuild Projects="C:\code\MySolution.sln"/>
</Target>
</Project>

The test solution contains one class library project and one Windows form project. The two projects do not reference each other. The class project only contains a dummy class. The Windows forms project contains a form with a few lines of code.

Hope this helps

Gerhardo at 2007-9-8 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 3
Gerhardo,
If this still reproes for you (possibly after you have downloaded the July Community Tech Preview and tried it there) I'd be grateful if you'd log a bug report at http://lab.msdn.microsoft.com/productfeedback/ with all the info we need to reproduce it (possibly the actual solutions/projects you're using, with as much of your code removed from them as possible Smile )

Thanks
Dan

DanMoseley at 2007-9-8 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...

Visual Studio

Site Classified