Article ID: 925521 - Last Review: March 12, 2009 - Revision: 4.1
You receive an error message when you try to update a Visual Studio 2005 ClickOnce application after the certificate that was used to sign the installation expires
When you try to update a Microsoft Visual Studio 2005 ClickOnce application after the certificate that you used to sign the installation expires, you receive the following error message:
The deployment identity does not match the subscription.
This problem occurs because you must sign all ClickOnce deployments by using a digital certificate. You cannot use an expired certificate to sign a ClickOnce application. To deploy an update to an application that has an expired certificate, you must assign the application a new certificate. When the new certificate does not match the original certificate, you receive the error message that is mentioned in the "Symptoms" section.
Update the client computer where the ClickOnce application is installed to the Microsoft .NET Framework 2.0 Service Pack 1 (SP1) or a later version.
Windows Vista
Apply the .NET Framework 3.5 or the .NET Framework 3.5 SP 1.
Note The .NET Framework 3.5 contains many new features that build incrementally upon the .NET Framework 2.0 and 3.0. The .NET Framework 3.5 includes the .NET Framework 2.0 SP1 and the .NET Framework 3.0 SP1.
The following file is available for download from the Microsoft Download Center:
For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591
(http://support.microsoft.com/kb/119591/
)
How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
Windows XP
Apply the .NET Framework 2.0 SP1 or the .NET Framework 2.0 Service Pack 2 (SP2).
The following files are available for download from the Microsoft
Download Center:
For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591
(http://support.microsoft.com/kb/119591/
)
How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
Uninstall the ClickOnce application that you signed by using the expired certificate. Then, reinstall the updated ClickOnce application that uses the new certificate.
Create a command-line assembly that updates the certificate. To do this, follow these steps.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
In Visual Studio 2005, click New on the File menu, and then click Project.
Click Visual C++, click Win32 Console Application, type RenewCert in the Name box, and then click OK.
In the Win32 Application Wizard dialog box, click Finish.
In the RenewCert.cpp file, replace the existing code with the following code:
In the stdafx.h file, replace the existing code with the following code:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently.
//
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely used material from Windows headers.
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <wincrypt.h>
On the Project menu, click Properties to open the property pages for this project.
Expand the Linker node, and then click Input.
Click in the blank window to the right of Additional Dependencies, and then click the ellipsis button (...) to open to the Additional Dependencies dialog box.
In the blank window, type Crypt32.lib, and then click OK.
Click Apply, and then click OK to close the property pages.
On the Build menu, click Build Solution.
After the solution is built, execute the following command to update the certificate:
Note <OldCertificate> is a placeholder for the old certificate, <NewCertificate> is a placeholder for the new certificate, <NewCertificateName> is a placeholder for the name of the new certificate, and <Password> is a placeholder for the password.
On the File
menu, click New, and then click Project.
Click Visual C#, click Windows
Application, type WindowsApplication1 in the
Name box, and then click OK.
In Solution Explorer, right-click WindowsApplication1, and then click Properties.
Click Signing, and then assign a
certificate that expires soon.
In Solution Explorer, right-click WindowsApplication1, and then click Publish. The Publish wizard starts.
On the Where do you want to publish the application? page, type a valid URL, and then click Next. Use the following format for the URL:
http://ServerName/FolderName
On the Will the application be available offline? page, click the appropriate option.
Notes
If you want to let the user run the application when the user is disconnected from the network, click Yes, this application will be available online or offline. The wizard creates a shortcut for the application on the Start menu.
If you want to run the application directly from the
publish location, click No, this application is only available
online. The wizard does not create a shortcut on the Start menu.
Click Next to continue.
Click Finish to publish the application.
Install the ClickOnce application from the http://ServerName/FolderName/publish.htm URL.
After the certificate expires, repeat steps 6 to 10 to republish the application.
Try to install the ClickOnce application update from the http://ServerName/FolderName/publish.htm URL.