New build error after making changes by replacing version = 10.0.0.0 with 11.0.0.0 in VS2010

I have the same problem as Build Error + Creating a VSTO addin for excel 2010

After making changes in accordance with the solution, I received a new error:

The "InitializeDefaultProperties" task could not be loaded from the assembly Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=11.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, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. 

I installed VS2013 on the same computer, so I change version = 12.0.0.0, but I got a new error:

  Error 2 The "SetInclusionListEntry" task could not be instantiated from the assembly "Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type Micro soft.VisualStudio.Tools.Office.BuildTasks.SetInclusionListEntry' to type 'Microsoft.Build.Framework.ITask'. 
+2
source share
2 answers

I know this old post, but maybe I have a solution for you ... I ran into the same problem and I must tell you that the "InitializeDefaultProperties" exception is not fixed for VS2010.

First of all: Make sure that the installation of Visual Studio 2010 is not changed, in any case, perform a clean installation to be sure.

If you changed the changes C: \ Program Files (x86) \ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ OfficeTools \ Microsoft.VisualStudio.Tools.Office.targets .. p>

If you are currently trying to build your VSTO project, the following error should appear:

FindRibbons task cannot be loaded from assembly
Microsoft.VisualStudio.Tools.Office.BuildTasks, Version = 10.0.0.0,
Culture = Neutral, PublicKeyToken = b03f5f7f11d50a3a. Failed to load file or assembly 'Microsoft.VisualStudio.Tools.Office.BuildTasks,
Version = 10.0.0.0, Culture = Neutral, PublicKeyToken = b03f5f7f11d50a3a 'or one of its dependencies. The system cannot find the specified file. Ensure that the <UsingTask> correct, that the assembly and all its dependencies are available, and that the task contains an open class that implements Microsoft.Build.Framework.ITask.

My decision:
-> Open Visual Studio 2010 (you do not need to download the project)
-> Go to click help About Microsoft Visual Studio
-> Check version

Microsoft Visual Studio 2010 version - 10.0.40219.1 SP1Rel
Microsoft.NET Framework - Version 4.5.51209 SP1Rel

If he says RTMRel , download Microsoft Visual Studio 2010 SP1 from here: http://go.microsoft.com/fwlink/?LinkId=210710

It includes the necessary VSTO and VSTO 4.0 Runtime.

If this is not a problem, sorry ...

+1
source

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

0
source

Source: https://habr.com/ru/post/1479159/


All Articles