내 설치 & 배포 프로젝트 내에서 사용자 지정 동작을 호출하여 응용 프로그램의 app.config 내의 일부 항목을 업데이트하려고합니다. 나는 일반적인 방법으로 사용자 지정 설정 섹션, 예컨대 : 나는 사용자 지정 작업을 설정 한Visual Studio 설치 및 배포 프로젝트에서 사용자 지정 구성을로드하려고 할 때 FileNotFoundException이 발생합니다.
[ConfigurationProperty("serviceProvider", IsRequired = true)]
public string ServiceProvider
{
get { return (string)base["serviceProvider"]; }
set { base["dataProviderFactory"] = value; }
}
단지 base.Install (stateSaver) 후 설치의 설치 섹션 중에 호출 할을 싸서했습니다. 코드는 다음과 같습니다 내가 이것을 실행하면
string exePath = string.Format("{0} MyApp.exe", Context.Parameters["DP_TargetDir"]);
SysConfig.Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);
Configuration. MyApp section = Configuration.MyApp)config.GetSection("MyApp");
, 나는이 오류를 얻을 :는 config에
System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for MyApp: Could not load file or assembly 'MyCompany. MyApp.Configuration' or one of its dependencies. The system cannot find the file specified. (C:\Program Files\MyCompany\MyApp\MyApp.exe.config line 5) ---> System.IO.FileNotFoundException: Could not load file or assembly 'MyCompany.MyApp.Configuration' or one of its dependencies. The system cannot find the file specified.
5 호선입니다 :
<section name="MyApp"
type="MyCompany.MyApp.Configuration.MyApp, MyCompany.MyApp.Configuration"
requirePermission="false" />
설치 코드와 클래스 라이브러리 (해당 라이브러리의 유일한 클래스 임)에는 config 어셈블리에 대한 참조가 있습니다.
내가 여기에 실종되었다는 것이 정말 명백한가요? 구성에 대한 참조가없는 이유를 해결할 수 없습니다.
어떤 도움이나 제안이라도 대단히 감사하겠습니다.
그냥 테스트하고 그것은 코드가 C 내에서 실행되고 있음을 보인다는 사용자 지정 설정을 세밀하게 할 수없는 이유 \ WINDOWS \ system32를 그렇게이있을 수 있습니다 어셈블리. –