Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Clickonce - Change deployment URL after publish
 

Clickonce - Change deployment URL after publish

I know that this question was asked here for many times before, but it seems that there is no clear answer for this, so I hope someone wil make sense with this issue.

The scenario is very simple- I've created a ClickOnce deployment on 'mySite.com'.

I want to give the deployment to a client, so he can put them on his local server, 'company1.com', and all updates will be located there.

What is the best way to change the update-location URL (I have many clients, I don't want to create a separate deployment package for each one�?

Eli Gazit  Sunday, March 09, 2008 6:28 PM

Hi

Cool Code Nice new way. Here is also another way but it has some manual intervetion

After publishing in development machine we copy the application to client now we have to change deployment url

do this copy mage.exe file this will be available with .net framework 2.0 sdk

and create a bat file put this following command

mage.exe -Update setuptest_1_0_0_2.application -ProviderUrl http://127.0.0.1/setuptest/setuptest.application

mage.exe -Update setuptest_1_0_0_2.application -AppManifest setuptest_1_0_0_2\setuptest.exe.manifest

mage.exe -Sign setuptest_1_0_0_2.application -CertFile setuptest_TemporaryKey.pfx -Password mypassword

mage.exe -Update setuptest.application -ProviderUrl http://127.0.0.1/setuptest/setuptest.application

mage.exe -Update setuptest.application -AppManifest setuptest_1_0_0_2\setuptest.exe.manifest


mage.exe -Sign setuptest.application -CertFile setuptest_TemporaryKey.pfx -Password mypassword

check this

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2939893&SiteID=1

Now i will give u a secound problem. if you use app.config with u then you have to change in client place then you have to follow this procedure. This will work only one time I mean before installing the application in the click once. After installation if you change and even update the manifest the same will not reflect in the client app so u have to think of a alternative way. I am using a web service to change my app.config file

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2951707&SiteID=1


Manoj Manohar  Monday, March 10, 2008 9:15 AM

This is actually pretty easy. Just open MageUI.exe and change the deployment directory. You could to this at the command like with Mage.exe as well.(MageUI.exe and Mage.exe are both part of Visual Studio) Or use the Microsoft.Builds.Tasks.Deployment.ManifestUtilitiesnamespace to do it programmically.

Check here for information about how to use MageUI.exe and Mage.exe. It really is straight forward.

http://msdn2.microsoft.com/en-us/library/xc3tc5xx(VS.80).aspx

Dan Rigsby  Monday, March 10, 2008 4:04 AM

Thanks.

After some search I created this code:

private void btnUpdateURL_Click(object sender, EventArgs e)

{

string password = txtCertificatePassword.Text;

// Open the deployment file (.application)

DeployManifest deployManifest = ManifestReader.ReadManifest(txtManifestFilePath.Text, false) as DeployManifest;

// Set the URL to the new url:

deployManifest.DeploymentUrl = txtURL.Text;

// Create a new manifest file (in a temp folder)

string tempFileName = @"c:\newManifest.application";

ManifestWriter.WriteManifest(deployManifest, tempFileName);

// Sign the certificate again

string certFilePath = txtCertificateFilePath.Text;

// 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);

MessageBox.Show("Signed! new file: " + tempFileName);

}

}

It seems to change the deployment URL (should I changeboth thewindowsapplication1.application and the windowsapplication1_1_0_0_0.application?)

I've check it some more and let you know.

Eli Gazit  Monday, March 10, 2008 7:48 AM

Hi

Cool Code Nice new way. Here is also another way but it has some manual intervetion

After publishing in development machine we copy the application to client now we have to change deployment url

do this copy mage.exe file this will be available with .net framework 2.0 sdk

and create a bat file put this following command

mage.exe -Update setuptest_1_0_0_2.application -ProviderUrl http://127.0.0.1/setuptest/setuptest.application

mage.exe -Update setuptest_1_0_0_2.application -AppManifest setuptest_1_0_0_2\setuptest.exe.manifest

mage.exe -Sign setuptest_1_0_0_2.application -CertFile setuptest_TemporaryKey.pfx -Password mypassword

mage.exe -Update setuptest.application -ProviderUrl http://127.0.0.1/setuptest/setuptest.application

mage.exe -Update setuptest.application -AppManifest setuptest_1_0_0_2\setuptest.exe.manifest


mage.exe -Sign setuptest.application -CertFile setuptest_TemporaryKey.pfx -Password mypassword

check this

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2939893&SiteID=1

Now i will give u a secound problem. if you use app.config with u then you have to change in client place then you have to follow this procedure. This will work only one time I mean before installing the application in the click once. After installation if you change and even update the manifest the same will not reflect in the client app so u have to think of a alternative way. I am using a web service to change my app.config file

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2951707&SiteID=1


Manoj Manohar  Monday, March 10, 2008 9:15 AM
Eli did the programmatic way, Manoj used the command line way. Both are acceptable, so is the mageui way. It depends on what you want to do. Our solutions in house use a programmitic way as we need to have alot of control over the process.
Dan Rigsby  Monday, March 10, 2008 11:18 AM
Dan mentioned that Mage and MageUI are part of Visual Studio (I'm running VS2008 Professional). However, I'm unable to find it. I've even searched my entire machine for the exe.

Any ideas? To save downloading the dot net 2.0 SDK.
www.clintonrocksmith.com
DJClinton  Tuesday, August 04, 2009 3:33 AM
You must have Windows Vista. To search under the dang Program Files, you have to find the folder you want to search, because of the security stuff I guess.

Try c:\Program Files\Microsoft SDKs\Windows\v6.0a\bin.

You can also open up the Program Files folder and then search.

RobinDotNet

Click here to visit my ClickOnce blog!
RobinDotNet  Tuesday, August 04, 2009 4:12 AM

You can use google to search for other answers

Custom Search

More Threads

• Can't read properties of Winforms UserControl in IE client side Javascript since VS 2005.
• Choosing Stat Menu Icon for Documents
• Class Deployment projects in VS.NET 2005
• Clickonce securtiy permissions to myDocuments
• Is a clickonce - msi hybrid possible?
• File Associations
• package for multiple applications
• Choosing a location to install a file based on a registry key
• Upgrading using the .net installer class
• Version of Exe in a Package