PC Review


Reply
Thread Tools Rate Thread

ClickOnce application and Application Assembly Path

 
 
CraigH
Guest
Posts: n/a
 
      10th Feb 2009
I've recently updated a WinForms application (using .NET 3.5) to utilise
ClickOnce features to perform version updates at startup.

On launch, the existing application scanned it's installation folder for
plugin type assemblies that would be loaded if they were present and met
certain criteria.

After performing an update of the application (at launch) via ClickOnce, the
ExecutingAssembly seems to be pointing to the update location which is
located on a network path, resulting in a SecurityException when attempting
to access the CodeBase property of the ExecutingAssembly.

Assembly.GetExecutingAssembly().GetName().CodeBase

Is there an alternative way of identifying your executing location when
using ClickOnce so that I can search for assembly files in my application
folder?

Thanks
 
Reply With Quote
 
 
 
 
miher
Guest
Posts: n/a
 
      11th Feb 2009
Hi,

This should work for simple assemblies.

string deploymentDir = string.Empty;
if
(System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
deploymentDir =
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

Hope You find this useful.
-Zsolt

"CraigH" <(E-Mail Removed)> wrote in message
news:CE3B60D7-7445-4B95-8AD8-(E-Mail Removed)...
> I've recently updated a WinForms application (using .NET 3.5) to utilise
> ClickOnce features to perform version updates at startup.
>
> On launch, the existing application scanned it's installation folder for
> plugin type assemblies that would be loaded if they were present and met
> certain criteria.
>
> After performing an update of the application (at launch) via ClickOnce,
> the
> ExecutingAssembly seems to be pointing to the update location which is
> located on a network path, resulting in a SecurityException when
> attempting
> to access the CodeBase property of the ExecutingAssembly.
>
> Assembly.GetExecutingAssembly().GetName().CodeBase
>
> Is there an alternative way of identifying your executing location when
> using ClickOnce so that I can search for assembly files in my application
> folder?
>
> Thanks


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ClickOnce application and Application Assembly Path CraigH Microsoft Dot NET Framework Forms 0 4th Feb 2009 03:02 PM
Application with long path dies without error during Application.R =?Utf-8?B?QnJpYW5L?= Microsoft Dot NET Framework Forms 0 8th Nov 2006 10:02 PM
How to force the application to load third party assembly on memory when application loading? ABC Microsoft Dot NET Framework Forms 1 24th Aug 2006 05:57 AM
Application.Restart on ClickOnce Deployed Application =?Utf-8?B?TmVpbEc=?= Microsoft Dot NET Framework Forms 0 5th May 2006 01:10 PM
What is the application path for class library assembly? =?Utf-8?B?Q2hyaXM=?= Microsoft ADO .NET 4 3rd Feb 2004 07:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:18 PM.