a new build error after making change by replacing version=10.0.0.0 with 11.0.0.0 in VS2010

前端 未结 2 1822
抹茶落季
抹茶落季 2021-01-22 18:50

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

After making the change according to the solution, I got the new error:

 The          


        
相关标签:
2条回答
  • 2021-01-22 19:37

    I know it's an old post, but maybe I have a solution for you... I ran into exactly the same problem and I have to tell you that the "InitializeDefaultProperties" exception is not fix-able for VS2010.

    First of all: Make sure that your Visual Studio 2010 installation is not modified, anyway make a clean install just to be sure.

    If you modified the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets revert your changes.

    If you now try to build your VSTO Project the following error should apppear:

    The "FindRibbons" task could not be loaded from the assembly
    Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=10.0.0.0,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not 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 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.

    My Solution:
    --> Open Visual Studio 2010 (you dont need to load a Project)
    --> Go to Help an click 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 it says RTMRel download the 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 thats not the Problem, I'm sorry...

    0 讨论(0)
  • 2021-01-22 19:50

    As I encountered the same problem upgrading our build server... I am gonna put the solution here in case anyone needs it.

    I think the way to solve this is to fix your GAC.

    Open the .target file of that tool by notepad and take a look at the UsingTask tag, you should get something like

    <UsingTask TaskName="InitializeDefaultProperties" AssemblyName=" Microsoft.VisualStudio.Tools.Office.BuildTasks", Version=11.0.0.0,..., PublicKeyToken=sthsthsth
    

    Then, go to your GAC files, e.g. 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 is:

    v<.NETFramework Version, mostly 4.0>_<Assembly Version>_<PublicKeyToken>

    And then, put the .dll file of Microsoft.VisualStudio.Tools.Office.BuildTasks in it. This dll should be obtained when you install VSTO either by directly install (VSTO2010) or by Visual Studio installer

    e.g.

    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 place the dll inside the folder created

    Then this issue should be fixed. Good luck

    0 讨论(0)
提交回复
热议问题