나는 주저로 Shadow Copy을 시도하고 있습니다. 나는 다음과 같은 코드를 가지고있다 :AppDomain 섀도 복사본 참조 된 어셈블리를 포함하십시오
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
var sApplicationDirectory = Application.StartupPath;
var sAppName = "propane";
AppDomainSetup oSetup = new AppDomainSetup();
string sApplicationFile = null;
// Use this to ensure that if the application is running when the user performs the update, that we don't run into file locking issues.
oSetup.ShadowCopyFiles = "true";
oSetup.ApplicationName = "MyApplication";
// Generate the name of the DLL we are going to launch
sApplicationFile = System.IO.Path.Combine(sApplicationDirectory, sAppName + ".exe");
oSetup.ApplicationBase = sApplicationDirectory;
oSetup.ConfigurationFile = sApplicationFile + ".config";
oSetup.LoaderOptimization = LoaderOptimization.MultiDomain;
// Launch the application
AppDomain oAppDomain = AppDomain.CreateDomain(sAppName, AppDomain.CurrentDomain.Evidence, oSetup);
oAppDomain.SetData("App", sAppName);
oAppDomain.ExecuteAssembly(sApplicationFile);
// When the launched application closes, close this application as well
Application.Exit();
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Form1());
}
}
실행 파일은 참조 된 dll에 도달 할 때까지 임시 디렉토리에 도달하고 실행 중이다. 프로젝트를 통해 참조한 14-16 개의 DLL이이 임시 디렉토리에 복사되지 않아 앱이 터졌습니다.
무엇이 누락 되었습니까? 어떻게하면 임시 디렉터리에도 복사 할 수 있습니까?
모든 종속성은 sApplicationFile과 동일한 디렉토리에 있습니까? (서브 디렉토리에는 없음) –
예, 실행 파일과 동일한 디렉토리에 있습니다. – ErocM