2011-03-27 2 views
0

C#에서 Word 2007 용 추가 기능을 작성했습니다. 추가 기능을 배포하기 위해 ClickOnce 설치 관리자를 사용했습니다. 그러나이 추가 기능은 그것은 vsto.log 파일에 다음과 같은 오류가 발생합니다 워드 2010에서 작동하지 않습니다Word 2007 AddIn이 Word 2010에서 작동하지 않습니다.

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. 
File name: 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' 
    at Microsoft.VisualStudio.Tools.Office.Word.Internal.IWordHostItemProviderProxy..ctor(IHostItemProviderExtendedContract hostItemProvider) 
    at Microsoft.VisualStudio.Tools.Office.Word.Internal.IWordHostItemProviderProxy.GetProxy(IHostItemProviderExtendedContract contract) 
    at Microsoft.VisualStudio.Tools.Office.Word.Internal.LocalWordServiceProvider.GetService(Type serviceType) 
    at Microsoft.VisualStudio.Tools.Applications.Internal.LocalServiceProvider.System.IServiceProvider.GetService(Type serviceType) 
    at Microsoft.VisualStudio.Tools.Office.EntryPointComponentBase.Microsoft.VisualStudio.Tools.Applications.Runtime.IEntryPoint.Initialize(IServiceProvider hostContext) 
    at Microsoft.VisualStudio.Tools.Applications.AddInAdapter.ExecutePhase(ExecutionPhases executionPhases) 
    at Microsoft.VisualStudio.Tools.Office.Internal.OfficeAddInAdapterBase.InitializeEntryPointsHelper() 

을 나는 Microsoft.Office.Interop 사이 버전 불일치가 있음을 이해하지만. 추가 기능이있는 Word dll과 Word 2010과 함께 사용 가능한 시스템에서이 문제를 해결할 수있는 방법을 모릅니다. 나는 약간의 구글 검색을했으나 재미있는 것은 아무것도 없었다. 도와주세요.

+0

사용중인 VSTO 및 .NET의 버전은 무엇입니까? – dan9298

답변

0

클릭 한번 설치 프로젝트에서 해당 단어 어셈블리에 대한 특정 버전 확인을 해제해야한다고 생각합니다.

+0

이미 시도했습니다. 작동하지 않습니다 : | – AlgolDocks

0

먼저 확인 PIA (주 Interop 어셈블리는) 다음 http://www.microsoft.com/download/en/details.aspx?id=18346에서 사무실 PIA를 다운로드

bool IsPrimaryInteropAssembliesInstalled() 
    { 
     try 
     { 
      if (Assembly.Load("Policy.11.0.Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") != null) 
      { 
       return true; 
      } 
     } 
     catch (Exception) 
     { 
     } 
     return false; 
    } 

코드

이하로 사용하여 시스템에 설치됩니다. 코드 아래에서 실행하십시오.

void InstallPrimaryInteropAssemblies() 
    { 
     try 
     { 
      string str = "path\o2007pia.msi"; 
      System.Diagnostics.Process process = new System.Diagnostics.Process 
      { 
       StartInfo = { FileName = str } 
      }; 
      process.Start(); 
      while (!process.HasExited) 
      { 
       System.Threading.Thread.Sleep(0x3e8); 
      } 
     } 
     catch (Exception exception) 
     { 

     } 
    } 
1

결국 문제를 추적 할 수있었습니다. 죄송합니다. 빨리 게시하지 않으셔서 죄송합니다. 이 문제를 일으킨 PIA 라이브러리 대신 잘못된 라이브러리에 연결 한 것 같습니다. 변경 후 문제가 해결되었습니다.

관련 문제