Visual studio 2010 在VS2010中将版本=10.0.0.0替换为11.0.0.0进行更改后出现新的生成错误

Visual studio 2010 在VS2010中将版本=10.0.0.0替换为11.0.0.0进行更改后出现新的生成错误,visual-studio-2010,msbuild,excel-2010,vsto,excel-addins,Visual Studio 2010,Msbuild,Excel 2010,Vsto,Excel Addins,我遇到了和你一样的问题 根据解决方案进行更改后,我得到了新的错误: 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

我遇到了和你一样的问题

根据解决方案进行更改后,我得到了新的错误:

 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.    
 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'. 

我知道这是一个老帖子,但也许我有一个解决方案给你。。。 我遇到了完全相同的问题,我必须告诉您,“InitializeDefaultProperties”异常对于VS2010是无法修复的

首先: 确保您的VisualStudio2010安装未被修改,无论如何,请进行一次干净的安装以确保安全

如果修改了C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets将还原更改

如果您现在尝试构建VSTO项目,应出现以下错误:

无法从程序集加载“FindRibbons”任务
Microsoft.VisualStudio.Tools.Office.BuildTasks,版本=10.0.0.0,
区域性=中性,PublicKeyToken=b03f5f7f11d50a3a。无法加载文件 或程序集“Microsoft.VisualStudio.Tools.Office.BuildTasks,
版本=10.0.0.0,区域性=中性,PublicKeyToken=b03f5f7f11d50a3a'或 它的一个依赖项。系统找不到指定的文件。 确认
声明正确,并且 程序集及其所有依赖项都可用,并且任务 包含实现的公共类 Microsoft.Build.Framework.ITask

我的解决方案:
-->打开Visual Studio 2010(您不需要加载项目)
-->转到帮助,单击有关Microsoft Visual Studio的信息
-->检查版本

Microsoft Visual Studio 2010版本
10.0.40219.1 SP1Rel
Microsoft .NET Framework
版本4.5.51209 SP1Rel

如果显示RTMRel请从此处下载Microsoft Visual Studio 2010 SP1

它包括必要的VSTO和VSTO 4.0运行时


如果这不是问题,我很抱歉…

因为我在升级构建服务器时遇到了同样的问题。。。我会把解决方案放在这里,以防有人需要

我认为解决这个问题的方法是修复你的GAC

通过记事本打开该工具的.target文件并查看UsingTask标记,您应该会得到如下内容

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

在一台只有VS2010(版本10)可用的机器上随机尝试使用VS2012文件(版本11)不会有任何效果。@HansPassant,你的意思是我应该把它改回版本=10.0.0.0?我的意思是你应该停止做随机的事情来解决你的问题。不管是什么。您将只会遇到两个问题。@Hans Passant,我已将其更改回版本=10.0.0.0,与以前的问题相同。我现在可以去哪里?谢谢