ClickOnce issues

J

Jack

Hi there,

Apologies if this NG is off-topic but I can't find anything more appropriate
(feel free to let me know). I'm looking at ClickOnce as a possible
alternative to MSI and have poured through much of the docs trying to figure
out how to customize my app's install if possible. In my deployment scenario
users will be downloading the app from my web site in WYSIWYG fashion but
I'm stuck on the following issues:

1) I need to prompt for some install info via various custom dialogs. Can
this even be done using ClickOnce? The only info I can find deals with a
custom bootstrapper but I'm not sure if this is the correct approach and
there's precious little info on the subject anyway.
2) Can users install my app into a central location like "C:\Program Files"
so all users on the machine can access it. While ClickOnce doesn't normally
require admin rights since it installs the app under each user's user
profile folder (and doesn't touch the registry), how does it avoid the bloat
that results from the same app being installed multiple times (once per
user). Is this even correct or am I missing something?
3) I also have a VS AddIn that requires installation but since it's a ".dll"
I can't figure out how to publish it. That is, VS doesn't seem to support
publishing DLL projects unlike ".exe" projects so how would this be done?

Thanks in advance.
 
R

RobinS

Answers below.

Jack said:
Hi there,

Apologies if this NG is off-topic but I can't find anything more
appropriate (feel free to let me know). I'm looking at ClickOnce as a
possible alternative to MSI and have poured through much of the docs
trying to figure out how to customize my app's install if possible. In my
deployment scenario users will be downloading the app from my web site in
WYSIWYG fashion but I'm stuck on the following issues:

1) I need to prompt for some install info via various custom dialogs. Can
this even be done using ClickOnce? The only info I can find deals with a
custom bootstrapper but I'm not sure if this is the correct approach and
there's precious little info on the subject anyway.

No. However, you can write a program to be run as a prerequisite to the
ClickOnce installation, whether it be an msi package, or even a .Net
application. You can create your own prerequisites using the Bootstrapper
Manifest Generator. ClickOnce just copies the files over and sets up the
shortcut to run the application.
2) Can users install my app into a central location like "C:\Program
Files" so all users on the machine can access it. While ClickOnce doesn't
normally require admin rights since it installs the app under each user's
user profile folder (and doesn't touch the registry), how does it avoid
the bloat that results from the same app being installed multiple times
(once per user). Is this even correct or am I missing something?

You can't. The point of ClickOnce is to not require administrative
privileges to install and run your application.
3) I also have a VS AddIn that requires installation but since it's a
".dll" I can't figure out how to publish it. That is, VS doesn't seem to
support publishing DLL projects unlike ".exe" projects so how would this
be done?

Thanks in advance.

Add it to your application as a file, and mark the build action as
"content", and "copy always". There is more info on installing add-ins in
Brian Noyes' ClickOnce book.

RobinS.
GoldMail, Inc.
 
J

Jack

Thanks for the feedback. See (brief) follow-ups below.
No. However, you can write a program to be run as a prerequisite to the
ClickOnce installation, whether it be an msi package, or even a .Net
application. You can create your own prerequisites using the Bootstrapper
Manifest Generator. ClickOnce just copies the files over and sets up the
shortcut to run the application.

Great. I'll look into this. What about post-installation processing however.
I'm also investigating the "System.Configuration.Install.Installer" class
but I'm not yet sure if this is relevant.
You can't. The point of ClickOnce is to not require administrative
privileges to install and run your application.

So the same app is always installed multiple times (once per user)?
Add it to your application as a file, and mark the build action as
"content", and "copy always". There is more info on installing add-ins in
Brian Noyes' ClickOnce book.

Thanks. I played around with these properties before my first post but since
there's no facility for publishing an AddIn project in VS it's still unclear
how to do this. I'll check out the book though. Thanks again.
 
R

RobinS

Answers below...

Jack said:
Thanks for the feedback. See (brief) follow-ups below.


Great. I'll look into this. What about post-installation processing
however. I'm also investigating the
"System.Configuration.Install.Installer" class but I'm not yet sure if
this is relevant.

We've talked about handling post-installation stuff by putting it in the
application, but haven't had to do it yet except in the case of adding a
shortcut to the desktop, which IS done when you run our application.

One thing I think might work is if you included a .net app or msi file to do
the post-clickonce install in your deployment, then had your app check for
it when it starts up. If it finds it, it runs it and then removes it or
renames it or something so it's not there the next time. Also, as with our
shortcut, there is a way to tell if it's the first time after installation
that that version has been run. You could kick off the installation in that
case as well.

Here's the code for adding a desktop shortcut; this shows how to know it's
the first time the user is running it... Sorry if the indents are a little
off; I'm pasting this from a text editor that spaces kind of funny
sometimes.

if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
if (ad.IsFirstRun) //first time user has run the app
{
Assembly code = Assembly.GetExecutingAssembly();
string company = string.Empty;
string description = string.Empty;
if (Attribute.IsDefined(code, typeof(AssemblyCompanyAttribute)))
{
AssemblyCompanyAttribute ascompany =
(AssemblyCompanyAttribute)Attribute.GetCustomAttribute(code,
typeof(AssemblyCompanyAttribute));
company = ascompany.Company;
}
if (Attribute.IsDefined(code, typeof(AssemblyDescriptionAttribute)))
{
AssemblyDescriptionAttribute asdescription =
(AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(code,
typeof(AssemblyDescriptionAttribute));
description = asdescription.Description;
}
if (company != string.Empty && description != string.Empty)
{
string desktopPath = string.Empty;
desktopPath =
string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
"\\", description, ".appref-ms");
string shortcutName = string.Empty;
shortcutName =
string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),
"\\", company, "\\", description, ".appref-ms");
System.IO.File.Copy(shortcutName, desktopPath, true);
}
}


I don't know what the System.Configuration.Install.Installer class is. I do
know that you can call the ClickOnce APIs to get updates, but that's a
completely different topic.
So the same app is always installed multiple times (once per user)?

Yes. We've found this to be fine, because we cache some user files and
config files and stuff like that, and this way, each user has their own
version with their own data.

Thanks. I played around with these properties before my first post but
since there's no facility for publishing an AddIn project in VS it's still
unclear how to do this. I'll check out the book though. Thanks again.

He has some stuff in the book about it. I can't really advise you because I
haven't had to do that yet. But everything else I tried in his book has
worked. So far. :)

Good luck.
RobinS.
GoldMail, Inc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top