Using nugetter with a hosted build controller.

Jan 17, 2013 at 10: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, 2013 at 3: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, 2013 at 5: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, 2013 at 6: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, 2013 at 7: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, 2013 at 7: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, 2013 at 7: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, 2013 at 7: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, 2013 at 7:29 PM
Is there a solution for this? I am running into it now as well...
Mar 19, 2013 at 8: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, 2013 at 4: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, 2013 at 6: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, 2013 at 3: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, 2013 at 8:07 PM
Edited Apr 12, 2013 at 8: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, 2013 at 3:21 PM
Edited May 12, 2013 at 5: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, 2013 at 5:39 AM
Edited May 28, 2013 at 1: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.
Jul 26, 2013 at 3:34 AM
What's the status of official support for Team Foundation Service? Our team is currently evaluating between TF(Service) and TF(Server). TF(Service) will be a big win for us, especially if we can use NuGetter.
Jul 26, 2013 at 8:28 AM
CraigSmitham wrote:
What's the status of official support for Team Foundation Service? Our team is currently evaluating between TF(Service) and TF(Server). TF(Service) will be a big win for us, especially if we can use NuGetter.
I'm using TFService for a couple of project that are in production and I simply love it, with also azure my dev team now works server-less.

The status of TFService as source control and ALM is really stable and did worked just fine without any particular interruption, the build server instead sometimes it blocks but actually it is in preview mode, in any case the support and the dev team are extremely fast, and they are working really well!!!

M.
Jul 26, 2013 at 3:53 PM
0v3rCl0ck wrote:
I'm using TFService for a couple of project that are in production and I simply love it, with also azure my dev team now works server-less.

The status of TFService as source control and ALM is really stable and did worked just fine without any particular interruption, the build server instead sometimes it blocks but actually it is in preview mode, in any case the support and the dev team are extremely fast, and they are working really well!!!

M.
Can you verify you are successfully using NuGetter with TFService? Any gotchas or pointers?
Jul 26, 2013 at 4:18 PM
CraigSmitham wrote:
Can you verify you are successfully using NuGetter with TFService? Any gotchas or pointers?
I've got NuGetter up and running on TFService, with the little change suggested by MrHinsh above.
Jul 26, 2013 at 4:59 PM
Edited Jul 28, 2013 at 6:29 PM
Mark,


Can you give me permission to your project so that I can make the fix described above. There is currently no way that the current codebase can work against TF Service as you are creating the packages in the drop folder. Drop folders are either in source control or with 2013 are zip files in the Container system.

Http://<server>/<collection>/_apis/resources/containers.

-MrHinsh
Coordinator
Jul 28, 2013 at 6:14 PM
I have added the capability to run in either environment (on prem or TFS as a Service). It packages differently for the two environments based on the suggestion above from MrHinsh (thanks BTW). There is additional code changes to the build templates and the custom activity to adapt to the environment based on a Boolean flag in the build definition. This is required because (based on the existing code design) you can't package at the same point in the process for both environments or it would change the output location for existing on-prem builds and I don't want to introduce a breaking change.

I've identified the 2.2 release as beta but will upgrade to full release based on feedback and some additional testing.

Mark
Jul 28, 2013 at 6:31 PM
Mark,

Thanks so much for fixing this :)

Note that this process is the same for TFS 2013 on premise as build drops are now stored inside TFS and you have no edit / write access to that location. If you implemented the "TFS Server Store" bit lip as I detailed above then it will work in both cases :)

-MrHinsh
Coordinator
Jul 29, 2013 at 3:12 AM
Glad I found some time to try to get this working. Hopefully it solves the issue.

Marknic
Sep 5, 2013 at 12:42 AM
Using 2.2 I still get the same error:

Exception Message: Access to the path '#/128/drop\NuGetPackage' is denied. (type UnauthorizedAccessException)

Under build defaults I have "Copy build output to the server" and under Process I have the new "Building in hosted TFS Services" set to true.

Any Ideas?
Sep 25, 2013 at 1:22 AM
Does 2.2 really work for other people, I removed all the dlls and tried again, still getting an error:

Image
Sep 30, 2013 at 7:29 PM
I have the same problem.
Sep 30, 2013 at 9:05 PM
fneveux wrote:
I have the same problem.
@MrHinsh what are you doing in those screenshots to get it to work?
Oct 3, 2013 at 11:10 PM
I just hit the same issue as well.

Exception Message: Access to the path '#/1977/drop\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)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)