Clickonce install from CD

  • Thread starter Thread starter Lelekács Zoltán
  • Start date Start date
L

Lelekács Zoltán

Hi,

I generated the deployment files into a local directory with specified
installation URL.

My prolbems:
- If there is an internet connection on the client machine, it skips the
files on the local hard drive, immediately start downloading from the web.
- if there is no internet connection, the setup.exe fails (which is the
startup program from a CD), but the application icon installs the software
well.

I implemented a custom async update. When I call the CheckUpdateAsync method
I have got an exception in the Application.ThreadException event, not in the
AsyncCompleted event as the MSDN says (in the e.Error)...
Why?
Thanks.

lelez
------------
Here it is the code:
try
{
ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted += checkHandler;
dep.CheckForUpdateAsync();
}
catch (System.Net.WebException)
{
// never runs!
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
}
catch (Exception ex)
{
xxxx.Common.Util.Logger.LogException(ex);
}

Here it is the handler:
private static void dep_CheckCompleted(object sender,
CheckForUpdateCompletedEventArgs e)
{
if (e.Error is System.Net.WebException)
{
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
return;
}

ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted -= checkHandler;

try
{
if (e.UpdateAvailable)
{
ContinueQuestionEventArgs ce = new
ContinueQuestionEventArgs(e.AvailableVersion.ToString());
// Ask the user about continue...
if (updateIsAvailable != null)
updateIsAvailable(null, ce);

if (ce.Continue)
{
dep.UpdateCompleted += updateHandler;
dep.UpdateAsync();
}
}
}
catch(InvalidOperationException ex)
{
xxxxx.Common.Util.Logger.LogException(ex);
}
} // dep_CheckCompleted...
 
ClickOnce is designed as an Internet technology. If you want to play outside
of that box, you have to be a bit creative. One option is to setup the
Cassini web server to load on the CD and then have it open a browser window
to the drive in question.You can then "click once" install.

If you are putting the software on a CD, however, it seems wiser to just
have an install. If you need to update, bootstrap the startup to check for
newer files and allow it to die gracefully if there is no Internet
connection.

--
Gregory A. Beamer

************************************************
Think outside the box!
************************************************
 
ClickOnce is designed as an Internet technology. If you want to play
outside of that box, you have to be a bit creative.
OK, but there is even a checkbox under the publish tab, that I want to
create autorun.inf for CD installation...
So I think It is not a question of creativity...
Anyway thanks your answer.

My bigger problem is the second one, that I have got an exception in the
main thread when I try to get update information with no internet
connection. MSDN promises that I will get exceptions in the Completed event
handler in the params (e.Error).
Instead this behaviour I have got the exception in the main thread and I
could catch only here...

lelez
 
Back
Top