2012-01-26 77 views
1

當應用第一次運行時,它將快捷方式複製到啓動文件夾中。爲了在本地機器上進行測試,我希望強制應用程序認爲它是第一次運行,因此我可以重新測試其安裝過程。我該怎麼做呢?有沒有辦法在ClickOnce應用程序中重置IsFirstRun?

基本上我需要知道什麼設置這個布爾值爲TRUE。它必須是在ClickOnce的緩存或註冊表莫名其妙的東西商店... ...

ApplicationDeployment.CurrentDeployment.IsFirstRun 

回答

0

我猜你的代碼是這樣的

if (ApplicationDeployment.IsNetworkDeployed && 
    ApplicationDeployment.CurrentDeployment.IsFirstRun) 
{ 
    ...doing stuff 
} 

你可以實現以下

if (ApplicationDeployment.IsNetworkDeployed && 
    ApplicationDeployment.CurrentDeployment.IsFirstRun) 
{ 
    Settings.Default.IsFirstRun = false; 
    Settings.Default.Save(); 
} 

.... 

if (Settings.Default.IsFirstRun) 
{ 
    // simply test here to see if its first run 
    // you can just flip flag flag in the settings 
    // to acheive the same result. 
} 
相關問題