Bug #48271 Build Setup fails due to project ToolsVersion
Submitted: 23 Oct 2009 16:23 Modified: 12 Nov 2009 16:43
Reporter: John Bayly (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.1.2 OS:Any
Assigned to: Tony Bedford CPU Architecture:Any
Tags: 80004005, compile, Deployment, HRESULT, ToolsVersion

[23 Oct 2009 16:23] John Bayly
Description:
When adding MySql.Data to a solution, and referencing MySql.Data in project which is the primary output for Setup project, the Setup build fails with:
An error occurred while validating.  HRESULT = '80004005'

This doesn't happen if you simply reference MySql.Data.dll in the project.

When building the MySql.Data project with Net 3.5 installed the following build output is displayed:
Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5".

It appears that the mysql-connector/Net solution has been built for use with .Net 4.0 which is still in beta (admittedly only for the next few days). This bug probably won't occur if the developer has .Net 4.0 installed, though I can't test that.

I suggest that the project ToolsVersion is changed to 3.5 as it shouldn't expect to be built for a beta version of the framework.

How to repeat:
1. Create new VS Solution
2. Add MySql.Data project to solution
3. Add new Windows Form project to solution
4. Add reference to MySql.Data in Windows Forms project
5. Add new Setup project to solution
6. Add Primary output from Windows Forms project to Setup project
7. Attempt to build Setup project
8. The Windows Forms project will compile successfully
9. The Setup build will return error: An error occurred while validating.  HRESULT = '80004005'

Suggested fix:
Change ToolVersion attribute in MySql.Data.csproj from 4.0 to 3.5

--- MySql.Data.csproj   8 Oct 2009 16:30:04 -0000   1.1
+++ MySql.Data.csproj   23 Oct 2009 15:57:39 -0000
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
   <PropertyGroup>
     <ProjectType>Local</ProjectType>
     <ProductVersion>9.0.30729</ProductVersion>
[12 Nov 2009 12:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/90222
[12 Nov 2009 12:44] Vladislav Vaintroub
Fixed in 6.1, 6.2 and trunk
[12 Nov 2009 16:43] Tony Bedford
An entry has been added to the 6.1.3 and 6.2.1 changelogs:

When building the MySql.Data project with .NET Framework 3.5 installed, the following build output was displayed:

Project file contains ToolsVersion="4.0", which is not supported by this version of
MSBuild. Treating the project as if it had ToolsVersion="3.5".

The project had been created using the .NET Framework 4.0, which was beta, instead of using the 3.5 framework.