ClickOnce appref-ms starting itself with paramters
-
Friday, January 22, 2010 6:46 PMGuys,
I really need to know if the appref-ms file contents change when a ClickOnce application is installed on different machines. I am talking specifically about the contents of the file. I have a way so far to spawn multiple processes each with a new ClickOnce application (started from the same appref-ms) and communicating with SQL Ce to share parameters etc. All I need to know is does appref-ms change and if so when and in what circumstances?
Thanks in advance!
Akrion
Answers
-
Friday, January 22, 2010 7:27 PMModerator
Hello Akrion,
As far as I know, it doesn't change, unless maybe you change something about your deployment, like the installation URL. However, I don't think you can rely on it not changing, as it is pretty much defined by MSFT and there is no supported way to modify or mess with the appref-ms file. This means you can't rely on THEM not changing it. Just consider yourself warned.
Are you running multiple instances of your ClickOnce application on the same desktop?
Do you mean you are you passing parameters via the ms-appref file?
To pass parameters to a ClickOnce application, it needs to be an online application, and you need to pass them attached to the installation URL, like http://myserver.com/myapp.application/?paramA=abc . Is that what you are doing?
Here's some info on how to retrieve the query string info from the URL:
http://msdn.microsoft.com/en-us/library/ms172242(VS.80).aspx
RobinDotNet
Click here to visit my ClickOnce blog!
Microsoft MVP, Client App Dev- Proposed As Answer by RobinDotNetMVP, Moderator Tuesday, January 26, 2010 2:28 AM
- Marked As Answer by Aland LiModerator Sunday, January 31, 2010 7:09 AM
-
Monday, January 25, 2010 6:41 PMModerator
Hi Akrion,
I don't think it will work. People have tried passing parameters via the shortcut before. If you want to make some kind of information available to the app at startup, write it to a text file that the app can read, then have the app read it and then delete it when it starts up.
I'd put the text file in LocalApplicationData in a folder that you create; this will ensure it will work with Vista and Windows Fabulous (7):
string userFilePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string myFolder = Path.Combine(userFilePath, "MyCompany");
if (!Directory.Exists(myFolder))
Directory.CreateDirectory(myFolder);
//now put your file
string FileGoesHere = Path.Combine(myFolder, "startupinfo.txt");
RobinDotNet
Click here to visit my ClickOnce blog!
Microsoft MVP, Client App Dev- Proposed As Answer by RobinDotNetMVP, Moderator Tuesday, January 26, 2010 2:28 AM
- Marked As Answer by Aland LiModerator Sunday, January 31, 2010 7:09 AM
All Replies
-
Friday, January 22, 2010 7:27 PMModerator
Hello Akrion,
As far as I know, it doesn't change, unless maybe you change something about your deployment, like the installation URL. However, I don't think you can rely on it not changing, as it is pretty much defined by MSFT and there is no supported way to modify or mess with the appref-ms file. This means you can't rely on THEM not changing it. Just consider yourself warned.
Are you running multiple instances of your ClickOnce application on the same desktop?
Do you mean you are you passing parameters via the ms-appref file?
To pass parameters to a ClickOnce application, it needs to be an online application, and you need to pass them attached to the installation URL, like http://myserver.com/myapp.application/?paramA=abc . Is that what you are doing?
Here's some info on how to retrieve the query string info from the URL:
http://msdn.microsoft.com/en-us/library/ms172242(VS.80).aspx
RobinDotNet
Click here to visit my ClickOnce blog!
Microsoft MVP, Client App Dev- Proposed As Answer by RobinDotNetMVP, Moderator Tuesday, January 26, 2010 2:28 AM
- Marked As Answer by Aland LiModerator Sunday, January 31, 2010 7:09 AM
-
Friday, January 22, 2010 7:49 PMRobin,
Thanks for your reply. I have done my research and I am aware of the limitations of ClickOnce and passing parameters to it. I know that it only supports query string parameters through the URL start path etc. The thing is that I have an app that MUST run in both ONLINE and OFFLINE and MUST accept parameters @ startup ... !@#!@#... yeah I know :)
Cant change the deployment stragegy to replace ClickOnce @ this time ... its this way of the highway pretty much.
So my solution is to add the appref-ms file as part of my solution. When deployed I start a new process (basically 1st ClickOnce start itself in separate process) using the appref-ms file and pass parameters using the database (both apps access the same SQL Compact).
I understand that MS is God and can change whatever they want ... but is this a risk we all live on daily basis :) ... I am joking but I do understand the risk obviously.
Worst case ... if it change I will deploy anew update to the app ... no?
Thanks for your prompt reply.
Akrion -
Monday, January 25, 2010 6:41 PMModerator
Hi Akrion,
I don't think it will work. People have tried passing parameters via the shortcut before. If you want to make some kind of information available to the app at startup, write it to a text file that the app can read, then have the app read it and then delete it when it starts up.
I'd put the text file in LocalApplicationData in a folder that you create; this will ensure it will work with Vista and Windows Fabulous (7):
string userFilePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string myFolder = Path.Combine(userFilePath, "MyCompany");
if (!Directory.Exists(myFolder))
Directory.CreateDirectory(myFolder);
//now put your file
string FileGoesHere = Path.Combine(myFolder, "startupinfo.txt");
RobinDotNet
Click here to visit my ClickOnce blog!
Microsoft MVP, Client App Dev- Proposed As Answer by RobinDotNetMVP, Moderator Tuesday, January 26, 2010 2:28 AM
- Marked As Answer by Aland LiModerator Sunday, January 31, 2010 7:09 AM

