Reflection issue after initial ClickOnce deployment

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

Hi,

We're having a windows application that's deployed through ClickOnce
deployement. The deployment is working just fine and the application
runs with no problem.


We have logic that load assemblies and the resources (e.g. XML files
added to the assembly as resources) at the beginning of the
application in the Main method. Both assemblies and resources are
loaded just fine and working as intended in both developer
environment
and in a client that already had the application.


But in a brand new deployment (i.e., when deploying on a client
machine that never had our application and our prerequisites, .NET
2.0
and Crystal engine), the assemblies are loaded and the resources (XML
files) are not loaded. Our ClickOnce deployment first verfiies if the
prerequisites (.NET 2.0 and Crystal engine) already exist on the
client machine and installs them first, if not, before installing the
application. We're seeing this missing resources problem only in this
initial deployment where it installs prerequisite first and installs
application. After this first deployment is complete, if the client
receives an update from the server, then it loads the resources from
the loaded assemblies properly and we're seeing the values that we
expect from the resource files just fine.


The hard part of this problem is that it's not reproducible on the
developer boxes because it always loads everything properly.


We're using "Assembly.GetManifestResourceNames()" method to load the
resources. Our suspicion is that this method retuns an empty list.
We're not getting any exception. So we know all the assemblies are
loaded properly. But we're not seeing those values that we expect
from
the resource files. That's the reason we suspect this method. The
Remarks on the Help page of this method says that "Resource
information is returned only if the resource is visible to the
caller,
or the caller has ReflectionPermission."


Please advice any solution to this problem. Any other ideas why the
resources are not loaded only at the first deployment? Is it related
to ReflectionPermission?


Your help is greatly appreciated.


Thank you,
Raj Muthusamy
 
Are you absolutely certain it is deploying the files? Have you checked the
deployment folder?

With XML files, make sure they are deployed as content, and not as Data --
check both the properties on the file in the solution explorer, and the
properties in ApplicationFiles to make sure it is not being deployed as
Data. If it is, it gets put in a different folder.

Hope that helps,
RobinS.
GoldMail, Inc.
 
Hi Robin,

Thanks for your reply.

Yes, I'm sure that it deploys all the files and all these XML files
are set as Embedded Resources in their properties.

The hotfix (917952) that we have as a pre-requisite requires a
restart. After the restart the it's loading the values from those
resources. So it's something related to that hotfix. This frustrates.

I thought Microsoft included all these hot fixes into the Service
Pack1. But they didn't include this hot fix. We cannot remove the hot
fix because it solves a proxy server problem. It's sad that Microsoft
didn't solve this proxy server problem associated with ClickOnce
deployment in the Service Pack 1.

This restart requirement of this hotfix defeats the purpose of
ClickOnce deployment.

-Raj
 
Are you using VS2005 or VS2008? Is there any possibility it has been fixed
in VS2008, like the Firefox problem?

The hot fix shouldn't be a problem. After it restarts, it should start back
up the ClickOnce deployment (I think). Does it do that, but just doesn't
work, or what? If it doesn't start back up, what happens when the user tries
running the deployment again?

RobinS.
GoldMail, Inc.
---------------------------------------
Hi Robin,

Thanks for your reply.

Yes, I'm sure that it deploys all the files and all these XML files
are set as Embedded Resources in their properties.

The hotfix (917952) that we have as a pre-requisite requires a
restart. After the restart the it's loading the values from those
resources. So it's something related to that hotfix. This frustrates.

I thought Microsoft included all these hot fixes into the Service
Pack1. But they didn't include this hot fix. We cannot remove the hot
fix because it solves a proxy server problem. It's sad that Microsoft
didn't solve this proxy server problem associated with ClickOnce
deployment in the Service Pack 1.

This restart requirement of this hotfix defeats the purpose of
ClickOnce deployment.

-Raj
 
Back
Top