Take the 2-minute tour ×

When I update a solution in 2010, I use the following PowerShell Script with the -CASPolicies attribute:

Update-SPSolution -Identity MySolution.wsp -LiteralPath "E:\Install\MySolution\1.3.25\MySolution.wsp" -GACDeployment -CASPolicies

When I check my solution status in Central Admin, it gives no clue if the -CASPolicies did anything even after deployment. Before and after looks exactly the same following this URL http://CentralAdminUrl.com/_admin/SolutionStatus.aspx?ItemName=mysolution%2Ewsp&Lcid=0

Contains Global Assembly: Yes
Contains Code Access Security Policy: No

Specifically I find the -CASPolicies attribute hard to understand what it's for and under what circumstances? Technet has the following to say on -CASPolicies:

Specifies that Code Access Security (CAS) policies can be deployed for the new SharePoint solution.

Not very enlightening, so I'd like to know when I should use it and when not to.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You need CAS policies when you are not allowed to deploy to the GAC and use other system assemblies.

Imagine you have a webpart that reads a log file from disk - you need System.IO from this and thats not allowed in wss_medium (your SharePoint trust level) - in order to say this webpart is allowed to load System.IO you need a CAS policy. If you deploy a wsp with CAS you need the -CASPolicies switch (deprecated in SP2013, btw) - if you do not use them you do not need the switch.

share|improve this answer
Great! This makes perfect sense. Thank you! –  Benny Skogberg Jun 13 '13 at 10:50
add comment

Your Answer


