CASPOL is pretty much set and forget.  The setting is saved on the local
machine.  Of course, you don't really want to forget about it because you'll
have the same problem another day if you move to a different server.

The -ag 1.2 argument is used to create a new group policy as a child of the
Intranet code group (1.2).  A child code group extends and overrides the
policy to apply for a narrower set of the assemblies governed by its parent.
In essence, the command is instructing the system to create an exemption for
the normal policy of group 1.2 such that the Gallio assemblies will receive
full trust.

You can see the existing groups by running caspol -lg.

Here's what I see on my machine:

1.  All code: Nothing
   1.1.  Zone - MyComputer: FullTrust
      1.1.1.  StrongName -
00240000048000009400000006020000002400005253413100040
0000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB
23BE
79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE
4E82
1C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D2
61C8
A12436518206DC093344D5AD293: FullTrust
      1.1.2.  StrongName - 00000000000000000400000000000000: FullTrust
   1.2.  Zone - Intranet: LocalIntranet
      1.2.1.  All code: Same site Web
      1.2.2.  All code: Same directory FileIO - 'Read, PathDiscovery'
   1.3.  Zone - Internet: Internet
      1.3.1.  All code: Same site Web
   1.4.  Zone - Untrusted: Nothing
   1.5.  Zone - Trusted: Internet
      1.5.1.  All code: Same site Web

When you are done modifying the policy, you should see a new group 1.2.3
created to exempt Gallio from the ordinary caspol rules for assemblies in
the Intranet zone.

Jeff.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Rob Langley
Sent: Tuesday, June 02, 2009 10:37 PM
To: MbUnit.User
Subject: MbUnit Re: Trying to join up the dots


Thank you both for your comments.

I have tried mapped drives and as Rob suggested it does not work :-(

I have also had a play with CASPOL and am trying to get this to work, I have
2 questions around this.

1. Do I need to set this up every time I run my tests or is it a one shot
deal on the server ie it permanently defines the permission on the server in
similar way to setting other security settings.
2. What is the -ag 1.2 I'm not sure I understand why 1.2 is used?

Another alternative I may try if I can't get this working is to make my post
compile script copy the assemblies to the local server.  But I would rather
crack the challenge of remote assemblies if possible :-)

Thanks for your comments so far


Rob

On Jun 2, 5:26 pm, Rob Prouse <[email protected]> wrote:
> I am pretty sure that mapping to a network drive will not work. I use 
> CASPOL for this. The following is an old BAT file I used to use which 
> should give you what you need with minor changes.
>
> @ECHO OFF
> SET CASPOL=%windir%\Microsoft.NET\Framework\v2.0.50727\CasPol.exe
>
> REM
> ======================================================================
> ===== ============ REM - Add full trust to the destination directory 
> REM 
> ======================================================================
> ===== ============ %CASPOL% -pp off %CASPOL% -m -ag 1.2 -url 
> file://nas1/teamcity/test/trunk/thirdparty/tools/Gallio/*
> FullTrust
>
> On Jun 2, 1:48 am, Jeff Brown <[email protected]> wrote:
>
> > The problem is that .net does not trust assemblies on shared folders 
> > out of the box. So loading an assembly from a unc path like \\nas\...
> > will cause problems for many apps.
>
> > Two things to try:
>
> > 1. Map the network share to a drive.  (Try to make the codebase look 
> > local so the local machine zone policy is used instead of the 
> > Internet / Intranet zone policy.)
>
> > 2. Investigate the use of the caspol tool.
>
> > In all honesty I do not remember the details of the code access 
> > security policy governing files loaded across machine boundaries.  I 
> > do recall that the MSDN has articles on it.
>
> > Jeff
>
> > On Jun 1, 2009, at 10:33 PM, Rob Langley <[email protected]> wrote:
>
> > > Hi
>
> > > Got back to day to try and finish this installation.  I have been 
> > > trying to resolve a new error which gets reported in Teamcity.  
> > > Its strange as I did not see this error last time when I built on 
> > > VM's and I'am not sure if I have missed something?  If I have I 
> > > can't work out what I have missed this time.
>
> > > [06:25:39]: [Project "msbuildCfg.xml.teamcity.patch.tcprojx" 
> > > (RunTests target(s)):] 
> > > \\nas1\teamcity\test\trunk\msbuildCfg.xml(15, 5): error
> > > MSB4061: The "Gallio" task could not be instantiated from the 
> > > assembly "\\nas1\teamcity\test\trunk\thirdparty\tools\Gallio
> > > \Gallio.MSBuildTasks.dll".
> > > System.Security.SecurityException: That assembly does not allow 
> > > partially trusted callers.
> > >   at 
> > > System.Security.CodeAccessSecurityEngine.ThrowSecurityException
> > > (Assembly asm, PermissionSet granted, PermissionSet refused, 
> > > RuntimeMethodHandle rmh, SecurityAction action, Object demand, 
> > > IPermission permThatFailed)
> > >   at Gallio.MSBuildTasks.Gallio..ctor()
> > > The action that failed was:
> > > LinkDemand
> > > The assembly or AppDomain that failed was:
> > > Gallio.MSBuildTasks, Version=3.0.6.0, Culture=neutral, 
> > > PublicKeyToken=eb9cfa67ee6ab36e The Zone of the assembly that 
> > > failed was:
> > > Internet
> > > The Url of the assembly that failed was:
> > > file://nas1/teamcity/test/trunk/thirdparty/tools/Gallio/
> > > Gallio.MSBuildTasks.dll
>
> > > The only difference is that the installation is now on physical 
> > > machines as opposed to Virtual Machines and the code is checked 
> > > out to a separate NAS.  I also tried adding URL for the client of 
> > > the machine as a 'Trusted Site' via IE.
>
> > > Any ideas
>
> > > Thanks in Advance
>
> > > Rob
>
> > > On May 26, 7:07 am, Rob Langley <[email protected]> wrote:
> > >> Jeff
>
> > >> I think my issues with setup are due to not being a 'real'
> > >> developer :-).  my back ground is infrastructure so I often need 
> > >> very clear instructions when it comes to compiling code, 
> > >> references etc etc
>
> > >> I initially made the assumption I did NOT need Gallio, my 
> > >> thinking was TeamCity would talk to MbUnit directly and Gallio 
> > >> was just the UI for MBunit if I were to run tests manually
>
> > >> My next assumption was that I only need the dll's and I guess 
> > >> this was because I did not understand the significance of the 
> > >> .plugins.
>
> > >> I had searched the web sites at teamcity, Gallio, MBUnit & 
> > >> Selnium but could not find anything to help me understand what I 
> > >> was missing, I was not even sure in which product the issue was.
>
> > >> The MbUnit document link gave me an error docs.mbunit.com and was 
> > >> a little frustrating.  I hope to write an article on my blog on 
> > >> how I got all the components working.  Once I have done this I 
> > >> will drop you a line and your welcome to either link to it or 
> > >> copy & paste it to your site with a small acknowledgement :-)
>
> > >> Perhaps I'll even do a short screen capture demonstrating the 
> > >> setup
>
> > >> Thanks
>
> > >> Rob
>
> > >> Having said
>
> > >> On May 25, 8:54 pm, "Jeff Brown" <[email protected]> wrote:
>
> > >>> If you have any suggestion as to how the packaging process can 
> > >>> be improved, please let me know.
>
> > >>> This is a fairly common mistake for people new to Gallio.
>
> > >>> Jeff.
>
> > >>> -----Original Message-----
> > >>> From: [email protected] 
> > >>> [mailto:[email protected]
> > >>> ] On
>
> > >>> Behalf Of Rob Langley
> > >>> Sent: Monday, May 25, 2009 1:52 PM
> > >>> To: MbUnit.User
> > >>> Subject: MbUnit Re: Trying to join up the dots
>
> > >>> Thanks....
>
> > >>> It now working...
>
> > >>> I had not copied any of the .plugin files.  I had only copied 
> > >>> the dlls.
>
> > >>> Rob
>
> > >>> On May 24, 7:15 pm, Jeff Brown <[email protected]> wrote:
> > >>>> The likely problem is that you have not copied all of the 
> > >>>> required Gallio plugins files to the build server in the 
> > >>>> selenium references folder.
>
> > >>>> Jeff
>
> > >>>> On May 24, 2009, at 10:45 AM, Rob Langley 
> > >>>> <[email protected]>
> > >>>> wrote:
>
> > >>>>> Hi
>
> > >>>>> I love the idea of automated testing but an new to it all.  
> > >>>>> Over the last few weeks I have had a play with Selenium and 
> > >>>>> Teamcity in isolation.  Teamcity now builds and deploys my 
> > >>>>> code to a test server and I have written a few simple tests in 
> > >>>>> selenium that work when I compile my code in Visual Studio.  
> > >>>>> I'm now trying to but it together with MbUnit and am getting 
> > >>>>> an error now.
>
> > >>>>> "C:\build\msbuildCfg.xml.teamcity.patch.tcprojx" (RunTests
> > >>>>> target) (1)
> > >>>>> ->
> > >>>>> (RunTests target) ->
> > >>>>>  C:\build\msbuildCfg.xml(12,5): error : An unexpected error 
> > >>>>> occurred during execution of the Gallio task.
> > >>>>>  C:\build\msbuildCfg.xml(12,5): error : RuntimeException: 
> > >>>>> Could not resolve service of type 
> > >>>>> Gallio.Runner.Reports.IReportManager.
>
> > >>>>> Below is my msbuildCfg.xml file which teamcity calls, which I 
> > >>>>> have copied from various postings on the net
>
> > >>>>> <Project 
> > >>>>> xmlns="http://schemas.microsoft.com/developer/msbuild/2003
> > >>>>> ">
> > >>>>>  <!-- This is needed by MSBuild to locate the Gallio task -->
> > >>>>>  <UsingTask AssemblyFile="selenium\referances 
> > >>>>> \Gallio.MSBuildTasks.dll" TaskName="Gallio" />
>
> > >>>>>  <!-- Specify the tests assemblies -->
> > >>>>>  <ItemGroup>
> > >>>>>    <TestAssemblies Include="selenium\bin\Debug\selenium.dll" 
> > >>>>> />
> > >>>>>  </ItemGroup>
>
> > >>>>>  <Target Name="RunTests">
> > >>>>>    <Gallio IgnoreFailures="false" Assemblies="@(TestAssemblies)"
> > >>>>> RunnerExtensions="TeamCityExtension,Gallio.TeamCityIntegration
> > >>>>> ">
> > >>>>>      <!-- This tells MSBuild to store the output value of the 
> > >>>>> task's ExitCode property into the project's ExitCode property 
> > >>>>> -->
> > >>>>>      <Output TaskParameter="ExitCode" 
> > >>>>> PropertyName="ExitCode"/>
> > >>>>>    </Gallio>
>
> > >>>>>    <Error Text="Tests execution failed" Condition="'$ 
> > >>>>> (ExitCode)' != 0" /
>
> > >>>>>  </Target>
>
> > >>>>>    <Target Name="Build">
> > >>>>>    <Message Text="Starting to Build"/>
> > >>>>>    <MSBuild Projects="Selenium.sln" Targets="Rebuild"
> > >>>>> Properties="Configuration=Debug" />
> > >>>>>  </Target>
> > >>>>> </Project>
>
> > >>>>> Any help would be appriciated
>
> > >>>>> Thanks
>
> > >>>>> Rob


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to