2012-09-20 3 views
1

새 클래스 인스턴스를 만들 때 "System.Deployment.dll에서 System.Deployment.Application.InvalidDeploymentException '형식의 예외가 발생했습니다."잘못된 배포 예외

PrinterSettings^ MyPS = gcnew PrinterSettings(); 

모든 것이 잘 작동하고 내가 원하는 값을 얻을 :에

그것은 발생합니다.

Form1.cpp :

#include "stdafx.h" 
#include "Form1.h" 
#include "Print.h" 
#include <iostream> 

System::Void DPrint::Form1::Form1_Load(System::Object^ sender, System::EventArgs^ e) 
{ 
    PrinterSettings^ MyPS = gcnew PrinterSettings(); 
    System::Windows::Forms::MessageBox::Show("From Class PrinterSettings: " + MyPS->IniFilePath()); 
} 

Print.h :

#ifndef PRINT_H 
#define PRINT_H 

public ref class PrinterSettings 
{ 
private: 
    System::String^ m_strPath; 


public: 
    PrinterSettings() 
    { 
     m_strPath = System::Windows::Forms::Application::UserAppDataPath; 
    } 

    System::String^ IniFilePath() { return m_strPath; }; 

}; 
#endif 

무슨 일이 일어나고 있는지 어떤 아이디어가? 고맙습니다.

답변

0

이것은 "첫 번째 기회"예외로, 디버거가 처리 할 수있는 예외가 발생하는 것을 관찰합니다. 이 경우 응용 프로그램이 ClickOnce 등을 통해 설치되는 방식을 결정하여 응용 프로그램 경로가 무엇인지 판단하려고 할 수 있습니다.

좋은 설명은 What causes an InvalidDeploymentException in a WPF application?을 참조하십시오.

+0

나는 (배포 후) 미래에 알려질 가치를 얻으려고합니까? 내가 그 일과 아무 관련이 없다는 뜻인가? 고맙습니다. 편집 : 이것이 디버그 문제임을 이해합니다. – Nikonation

+0

@Nikonation 첫 번째 기회 예외 일 경우 사용자에게 표시되지 않습니다. 다른 문제가 없다고 가정하면 문제가되지 않습니다. – akton

+0

정말 고마워요! – Nikonation