2017-12-12 3 views
0

Visual Studio 2010 및 MS SQL Server 2014를 사용하여 vb.net 응용 프로그램을 개발했습니다.보고 목적으로 크리스탈 보고서를 사용했습니다.vb.net에서 exe 파일을 실행하는 데 projectname.exe.config가 필요한 이유

코드 크리스탈 보고서에

을 복사하지 마십시오 = 빌드 작업 = 포함 리소스로 복사 출력 디렉토리에 크리스탈 리포트를 사용하여 4.0

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 

으로 액세스 할 대상 framwork

어둡게 cryRpt As 새 myReportName cryRpt.SetDataSource (xdataset.Tables (0))

문제는 myProject \ bin \ Debug에있는 myproject.exe를 실행하면 양식과 수정 보고서 모두에서 잘 작동합니다.

하지만 myproject.exe를 다른 위치로 복사하면 실행시 충돌이 발생하여 보고서에 데이터 집합이 할당됩니다. exe ​​파일과 같은 위치에 myproject.exe.config 파일을 복사하면 성공적으로 실행됩니다.

그래서 exe 파일이 레코드 용 데이터 세트를 사용하는 경우 myproject.exe.config를 실행해야하는 이유는 무엇입니까? 내 exe 파일과 함께 myproject.exe.config도 배포해야합니까?

안부.

이 내 config 파일

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
<system.diagnostics> 
    <sources> 
     <!-- This section defines the logging configuration for My.Application.Log --> 
     <source name="DefaultSource" switchName="DefaultSwitch"> 
      <listeners> 
       <add name="FileLog"/> 
       <!-- Uncomment the below section to write to the Application Event Log --> 
       <!--<add name="EventLog"/>--> 
      </listeners> 
     </source> 
    </sources> 
    <switches> 
     <add name="DefaultSwitch" value="Information" /> 
    </switches> 
    <sharedListeners> 
     <add name="FileLog" 
      type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
      initializeData="FileLogWriter"/> 
     <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log --> 
     <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> --> 
    </sharedListeners> 
</system.diagnostics> 
<startup useLegacyV2RuntimeActivationPolicy="true"> 
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 
</startup> 
</configuration> 
+0

일부 구성은 구성에 의존합니다. – Crowcoder

+0

EXE를 실행하기 위해 구성 파일이 필요하지 않습니다. 응용 프로그램의 일부 코드가 config 파일에 저장된 구성 데이터에 의존하는 경우 해당 구성 파일이 없으면 분명히 문제가 될 것입니다. 귀하의 경우 config 파일에 데이터베이스 연결 문자열이 포함되어있을 수 있습니다. – jmcilhinney

+0

앱을 게시하는 경우 속성> 게시> 애플리케이션 파일을보고 구성 파일을 필요한 포함 파일로 설정하면 배포에 포함될 수 있습니다. – user2721815

답변

0

My.Settings 내가 생각하는 .exe.config 파일을 사용하여 내부 코드입니다. 가장 쉬운 방법은 열어서 설정이 내부에 저장되어 있는지 확인하는 것입니다. 그런 다음 코드를 변경하여 해당 설정을 다른 위치에 저장할 수 있습니다.

+0

이것은 vb.net winforms 응용 프로그램입니다. – Raza