웹, 이메일, 인쇄 문서를 만드는 데 사용되는 Microsoft Word 프로세싱 소프트웨어 제품군입니다.
데모 프로젝트 소스코드를 첨부하고 싶지만 파일이 첨부되지 않아 주요 부분 코드를 아래 작성하였습니다.
프로젝트를 디버깅할 때는 문제되지 않지만, 실행파일로 실행했을 때 문제가 발생합니다.
프로젝트를 빌드 후 ..\bin\Release\DemoWordApplication.exe 파일을 실행하고 Button1을 클릭하면 "Execute" 메시지가 뜨지 않고 오류가 발생합니다.
Form1.cs
public partial class Form1 : Form
{
Microsoft.Office.Interop.Word.Application wordApp = null;
public Form1()
{
InitializeComponent();
}
private void Button1\_Click(object sender, EventArgs e)
{
try
{
wordApp = new Microsoft.Office.Interop.Word.Application();
MessageBox.Show("Execute");
}
catch (Exception ex)
{
throw ex;
}
}
private void Button2\_Click(object sender, EventArgs e)
{
if (wordApp != null)
{
wordApp.Quit();
wordApp = null;
MessageBox.Show("Quit");
}
}
}
app.manifest
..
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
..
또한, app.manifest의 requestedExecutionLevel 을 "asInvoker"로 변경 후, 실행파일을 관리자 권한으로 실행해도 마찬가지로 오류가 발생합니다.
따라서 관리자 권한으로 프로그램 실행 시 오류가 발생한다고 판단했습니다.
확인 후 답변 부탁 드립니다.
감사합니다.