2009-07-02 3 views
0

어떻게하면 dll을 참조해야하는지에 대한 측면에서 csc.exe를 사용하여이 코드를 명령 줄에서 성공적으로 컴파일 할 수 있습니다. Office 2003뿐 아니라 Office 2007에서도 작동하고 싶습니다.명령 줄에서 ms office interop 응용 프로그램을 컴파일하십시오.

.Net Framework SDK 2.0을 사용하고 있습니다.

(2,37) : 오류 CS0234 :

내가이 컴파일 오류 얻을 '상호 운용성'이 네임 스페이스 'Microsoft.Office'에 존재하지 않는 형식 또는 네임 스페이스 이름을 (어셈블리 참조가 누락 ?)

소스 코드 :

using Microsoft.Office.Core; 
using PowerPoint = Microsoft.Office.Interop.PowerPoint; 

namespace PPInterop 
{ 
class Program 
{ 
    static void Main(string[] args) 
    { 
      PowerPoint.Application app = new PowerPoint.Application(); 
      PowerPoint.Presentations pres = app.Presentations; 
      PowerPoint._Presentation file = pres.Open(@"C:\project\JavaTut1.ppt", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse); 
      file.SaveCopyAs(@"C:\project\presentation1.jpg", Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsJPG, MsoTriState.msoTrue); 
    } 
    } 
} 

답변

0

당신이 참조하는 인터페이스를 구현하는 DLL을의 경로를 찾아야하는 경우, 그를 추가하는 방법을 배울 수에는 Csc.exe에 대한 명령 줄 매개 변수를 보면 참조 당신의 명령을 바꾸십시오.

0

Microsoft.Office.Interop.PowerPoint를 포함해야합니다. 경로는 다음과 같아야합니다. Office \ PIA \ Office12 \ Microsoft.Office.Interop 용 Visual Studio 9.0 \ Visual Studio Tools. PowerPoint.dll for 07 및 Office12로 Office12를 03로 바꿉니다.

+0

예 : Csc.exe/noconfig/nowarn : 1701,1702/errorreport : prompt/warn : 4/define : 디버그; 추적/참조 : "C : \ Program Files \ Microsoft Visual Studio 9.0 \ Visual Studio Tools for Office \ PIA \ Office12 \ Microsoft.Office.Interop.PowerPoint.dll"/ 참조 : "c : \ Program Files \ Reference 어셈블리 \ Microsoft \ Framework \ v3 .5 \ System.Core.dll "/reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll/reference :"c : \ Program Files \ Reference Assemblies \ Microsoft \ Framework \ v3.5 \ System.Xml.Linq.dll "/ debug +/debug : full/filealign : 512/optimize- /out:obj\Debug\Test.dll/target : library Test.cs – SpaceghostAli

관련 문제