Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > SecurityException using Assembly.Load
 

SecurityException using Assembly.Load

I am trying to get ClickOnce working with a small solution.  As part of the solution I want to dynamically load up an assembly using a factory.  I want full trust for my app, so I deploy it using the CD/DVD method and set the option to debug using the selected permissions.  I use Assembly.Load and start the app in VS2005.  It works and I can call a method in the loaded assembly if it returns null, but if it actual does something like use a string, I get the above exception with the message:

"The assembly does not allow partially trusted callers"

This makes sense so far as the System.dll assembly does not allow partially trusted callers, but why is my dynamically loaded assembly only partially trusted?
MigrationUser 1  Thursday, November 25, 2004 6:38 PM
I found what was wrong:  

In the properties -> Security page for the project, I had chosen 

Zone you application will be installed from:
LocalComputer (Full Trust)

and then pressed the Calculate button.  This has the effect of changing some permissions to Include instead of ZoneDefault.  This in turns seems to have the effect of making the app domain partially trusted.  I just put those permissions back to ZoneDefault and all is fine.  

Is that a bug with the Calculate function?
MigrationUser 1  Friday, November 26, 2004 5:19 PM
Thanks this helped big big.
MigrationUser 1  Thursday, April 28, 2005 2:44 PM

You can use google to search for other answers

Custom Search

More Threads

• Setting up Windows application .Net 2003 Framework 1.1 into Vista
• configuration for whidbey devMachine and devServer
• Custom action failed to find the executable that is in system %path%
• Error: Access denied
• AppUpdater Not Working
• Click-once application doesn't start
• Custom ApplicationContext and ClickOnce deployment
• Click Once Delay between standard progress dialog and application startup
• Trouble obfuscating assemblies with Dotfuscator
• Publish a VB 2005 Program