Today I was putting together a custom build of the Nuget 2.0 Visual Studio Extension (VSIX). My client has an extranet where they publish their Nuget feed(s) and it’s behind an authenticated proxy server. It used to be that the extension would use the VS credentials, but there’s a bug in 2.0.
It’s been fixed in changeset 14dd5c2aa14b.
Pulling the Code
Head over to Codeplex and get your environment setup. Basically means pulling the source and installing the VS 2010 SDK.
Before we just build the tip of nuget, I want to limit my exposure. I’m going to head back in time to the 2.0 build and then apply the changeset that fixes my problem. 2.0-public is the git tag for the 2.0 release (it would seem). So I’m going to check that tag out to a branch called authfix.
git checkout 2.0-public –b authfix
Now I have 2.0 on which I can cherry pick the changeset with our fix (14dd5c2aa14b). Looking at gitk or git log will show me I have 2.0-public with the authfix applied. I don’t have all the other features that have yet to ship since 2.0, which I don’t want, because I’m not confident in them yet and don’t want that risk yet.
The Nuget contribution documentation suggests building with build.cmd. As of 2.0 you need VS 2012 build targets, but if you don’t plan to use 2012 then you don’t actually need those targets. You want it, but don’t need it. This client isn’t using 2012 (yet) so I’m building in 2010.
Open Nuget.sln in VS and build it which results in:
Exception has been thrown by the target of an invocation.
Awesome. Very insightful. #facepalm
The Real Problem
VS Extension projects deploy the extension on build so that you can debug them in an clean, isolated Visual Studio instance. I should have remembered this from creating my Gister extension. Turns out VS fails in this deployment when the extension has otherwise been installed. Not so clean, but oh well.
Option A: Uninstall Nuget
Since I’ll be installing this custom build anyway, I went ahead and uninstalled the RTM public build of Nuget 2.0. This fixed things and my extension can be found in VSExtension\bin\Release. Double clicking this will install the custom Nuget build.
Option B: Stop Deploying on Build
You can actually turn off the deployment of your VSIX on build. This might not be great for the build, debug story, but for this it worked great.