Cottleston Pie

Fernando Felman’s thoughts on software development

Archive for the ‘CAS’ Category

Setting Full Trust to Mapped Shared Folders

Posted by Fernando Felman on March 5, 2007

The project Iā€™m involved on at the moment uses a shared folder as the base mapping point. That is, we use the drive letter W to map to a shared folder that has the sources and the builds. One of the issues with this configuration is that, by default, shared folders are only partially trusted by the .Net and so when I added some MSTests they failed to initiate (MSTest , like many unit test frameworks, extensively uses Reflection which require Full Trust in order to run). The way this issue has been solved is by redirecting the builds to the C: drive (local drives are full trusted by default).

Another way to solve this issue would be by full trusting the assemblies from drive W. This can be done by adding a new code group to the Machine level of the Runtime Security Manager (the CAS util) with Full Trust permissions and a URL matching pattern with the URL notation of the local drive, e.g.: file://W:/*

Alternatively, you can use CAS Policy utility to do the same from the command line:
caspol -m -ag All_Code -url file://w:/* FullTrust -n Drive_W -d "Grants Full Access to the development W drive"

Explanation:
-m: modifies the machine level
-ag: adds a new code group
All_Code: the name of the parent code group (you can also use the label ‘1’ instead of the name)
-url file://w:/* : the new code group will affect any assembly matching the URL file://w:/* which means “any assembly running from the W drive”
FullTrust: All matching assemblies will have full trust settings
-n Drive_W: the name of the new code group will be Drive_W
-d ā€œā€¦ā€: the description of the new code group

When scripting, use the -q (for quite) in order to suppress the verification messages.

Advertisements

Posted in CAS | 1 Comment »