Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / June 2006

Tip: Looking for answers? Try searching our database.

Delpoying outlook add-in

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
c_shah - 14 Jun 2006 16:01 GMT
http://msdn.microsoft.com/office/default.aspx?pull=/library/en-us/odc_vsto2005_t
a/html/OfficeVSTOWindowsInstallerWalkthrough.asp


In the artical above it mentions
Adding a Custom Action to Grant Trust to the Assembly

what is custom action and what is all about granting a trust to the
asembly?

can someone elaborate please.. thank you.
Thaddaeus Parker - 29 Jun 2006 00:54 GMT
What you need to do is add an installer class to your addin.  This install
class performs the functions creating the configuration required to all your
add-in dlls to be fully trusted on a deployment machine.  The CRM
Integration code block from Microsoft at:
http://www.microsoft.com/downloads/details.aspx?familyid=078124E9-1E88-4F51-8C98
-3C1999CFE743&displaylang=en


and  Eric Carter's VSTO book can give you valid ways to do what you are
asking.

In a nutshell, once you have your custom installer made, go into the setup
project that is created when you create new VSTO addin project and
double-click on the Custom Actions Editor button that is displayed on the
Solution Explorer view.  In the Install folder that is displayed go and a
new custom action right click and add the project output of the add-in dll
that you added your customer installer class to.  If you are like me, and
would like the answer now, here is the class that you need to add.
using System;

using System.Security;

using System.Security.Policy;

[System.ComponentModel.RunInstaller(true)]

public class Installer : System.Configuration.Install.Installer

{

public override void Install(System.Collections.IDictionary stateSaver)

{

base.Install(stateSaver);

try

{

ConfigureSecurityPolicy();

}

catch (Exception ex)

{

throw new System.Configuration.Install.InstallException("SomeException
occurred", ex);

}

}

public override void Uninstall(System.Collections.IDictionary savedState)

{

base.Uninstall(savedState);

try

{

DeleteSecurityPolicy();

}

catch (Exception ex)

{

throw new
System.Configuration.Install.InstallException(Resources.InstallerInstallExceptionText,
ex);

}

}

private void ConfigureSecurityPolicy()

{

// Find the machine policy level

PolicyLevel machinePolicyLevel = GetMachinePolicyLevel();

// Get the install directory of the current installer

string assemblyPath = Context.Parameters["assemblypath"];

string installDirectory =

assemblyPath.Substring(0, assemblyPath.LastIndexOf("\\"));

if (!installDirectory.EndsWith(@"\"))

installDirectory += @"\";

installDirectory += "*";

// Create the code group

CodeGroup codeGroup = new UnionCodeGroup(

new UrlMembershipCondition(installDirectory),

new PolicyStatement(new NamedPermissionSet("FullTrust")));

codeGroup.Description = Resources.CasPolicyDescription;

codeGroup.Name = Resources.CasPolicyName;

// Add the code group

machinePolicyLevel.RootCodeGroup.AddChild(codeGroup);

// Save changes

SecurityManager.SavePolicy();

}

private static void DeleteSecurityPolicy()

{

PolicyLevel machinePolicy = GetMachinePolicyLevel();

foreach (CodeGroup codeGroup in machinePolicy.RootCodeGroup.Children)

{

if (codeGroup.Name == Resources.CasPolicyName)

machinePolicy.RootCodeGroup.RemoveChild(codeGroup);

}

SecurityManager.SavePolicy();

}

private static PolicyLevel GetMachinePolicyLevel()

{

System.Collections.IEnumerator policyHierarchy =
SecurityManager.PolicyHierarchy();

while (policyHierarchy.MoveNext())

{

PolicyLevel level = (PolicyLevel)policyHierarchy.Current;

if (level.Type == PolicyLevelType.Machine)

return level;

}

throw new VerificationException("Exception occurred");

}

}

Hope this helps you out,

Thaddaeus.

> http://msdn.microsoft.com/office/default.aspx?pull=/library/en-us/odc_vsto2005_t
a/html/OfficeVSTOWindowsInstallerWalkthrough.asp

>
[quoted text clipped - 5 lines]
>
> can someone elaborate please.. thank you.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.