When I encountered the same problem when updating our build server ... I am going to post a solution here in case anyone needs it.
I think the way to solve this problem is to fix your GAC.
Open the toolβs .target file with notepad and look at you should get something like
<UsingTask TaskName="InitializeDefaultProperties" AssemblyName=" Microsoft.VisualStudio.Tools.Office.BuildTasks", Version=11.0.0.0,..., PublicKeyToken=sthsthsth
Then browse to the GAC files, for example, C: \ Windows \ Microsoft.NET \ Assembly \ GAC_MSIL \ Microsoft.VisualStudio.Tools.Office.BuildTasks.
Then create a new folder: v4.0_11.0.0.0_sthsthsth, which:
v<.NETFramework Version, mostly 4.0>_<Assembly Version>_<PublicKeyToken>
Then put the .dll file of the Microsoft.VisualStudio.Tools.Office.BuildTasks file into it. This dll must be obtained when installing VSTO, either by direct installation (VSTO2010), or using the Visual Studio installer
eg
C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ BuildTools \ MSBuild \ Microsoft \ VisualStudio \ v15.0 \ OfficeTools \ Microsoft.VisualStudio.Tools.Office.BuildTasks.dll
for Visual Studio 2017, and then directly put the DLL in the created folder
Then this problem should be fixed. Good luck
source share