Добрый день. В ClickOnce пытаюсь консольно сменить Installation Folder
Для этих целей есть класс, который создает тестовый манифест, где меняет его DeploymentUrl
public static void UpdateURL(/*string certificatePassword, string certificateFilePath,*/ /*string manifestFilePath,*/ string url)
{
var manifestFilePath = @"c:\Tests\OwinSelfHostSample.application";
string password = "Password";
// Open the deployment file (.application)
DeployManifest deployManifest = ManifestReader.ReadManifest(manifestFilePath, false) as DeployManifest;
// Set the URL to the new url:
deployManifest.DeploymentUrl = url;
// Create a new manifest file (in a temp folder)
string tempFileName = @"c:\Tests\newManifest.application";
ManifestWriter.WriteManifest(deployManifest, tempFileName);
// Sign the certificate again
string certFilePath = @"c:\users\hobrus\source\repos\OwinSelfHostSample\OwinSelfHostSample\OwinSelfHostSample_TemporaryKey.pfx";
// Make sure the entered cert file exists
if (File.Exists(certFilePath))
{
// Construct cert object for cert
X509Certificate2 cert;
if (string.IsNullOrEmpty(password))
{
cert = new X509Certificate2(certFilePath);
}
else
{
cert = new X509Certificate2(certFilePath, password);
}
SecurityUtilities.SignFile(cert, null, tempFileName);
Console.WriteLine("Signed! new file: " + tempFileName);
}
}
}
Но в итоге падает с ошибкой
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Tests\OwinSelfHostSample.application resulted in exception. Following failure messages were detected:
+ You cannot start application OwinSelfHostSample from this location because it is already installed from a different location.
+ You cannot start application OwinSelfHostSample from location file:///C:/Tests/OwinSelfHostSample.application it is already installed from location http://f15535be.ngrok.io/OwinSelfHostSample.application. You can start it from location http://f15535be.ngrok.io/OwinSelfHostSample.application or you can uninstall it and reinstall it from location file:///C:/Tests/OwinSelfHostSample.application. If you reinstall the application, be aware that you might lose any customizations that you made to the application.
В чем может быть проблема?
Сборка персонального компьютера от Artline: умный выбор для современных пользователей