Using nugetter with a hosted build controller.

Jan 17 at 9:39 PM

Building a cloud service, and using a MSFT hosted build controller. And would like to use nugetter build templates to build and publish NuGet package.

Is this possible?

Followed the default Simple project example in the nugetter documentation.

Right now my drop location which is in our TFS is giving a UnauthorizedAccessException.

Exception Message: Access to the path **** is denied. (type UnauthorizedAccessException)

Coordinator
Jan 23 at 2:21 PM

Triscuit,

So the NuGetter assembly installed where the controller can find it?  If so, at what point is the access denial happening?  In other words, is there other information in the build log to indicate at what point the error happens?

Mark

Jan 23 at 4:36 PM

Hey Mark,

Thanks for your response.

1. I'm using the NuGetterStandardBuildTemplate.11.xaml and that points to a location in our TFS with the NuGet.Exe (it gave an error of not finding the .exe before and that has been fixed, so I'm pretty sure it knows where the .exe is).

2. The build only gave a stack trace and no log file (I have the regular build log file but there are no errors associated with that).

*** replaces drop folder used by the build template.  

Exception Message: Access to the path '$/***/***/***/***\NuGetPackage' is denied. (type UnauthorizedAccessException)Exception Stack Trace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)   at TfsBuild.NuGetter.Activities.CreateFolder.Execute(CodeActivityContext context) in c:\Users\svc-tauintbuilder\Downloads\Source\TfsBuild.NuGetter.Activities\CreateFolder.cs:line 53   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

 

One weird thing I notice is the path uses a '\' right before the Output directory compared to using '/' elsewhere in the path.

Another thing to note is that the NuGet.exe being used is a custom built solution to support VS2012 and not the public Nugetter package.

Coordinator
Jan 23 at 5:06 PM

Is the NuGetPackage location being defined as a full path to source control? $/***/***/***/***\NuGetPackage

The $/ indicates that it is looking to source control and not a disk location. The NuGetPackage folder should use a relative path within the drop location (on disk) and it needs to write to this location which would definitely cause a problem if it is pointing toward source control.

Not sure what you mean by the NuGet.exe being custom built. Do you mean the build template? That would need to be version specific. NuGet.exe is the console application that does the actual packaging.

Mark

From: Triscuit [email removed]
Sent: Wednesday, January 23, 2013 11:36 AM
To: Mark Nichols
Subject: Re: Using nugetter with a hosted build controller. [NuGetter:429967]

From: Triscuit

Hey Mark,

Thanks for your response.

1. I'm using the NuGetterStandardBuildTemplate.11.xaml and that points to a location in our TFS with the NuGet.Exe (it gave an error of not finding the .exe before and that has been fixed, so I'm pretty sure it knows where the .exe is).

2. The build only gave a stack trace and no log file (I have the regular build log file but there are no errors associated with that).

*** replaces drop folder used by the build template.

Exception Message: Access to the path '$/***/***/***/***\NuGetPackage' is denied. (type UnauthorizedAccessException)Exception Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) at TfsBuild.NuGetter.Activities.CreateFolder.Execute(CodeActivityContext context) in c:\Users\svc-tauintbuilder\Downloads\Source\TfsBuild.NuGetter.Activities\CreateFolder.cs:line 53 at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

One weird thing I notice is the path uses a '\' right before the Output directory compared to using '/' elsewhere in the path.

Another thing to note is that the NuGet.exe being used is a custom built solution to support VS2012 and not the public Nugetter package.

Jan 24 at 6:01 PM

In the output directory field, I left that as default (NuGetPackage), so there's no source control stuff there.

On the "build defaults" page the staging location points to a source control location, with the "Copy build output to the following Source Control folder."

So that's where I believe that's where the source control path is getting in from.

You're saying that this will need to build at a UNC path instead of a source control location?  This would be difficult on a hosted built controller.

Coordinator
Jan 24 at 6:22 PM

Ok, I understand now.

That is a problem since the packaging process happens after the build and is expecting that it is working on a disk.  It's not that a UNC path is needed specifically - just a disk to continue working on the build output. It currently works where the drop location is specified.  Even on a hosted platform the build can't be working solely on files in source control.  It must be working on disk and then copying the files to source control.  The trick is figuring out where during the build.  Now that I get what is happening I can attempt to reproduce the problem although I can't give exact specifics on if/when I will be able to add the capability of working in a hosted environment.

Mark

Jan 24 at 6:27 PM

Hey this is awesome.

Thanks so much for your help.

The other solution I looked into was getting a build controller spec'ed out with all the necessary NuGet and Azure stuff.

But it so much easier using a hosted build controller :).

Coordinator
Jan 24 at 6:46 PM

This is going to be harder than I thought.  In VS2012 you can't see the "Copy build output to the following Source Control folder:" option.  In VS2010 you can see it however you can't use it.  Apparently, it is really only an option in a hosted environment so I won't be able to reproduce the situation in a controlled environment. Uggh.

Mar 19 at 6:29 PM
Is there a solution for this? I am running into it now as well...
Mar 19 at 7:56 PM
The drop folder is only in source control. You would need to do the packaging pre-drop on the build server...
Apr 1 at 3:38 AM
marknic wrote:
This is going to be harder than I thought.  In VS2012 you can't see the "Copy build output to the following Source Control folder:" option.  In VS2010 you can see it however you can't use it.  Apparently, it is really only an option in a hosted environment so I won't be able to reproduce the situation in a controlled environment. Uggh.
Do you have an update?
Apr 4 at 5:07 PM
If you have a local build server plugged into the cloud TFS then you can debug... however all that needs to happen is that the packaging happens against "c:\b\binaries\" rather than the Drop Location.... simples...

Would it be possible to give me access to your repository and I can fix it :) saves me from downloading the source seperatly...
Coordinator
Apr 5 at 2:15 PM

That information definitely helps. I haven’t had time recently to look at the code or reply because of several large projects consuming all of my time. I tried to grant someone else access to the code on CodePlex once and it turned into more than it was worth at the time. Microsoft legal thing I guess.

I am going to try to create a GitHub repo today and get the code pushed there.

I will let you know.

Thanks,

Mark

Apr 12 at 7:07 PM
Edited Apr 12 at 7:25 PM
I have downloaded your source code an made a simple change to fix this:

Change the Base Path in "PerformNuGetPack" to be "BuildDirectory" by updating the "NuGetterVDropLocation" value. I can then do all of my building between the Sources and Binaries location.

Image

I can then change the location of the "NuGetterProcess" activity to be on the Agent before the drop folder is actioned. This gives me access to both Sources and Binaries locations and then anything I drop to Binaries end up in my Drop folder...

Image
May 12 at 2:21 PM
Edited May 12 at 4:43 PM
I have the same problem explained in this post, could marknic please checkin the fix to the codeplex source control?

Thanks!

Edit: finally I get the automatic build working fine, needed also to provide the source control path to the NuGet.exe because on the team foundation service is not added in the path... hope that marknic could make a new release with this workaround, maybe letting choose also the NuGetterVDropLocation from the build process parameters. again...Thanks!
May 27 at 4:39 AM
Edited May 28 at 12:21 AM
I am having an issue with a hosted build controller as well. I was able to make the edit MrHinsh noted above, and it creates a package and pushes it to our nuget gallery, however the package created is not in the correct nuget format with the dll under the lib folder, in fact it creates a package that includes Binaries, Sources, NuGetExe directory, everything. I have tried everything I can think of to get it working, adding a files section to the nuspec to copy assembly to lib, changing the Base Path on the build definition, etc but nothing I have tried seems to make a difference. Any pointers are greatly appreciated.,

Ok, not sure what I was doing wrong. I started all over and got it working correctly now.