build Add-ins From msbuild command-line

12159
22
11-29-2011 11:09 AM
LukeBadgerow
New Contributor
I am in the process of putting together a CI Server application (Jenkins) that is currently building my SOA application.  I would like to add a desktop add-in that I am also working on to this server, however in order for that to happen I need to be able to build with msbuild.exe.  When I try and compile my add-in project with msbuild I receive the following error (more specifically, the following comes from Jenkins, but it's the same error locally):

Started by user anonymous
Updating http://subversion-repo/EngineeringServices/DesktopGISUtilities/DOTNET/WaterEditorExtension
At revision 1241
no change for http://subversion-repo/EngineeringServices/DesktopGISUtilities/DOTNET/WaterEditorExtension since the previous build
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe
Executing command: cmd.exe /C C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe c:\workspace\dotnet\watereditor10\watereditorextension.csproj && exit %%ERRORLEVEL%%
[workspace] $ cmd.exe /C C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe c:\workspace\dotnet\watereditor10\watereditorextension.csproj && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3623]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 11/29/2011 11:20:08 AM.
Project "c:\workspace\dotnet\watereditor10\watereditorextension.csproj" on node 0 (default targets).
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".
C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.targets(36,5): error MSB4062: The "ValidateAddInXMLTask" task could not be loaded from the assembly ESRI.ArcGIS.AddIns.SDK, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86. Could not load file or assembly 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.
Done Building Project "c:\workspace\dotnet\watereditor10\watereditorextension.csproj" (default targets) -- FAILED.

Build FAILED.

"c:\workspace\dotnet\watereditor10\watereditorextension.csproj" (default target) (1) ->
(PrePackageArcGISAddIn target) ->
  C:\Program Files (x86)\MSBuild\ESRI\ESRI.ArcGIS.AddIns.targets(36,5): error MSB4062: The "ValidateAddInXMLTask" task could not be loaded from the assembly ESRI.ArcGIS.AddIns.SDK, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86. Could not load file or assembly 'Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.68
Build step 'Build a Visual Studio project or solution using MSBuild.' marked build as failure
Finished: FAILURE
0 Kudos
22 Replies
GusMartinka
Occasional Contributor

This worked for me on my Jenkins machine with only VS 2010 Shell installed, I had to install the VS 2010 SDK (not sp1 because I dont have full VS 2010 installed)

0 Kudos
JuhoVainio
Occasional Contributor

4) Throw it in the GAC.

Visual Studio Command Prompt --> Run as Administrator --> gacutil /i Microsoft.VisualStudio.Shell.9.0.dll


Let me know if this works for you guys -- I'm curious to see if there are other issues.

At first it gave me an error, but then I checked the build plan's MSBuild options (TFS 2010). I changed the MSBuild Platform to x86 and then it succeeded!

Thanks for everyone for their help! 🙂
LukeBadgerow
New Contributor
I still get stuck with the same ValidateAddInXMLTask error. 

I'm still tinkering with some configurations though.  Registering the Shell.9.0.dll with the gac didn't solve my issue.  I'm running into a version conflict now with the Shell dll (version I have is 10.0) from my log viewer:

*** Assembly Binder Log Entry  (6/18/2012 @ 8:35:07 AM) ***

The operation failed.
Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = CWW\LBadgerow
LOG: DisplayName = Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MSBuild.exe
Calling assembly : ESRI.ArcGIS.AddIns.SDK, Version=10.0.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Microsoft.VisualStudio.Shell.9.0.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.VisualStudio.Shell.9.0.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Microsoft.VisualStudio.Shell.9.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

0 Kudos
SergeyMalgin
New Contributor
Hello!

If you have this problem, resolved or not - could you please list what you have installed on your machines?
Here's a checklist:

- OS Version
- Major OS SPs, if any
- Visual Studio versions
- Microsoft SDKs
- other software from Microsoft

Thanks
Sergey Malgin
0 Kudos
SergeyMalgin
New Contributor
I still get stuck with the same ValidateAddInXMLTask error. 

I'm still tinkering with some configurations though.  Registering the Shell.9.0.dll with the gac didn't solve my issue.  I'm running into a version conflict now with the Shell dll (version I have is 10.0) from my log viewer:


Hello,
Currently ESRI.ArcGIS.AddIns.SDK.dll binds to a specific version of Microsoft.VisualStudio.Shell.9.0, which is 2.0.0.0. You have 10.0.0.0 in the GAC. You can get 2.0.0.0 from the VS 2008 SDK  at http://www.microsoft.com/en-us/download/details.aspx?id=21827

Let me know if this helps.
0 Kudos
SergeyMalgin
New Contributor
I have this problem, too.


I also found that the missing file Microsoft.VisualStudio.Shell.9.0.DLL is part of the Visual Studio SDK. So I downloaded the VS2010 SDK and installed it. Then I had to manually copy the file to the folder C:/Windows/Microsoft.NET/Framework64/v4.0.30319/ (the dll didn't register to the GAC).

...

I have no idea where to get the ESRI.ArcGIS.AddIns.SDK.resources.DLL from!


You should be able to get it into the GAC if you run Visual Studio Command Prompt as an Administrator. The command is gacutil -if <DLL name>
The required version is 2.0.0.0. You can get it from the Visual Studio 2008 SDK (Microsoft download - http://www.microsoft.com/en-us/download/details.aspx?id=21827)


I am not clear why ESRI.ArcGIS.AddIns.SDK.resources.DLL is requested. It is not in the reference list of the ESRI.ArcGIS.AddIns.SDK assembly and you can verify that with the Reflector or other dependency viewer tool.
What OS locale do you have on your build machine?
0 Kudos
RichardWatson
Frequent Contributor
I have a similar problem in that I use Visual Studio 2012 which is not supported by 10.1.

What I did was to have the Visual Studio project just build the DLL, i.e. I did not use the ESRI template.  I then added a step which creates the add-in "package" myself.
0 Kudos
JoeHershman
MVP Regular Contributor
I have a similar problem in that I use Visual Studio 2012 which is not supported by 10.1.

What I did was to have the Visual Studio project just build the DLL, i.e. I did not use the ESRI template.  I then added a step which creates the add-in "package" myself.


Could you please give a little more detail on how you do the 'package' step.  This is what I am trying to do and have not quite figured out

Thanks
-Joe
Thanks,
-Joe
0 Kudos
RichardWatson
Frequent Contributor
On my machine I have both Visual Studio 2010 and Visual Studio 2012 installed.  I used VS 2010 to create a add-in which generated an soe file.  The soe file is just a renamed zip file to I renamed it to zip and then unzipped it.  You can edit the configuration file and/or replace the DLL and then zip it back up and then finally rename it.

In my particular case, I wrote some software which uses a fixed XML configuration file (I have to manually update it if I update any soe related attributes) but it does automatically generate the soe file.

If you are not pressed for time then you might want to wait until 10.2 is released (sometime in June according to ESRI) because they may well add support for VS 2012 in this release.
0 Kudos
NeilShetty
New Contributor
Just found this thread and solved the issue by making sure VS was running as an administrator.
0 Kudos