어떻게하면 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);
}
}
}
예 : 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