私たちのチームは、1 年前に同じ状況に遭遇しました。次の手順に従って状況を解決しました。
- 最新の ClickOnce アプリケーション バージョンを確認します。
- *.deploy 拡張子を削除します。
- 必要な *.config ファイルの変更。
- 「Mage.exe」と証明書を使用してマニフェスト ファイル (*.manifest) を更新する (参照: MSDN );
- 'Mage.exe' を使用して、アプリケーション バージョン ディレクトリとルート ディレクトリにある配置マニフェスト (*.application) を更新します。
- *.deploy 拡張子を追加し直します。
これは、Mage を呼び出すための短いコード サンプルですが、それほど複雑ではありません。
// Compose the arguments to start the Mage tool.
string arguments = string.Format(
@"-update ""{0}"" -appmanifest ""{1}"" -certfile ""{2}""",
deploymentManifestFile.FullName,
applicationManifestFile.FullName,
_certificateFile);
// Add password to the list of arguments if necessary.
arguments += !string.IsNullOrEmpty(_certificateFilePassword) ? string.Format(" -pwd {0}", _certificateFilePassword) : null;
// Start the Mage process and wait it out.
ProcessStartInfo startInfo = new ProcessStartInfo(_mageToolPath, arguments);
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
Process mageProcess = Process.Start(startInfo);
mageProcess.WaitForExit();
// Show all output of the Mage tool to the current console.
string output = mageProcess.StandardOutput.ReadToEnd();
// Determine the update of the manifest was a success.
bool isSuccesfullyConfigured = output.ToLower().Contains("successfully signed");