MSBuild w/ Cruise Control Error

Topics: Bugs, General Discussion
Jul 31, 2008 at 3:17 AM
Edited Jul 31, 2008 at 3:19 AM
Hi All,

I'm receiving the following error when executing an MSBuild against my solution that contains a DocProject:

C:\Program Files\Dave Sexton\DocProject\bin\DaveSexton.DocProject.targets (40,5): errorMSB4018: The "BuildDocProject" task failed unexpectedly. Microsoft.Build.BuildEngine.InvalidProjectFileException: The imported project "C:\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\CodeBuilds\Gnomz.Viewpoints\Building\Viewpoints.2008\Projects\Viewpoints.MetaModel\Viewpoints.MetaModel.csproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, XmlNode xmlNode, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject(Boolean condition, String errorSubCategoryResourceName, XmlNode xmlNode, String resourceName, Object arg0) at Microsoft.Build.BuildEngine.Project.LoadImportedProject(Import import) at Microsoft.Build.BuildEngine.Project.ProcessImportElement(XmlElement importElement, Boolean importedProject) at Microsoft.Build.BuildEngine.Project.ProcessProjectChildren(XmlElement projectElement, Boolean importedProject) at Microsoft.Build.BuildEngine.Project.ProcessMainProjectElement() at Microsoft.Build.BuildEngine.Project.RefreshProjectIfDirty() at Microsoft.Build.BuildEngine.Project.InternalLoadFromXmlDocument(XmlDocument projectXml) at Microsoft.Build.BuildEngine.Project.Load(String projectFileName) at DaveSexton.DocProject.MSBuild.MSBuildAnyProject..ctor(Engine engine, String projectFile) at DaveSexton.DocProject.MSBuild.MSBuildAnyProject..ctor(Engine engine, BuildDocProject task, String projectFile) at DaveSexton.DocProject.MSBuild.MSBuildSourceProject..ctor(Engine engine, BuildDocProject task, String projectFile) at DaveSexton.DocProject.MSBuild.MSBuildDocProject.LoadSources() at DaveSexton.DocProject.MSBuild.BuildDocProject.get_Project() at DaveSexton.DocProject.MSBuild.BuildDocProject.get_Engine() at DaveSexton.DocProject.MSBuild.BuildDocProject.Execute() at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)

It seems as though the MSBuild Property 'MBBuildBinPath' is being populated when running the DocProject in Visual Studio 2008, but not when executing an MSBuild. The path to the Microsoft.CSharp.targets file should point to the C:\Windows\Microsoft.Net\Framework\v3.5\ folder. Am I missing something, or is this a bug? I have tried rebooting my build server to make sure all Environment Path Variables were correctly set.

Jul 31, 2008 at 4:03 AM

Seems like this issue may be related to this work item:

The OP suggested that a workaround is to modify DocProject's source code by adding the following line to the DaveSexton.DocProject.MSBuild.BuildDocProject class:

    msEngine.GlobalProperties.SetProperty("MSBuildToolsPath", this.MSBuildBinPath);

Note that I haven't tested this myself.

- Dave
Aug 3, 2008 at 4:45 PM
Edited Aug 3, 2008 at 10:46 PM
Hi Dave,

Yes, this does look like the same issue. Is there an ETA for the fix mentioned in the work item you referred to, or is this a fix I should make for now?

Aug 3, 2008 at 9:03 PM

The next release is going to be my MAML editor, hopefully sometime this week, and following that will probably be the next release of DocProject 2008.  So I really don't know at this time when DocProject 1.12.0 will be available.

You should try implementing this yourself in the mean time if the error is a showstopper for you.

- Dave