.NET 3.5 SP1 Code from Network - "The system cannot find the file specified."
This issue has nothing to do with whether the assemblies have been signed or caspol has been run for the shared network folder. Apparently, the location of the files is the issue, but I cannot find what 开发者_运维问答the real problem is.
I have one executable that references 5 dll's. I can run the app from a local drive without any problem. When I run the app from a network share, I get an error stating that "Could not load file or assembly 'homer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
If all the files are in the same folder, what is the error really telling me?
I should note also that the framework used is 3.5 SP1, which does not require changing code access policy. I had tried that anyhow, and I received the same error in both cases.
Thanks, DaMoose
Here you go: http://support.microsoft.com/kb/892465
You basically need to sign your assemblies. Generate a the private/public keys pair with
sn -k filename.snk
The filename.snk will be specified in the project prperties (right-click the project then select properties).
If you don't obfuscate your code, you can go with this. If you do, you need to "delay sign" the asemblies, i.e. reserve space for the key inside the newly built executable file. Then you need to call
sn -r filename.snk
to resign the executable after obfuscation.
How did the assemblies go to that network share? Did you simply copy them or something else? Once I had a problem when I downloaded my own assemblies from my own webserver, and explorer added the "blocked" flag (ntfs stream feature) to the downloaded files, basically generating FileNotFound Exceptions.
精彩评论