views:

471

answers:

3

We have a VS2008 CS DLL project targeting .NET 3.5. It builds successfully on our CI server when using MSBuild 3.5.

When CI is upgraded to use MSBuild 4.0, the same project fails to build, due to 1 warning message:

c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1418,9): warning MSB3283: Cannot find wrapper assembly for type library "ADODB".

The warning does not occur with MSBuild 3.5, and I'm surprised that it results in Build FAILED. We do not have the project set to treat warnings as errors.

All our other projects build successfully with either version of MSBuild.

A: 

Try either removing any hardwired toolsversion in your msbuild (and csproj) files, or setting them to ToolsVersion="4.0".

Read: http://msdn.microsoft.com/en-us/library/bb383796.aspx for a better understanding of the significance of the attribute. Since you want to target 3.5, make sure you have the target framework version set up correctly by checking that the TargetFrameworkVersion in your csproj.

<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

If you set the ToolsVersion to 4.0, any machine that wants to build the project, will have a dependency on the 4.0 framework (which has the 4.0 msbuild), even though you're targetting 3.5.

If you're targetting 3.5, and your projects are VS2008, there's no need to use msbuild 4.0 over msbuild 3.5 (they can exist peacefully side by side). Just using the 3.5 msbuild would be the simpler solution.

FrederikB
That sounds plausible, and I read the link you provided. I made the change in the build file and in the csproj file. But the error is still the same, except that it has occurred in .NET Framework v4.0.30319 now. While we are targetting 3.5, and the project is currently VS2008 (soon to be upgraded -- which should solve this problem), for CruiseControl.NET you set the version of MSBuild in the ccnet.config file, ie globally for all projects. Since we have VS2010 projects running under CC.NET, this needs to be v4.0.
David White
Would it be possible to have your main CI build script spawn an msbuild 3.5 and build the 2008/3.5 project through the spawned msbuild? Spawning can be done through the 'exec' msbuild task.
FrederikB
That sounds like an idea worth trying. Will report back.
David White
A: 

This is a ClickOnce issue. Remove that dependency from the list.

BTW, this bug is present in VS2008 too, but seems to not have triggered for you.

leppie
We are not using ClickOnce, so I don't understand how this could be a ClickOnce issue? What dependency am I looking for?
David White
@David White: ADODB, IIRC it gets included with Report Viewer in my case, but something else might 'require' it. ClickOnce errorred on this for us, but the issue could be earlier. Make sure you have no ClickOnce settings in the project files (or just search the project file text for ADODB reference).
leppie
ADODB is required.
David White
A: 

The error message was not telling the whole story. The ADODB assembly on our dev machines is loaded in the GAC. That was not the case on the CI build machine.

The reference to ADODB was only placed into our C# project by a TLBIMP pre-build task, within the C# project (along with references to MSXML and VBA dlls). The latter DLLs are included in our source code repository, and thus found during the CI build process. ADODB is not. However, we also discovered that we could safely remove from the C# project all the added references, including the one to ADODB.DLL.

This fixed the problem. (Thanks for your suggestions -- they kept me thinking till we got there.)

David White