C# VSTO Office 加载项:“FindRibbons”任务意外失败
C# VSTO Office add-in: “FindRibbons” task failed unexpectedly
每次编译项目时,我都会得到这个错误。我的 AssemblyInfo.cs 文件没有属性 ExcelLocale1033
或 SecurityTransparent
。 C:\Program Files (x86)\MSBuild\Microsoft
中没有 VisualStudio
文件夹。
The "FindRibbons" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
Server stack trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
已修复。这是因为我在 VSTO 解决方案中添加了一个新项目。这个其他项目的输出类型(右键单击项目 > 属性)曾经是 Windows Application
。我将其更改为 Class Library
并删除了包含以下代码的 Program.cs
:
class Program
{
static void Main(string[] args)
{
}
}
错误再也没有出现。
每次编译项目时,我都会得到这个错误。我的 AssemblyInfo.cs 文件没有属性 ExcelLocale1033
或 SecurityTransparent
。 C:\Program Files (x86)\MSBuild\Microsoft
中没有 VisualStudio
文件夹。
The "FindRibbons" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
Server stack trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
已修复。这是因为我在 VSTO 解决方案中添加了一个新项目。这个其他项目的输出类型(右键单击项目 > 属性)曾经是 Windows Application
。我将其更改为 Class Library
并删除了包含以下代码的 Program.cs
:
class Program
{
static void Main(string[] args)
{
}
}
错误再也没有出现。