sjors miltenburg sjors miltenburg - 1 year ago 180
C# Question

error when building office addin with commandline

project builds just fine in visual studio 2012 (V11) but does not build when building it with msbuild.exe through the command line

error received:

error MSB4062: The "InitializeDefaultProperties" task could not be
loaded from the assembly Microsoft.VisualStudiols.Office.BuildTasks,
Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Could not load file 'Microsoft.VisualStudio.Tools.Office.BuildTasks,

Answer Source

Turns out the project is a outlook 2010 addin. The version of Microsoft.VisualStudiols.Office.BuildTasks.dll I have in my gac is v11 instead of v10 that it seems to require (by default).

Why visual studio CAN build the project probably has something to do with the following line in the csproj file:

<Import Project="$(VSToolsPath)\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" Condition="'$(VSToolsPath)' != ''" />

(I don't know where it gets the vstoolspath variable from)

I solved this by using an extra build config item /p:VisualStudioVersion=11.0 used like so:

/p:Configuration=Debug /p:VisualStudioVersion=11.0
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download