Raj De Inno Raj De Inno - 10 months ago 94
C# Question

how to set assembly security to full trusted in c#?

I have WPF web form. When I attempt to make an Instance for SpeechSynthesizer, it is tossing an error. Saying that,

Assembly 'WpfBrowserApplication, Version=, Culture=neutral, PublicKeyToken=null' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself. In order to access security critical code, this assembly must be fully trusted.

Indeed, even I am utilising the right namespace. i.e., using System.Speech.Synthesis. In any case, I don't know why it is throwing error.

Can anybody let me know what I am missing?

This is my code.

public Page2()
SpeechSynthesizer ss = new SpeechSynthesizer();

Answer Source

You need to sign your assembly. Take a look at the following article: How to: Sign an Assembly (Visual Studio).


Assembly signing (also called strong-name signing) gives an application or component a unique identity that other software can use to identify and refer explicitly to it. A strong name consists of its simple text name, version number, culture information (if provided), plus a public/private key pair. This information is stored in a key file; this can be a Personal Information Exchange (PFX) file or a certificate from the current user's Windows certificate store. For more information, see Strong-Name Signing for Managed Applications.