Reputation: 2750
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=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file 'Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=10.0.0.0
Upvotes: 4
Views: 1446
Reputation: 24939
I followed these steps.
1.)
install VS 2010 Tools for Office Runtime
https://www.microsoft.com/en-GB/download/details.aspx?id=48217
2.)
Upvotes: 0
Reputation: 2750
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:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
/p:Configuration=Debug /p:VisualStudioVersion=11.0
"$base_dir\OutlookAddin\OutlookAddin.csproj"
Upvotes: 4