ClickOnce local cache with no shortcut in the start menu

  • Thread starter Thread starter Rui
  • Start date Start date
R

Rui

Can I install a clickonce application locally without a shortcut in the start
menu?

I have an application that allows the user to launch the
TestClient.application file from a local folder, with the codebase property
pointing to the IIS deployment server (e.g.
http://servername:8081/clickonce/TestClient.application).

I would like ClickOnce to try the remote url first (and check for updates)
but use the local cache if the remote server is not available.

The local cache gets created when the user runs TestClient.application but
the launch fails if the IIS server is down.
 
Can I create an application that runs/downloads other clickonce applications?
instead of having the shortcut in the start menu... can I use
ApplicationDeployment to start other ClickOnce applications?
 
I dont see why you would not be able to "run" the .Application file from
another program that would launch the program / install.

Let me see if I follow what you are attempting:

Create a HelloWorld Click Once App.
Point the 1 icon to Helloworld on the users machine. ( the clickonce install
should do this ).
On Hellworld FormLoad, execute another file on the network ( this file
should be the .Application file of another clickonce app. )

Your other option, is that you can directly hit the exe on the other
applications in clickonce.
With clickonce the start menu shortcuts are under the users profile with a
file extention .appref-ms
(these files do not show up in windows explorer).

<written in notepad>

Example:
c:\documents and settings\MiroBeero\Start
Menu\programs\software\Company\HelloWorldSample.appref-ms

So you technically could see if that path exists and run it as well.

Dim stringpath as string = "above example"
Process.start(stringpath)

or change the path to the .application file.
Dim StringPath2 as string = "http:// somewhere/AnotherApp.application"
and Process.start( StringPath2 )

Is that what you are looking for?

Miro
 
Almost... Thanks Miro.

Here’s the scenario:-

Create an application that gets installed on the user’s desktop and displays
icons for applications the users has permissions for (ClickOnce
applications).

User clicks on an icon and the code behind executes the .application file
(using the code below):

Dim StringPath2 as string = "http:// somewhere/AnotherApp.application"
Process.start( StringPath2 )

This only appears to work if the url is available. I need it to work offline
without the shortcut in the start menu.

The firt time the user clicks on the icon it should download the application
locally and only use the URL for updates.
 
Still possible
Do you know what the "list" of applications are?

Lets say you create a form of 5 option buttons.

and 2 command buttons... "ok / cancel"

the 5 option boxes are the list of programs...
You click "ok" after a selection is made.

You see if the .appref-ms shortcut exists... run that, ( basically always
the users own shortcut ). That way its local, and the url is not required.
(this is assuming this shortcut / clickonce app is a clickonce app that is
configured to be able to run offline as well as online).
if not, run the http:// .application file to install it for the first time.
If the internet is not available... you can show the option but set the
"enabled" to false.

This check can happen "on load" to see what options are available or not...
but it all comes down to - and im assuming you do - you know the application
list prior to?

Miro
 
Miro,

Can we have the .appref-ms file without the shortcut on the users start
menu? I want the user to start the applications using my application.

basically, I want to run the http:// .application file to install it for the
first time. But, without the shortucut in the start menu. So the user can
only start the application using my application.
 
Miro,

Found a way to start the download and excute the application using the URL.
I use the InPlaceHostingManager class to download the app and start it using
the ActivationContext object return when I get the nanifest using
GetManifestAsync().

the question is : How do I start the local cached version if the URL is down
and I dont have the .appref-ms file because I dont have a shortcut?

Can you help
 
Take a look in this folder:

C:\Users\Miro\AppData\Local\Apps\2.0\ from here on you have to search for
your .exe file.

Each time the clickonce installs it creates a new folder and keeps the old
version there ( if your new version allows you to uninstall it ).
There is a data folder for your data files...and the non data folder will be
your exe.
I am assuming you dont have a data file so we will ignore the data file for
now.
But you should be able to find your exe somehow searching this folder.
One way to do it as well...is once you find your exe, check to see what
version the exe is ...or include a dummy text file with every install that
has the "date of release".
You will find multiple folders with the same exe ( all different
version )...but run the one with the most recent date.

When the application runs, you can get the exe location by
My.Application.Info.DirectoryPath
but I am unsure how you will get that information prior to running it the
first time.
I would have to do some re-reading to see if its possible. -But I think
something in the above paragraph will work better, search for it - it will
only take a second to find.

Is the above though what you were looking for - the exe location?

You should get this book - i would recommend it, if you plan to do clickonce
deployment.
It is a quick read - and well worth it.
http://www.amazon.ca/Smart-Client-Deployment-ClickOnce-Applications/dp/0321197690
I have read through it once and it talks about the ins and outs of clickonce
apps very well.


Miro
 
Thanks Miro.

I'm using the class InPlaceHostingManager to programmatically run clickonce
applications. The following code works fine on Vista if I call the
AssertApplicationRequirements with a parameter of true. Without passing true
to the AssertApplicationRequirements method I get the error "User has refused
to grant required permissions to the application".

On XP (with System.Deployment.dll version:2.0.50727.1433) the method
AssertApplicationRequirements does not allow me to pass any parameters and I
get the same error "User has refused to grant required permissions to the
application". Is there a way to get this to work in XP? How do I get the
System.Deployment.dll with the new method installed on XP?

ApplicationTrust trust = new ApplicationTrust();
PermissionSet set = new PermissionSet(PermissionState.Unrestricted);
PolicyStatement ps = new PolicyStatement(set);
trust.DefaultGrantSet = ps;
trust.ApplicationIdentity = e.ApplicationIdentity;
trust.IsApplicationTrustedToRun = true;
ApplicationSecurityManager.UserApplicationTrusts.Add(trust);

iphm.AssertApplicationRequirements(true); ---- (true) not supported on XP
 
That I do not know / cant help you with.

I am too much of a newbie to help with this one.

I would suggest starting a new thread and perhaps somenoe might be able to
continue on.

Sorry

Miro
 
Back
Top