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
|