Nant failing with bad permissions on build server

Total newbie question. I am trying to run a Nant script on a build server (very basic script, not doing anything), and it's failing with the error

System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

What should I do to get it running?

@TK has the answer here, I believe, though it may not be as simple as whether or not nant is running from a network drive.

I have had a similar issue as @Aidan. It turns out that I had copied the nantcontrib (v .86) assemblies to my build system in such a way that Windows 7 restricted access to the nantcontrib assemblies. To fix this, I first copied the nantcontrib zip file to my build VM, then overwrote the blocked assemblies with the contents of the .zip. Windows 7 saw that the files were coming from the local system (rather than from whatever untrusted source I had copied from originally) and it unblocked the assemblies.

There is probably a more direct means of trusting the assemblies (such as @TK's link), but this worked for me.

If you see this error again, look for two things:

First, Nant (v .91 alpha 2) does a decent job reporting exactly what the error is. I saw the same error as @Adian, along with a complete error stack, and finally this information (emphasis mine):

The assembly or AppDomain that failed was: NAnt.Contrib.Tasks, Version=0.86.3319.0, Culture=neutral, PublicKeyToken=null The method that caused the failure was: NAnt.Core.Task CreateChildTask(System.Xml.XmlNode) The Zone of the assembly that failed was: Internet The Url of the assembly that failed was: file:///C:/Program Files (x86)/NAntBuilder 2/nantcontrib/bin/NAnt.Contrib.Tasks.dll

Second, look at the property page of the offending assembly (in my case, Nant.Contrib.Tasks.dll). If the file has been copied from an untrusted source, you will see an "Unblock" button in the properties section (beneath Advanced...) along with a note which stated that the files had come from an untrusted source.

Nant failing with bad permissions on build server, Nant failing with bad permissions on build server - build-process. To fix this, I first copied the nantcontrib zip file to my build VM, then overwrote the blocked  A message giving further information on why the build exited. False: failonerror: bool: Determines if task failure stops the build, or is just reported. The default is true. False: if: bool: If true then the task will be executed; otherwise, skipped. The default is true. False: unless: bool: Opposite of if. If false then the task will be executed; otherwise, skipped.

My error message mentioned the "Internet Zone". This is probably because I downloaded zipped binaries from SourceForge. I zipped and then unzipped to strip the zone and that worked great for me.

On Windows 7 (or similar):

  1. Select all files in the NAnt folder
  2. Right click, Send to > Compressed (zipped) folder
  3. Right click on new zip file and choose "Extract All..."
  4. Extract to a new folder

The extracted files will no longer be from the "Internet Zone". You can copy back into the original directory if you wish.

NAnt, The NAnt binaries and all of my source code are copied from a source server. The NAnt script dies at that point, and my build fails. I see nothing wrong with the access permissions to the Temp directory, it's subdirectories, or the ResGen.exe​  The NAnt script dies at that point, and my build fails. I see nothing wrong with the access permissions to the Temp directory, it's subdirectories, or the ResGen.exe file itself. My user ID has Full Control credentials (Windows XP, service pack 2). Looking at the DeleteTask.cs source code, I see that there is no exception trapping.

This problem is caused by Windows setting the files' "Zone.Identifier" metadata in NTFS to "Internet" (or to another zone which you have to explicitly unblock to gain access).

To not cause file security metadata to be written when you copy files or, in my case, unzip from a zip file on a network drive, either copy the zip file to a local folder before unzipping it, as previously suggested, or run the "streams.exe" tool from Sysinternals to remove that metadata.

For example, if I run streams.exe on exe's in my Downloads folder:

streams.exe *.exe

Streams v1.56 - Enumerate alternate NTFS data streams
Copyright (C) 1999-2007 Mark Russinovich
Sysinternals - www.sysinternals.com

C:\Downloads\jre-6u27-windows-x64.exe:
   :Zone.Identifier:$DATA       26

Normally, streams.exe wouldn't display any metadata information if the files all originated from a local folder. If you do see these ":Zone.Identifier:$DATA" metadata (stored in NTFS as an alternate data stream), then you should also see an Unblock button in the files' Properties dialog.

To unblock the files in bulk, run "streams.exe -s -d *.*" from your problematic folder.

NAnt - A .NET Build Tool / [nant-dev] [ nant-Bugs , [nant-dev] [ nant-Bugs-2506115 ] copy task creates directory without Once the server image was restored, the build script again worked without Especially check for "CREATOR OWNER" permissions. hth, Erich Loses/The Bad: 1) They use the Output feature everywhere, at the detriment to Some styles failed to load. An automated continuous integration server for the .NET platform Calling NAnt, which is failing to find the vss ini RE: [Ccnet-user] Calling NAnt, which is

When you download NAnt, you have to right click on the zip file (before extracting evertything), then properties, and click on unblock file. Then extract everything and it will work.

Permissions error on Windows 7 Home · Issue #16 · nant/nant · GitHub, Downloaded nant 0.91 binary, installed per the instructions (copied to C:\​Program Files\Nant). The type of the first permission that failed was: Basically all works fine until we add our .NET (C#) solution to source control. Once we do that and check out a copy for edit the build starts failing. A version of the solution with source control bindings removed works fine (no other difference between the 2 solutions - just one has VSS bindings and one does not.

Are you running the Nant script on a network share drive?

If so then you might need to configure the .NET Caspol policy to allow .NET code to be executed on a network share.

Using CasPol to Fully Trust a Share

This link might be able to help you.

How do I elevate privileges when running appcmd from a nant task , We are using a Windows 7 box as build server. As part of our continuous integration process I would like to stop and start an IIS 7 website. I have tried doing this  Runs NAnt and builds the project in non-debug mode. Even though the build file sets the debug property to true, the value that is set on the command line will not be touched, as the "overwrite" attribute on the <property> task is set to "false".

Nant, I've used this build script in a continuous integration system that doesn't actually publish any code. <property name=”nant.onfailure” value=”fail.test”/> Since those bad old days, Release Management has come a long way. Changing File Permissions On Files in Perforce · Continuous Delivery using build pipelines​  CruiseControl.NET is installed in WIN2003 server which has Visual Studio 2005 installed. Also, .NET Framework 3.5 is installed on it (not VS 2008). I have created NAnt script which is used by CruiseControl.NET but while executing the same it shows build as failed. When I ran NAnt script from command prompt,

TFS Build Server Stops working, We got an issue for TFS build server today, it doesn't build anything. Failed to update build vstfs:///Build/Build/[BuildNumber] on server https://[tfs Collection] Finally, the wrong credential was found in Credential manager, There is a record​  In my opinion, this can lead to assumptions about the build environment. It is more descriptive, and easier to catch mistakes when build on different machines, if the <loadtasks/> (for non-core task) is put in the build file. You can define the path relative to the build dir, or to the nant assemblies.

Bug listing with status RESOLVED with resolution NEEDINFO as at , Bug:8708 - "The server freeze after uncompressing the kernel / xeon 2.2ghz i7500 Bug:21488 - "xemacs-21.4.12 fails to build with freewnn useflag and gcc 3.2.3" has wrong permissions" status:RESOLVED resolution:NEEDINFO severity:normal "dev-dotnet/nant-0.85 fails to build on ~amd64" status:​RESOLVED  We have a central build server running the latest and greatest version of nant and it is failing to compile one of our projects. I have created a scaled down test

Comments
  • provide a bit more details: what build server are u using?, what is your Nant script doing? possibly paste sample code.
  • It seems that this question solves the same issue: stackoverflow.com/questions/8605122/… Hope that helps!
  • This was my exact problem! Thank you!
  • I did this in the NAnt directory to no avail, then did it in the NH source directory and things started building.