Problem:
What I try to do is host a bower components on visual studio online. This seems however not possible the way I try to do it.
I have created a bower component and checked it into visual studio online with the tutorial of Brian Ford. This bower component now safely resides in my a visual studio git project. However, when I try to do:
bower install https://myAccount.visualstudio.com/DefaultCollection/_git/bower-component
it put's something in the bower_components folder, but this is not the bower components that I have pushed to visual studio online. In the bower_components folder is a bower.json, with some incorrect values and an "index" file, without file extension. When I open this "index" file in an editor, it looks like the login page of visual studio online.
To me it seems that the problem is the authentication when connecting to visual studio online.
I tried:
Does anyone have any experience with trying to get this to work with visual studio online, or any team foundation server? Or does anyone has other possible solutions to this problem?
TFS 2015 (as of Update 3) now supports SSH connecting to Git repos. Using the git+https://
may not be required anymore for Bower to retrieve code, but will require some testing on your side.
I dove into this last week and made some interesting findings. A workaround, and a possible bug identified in TFS. I researched with an on-premise version of TFS, but it may still apply.
For starters, you will want to use HTTPS
to connect to your TFS instance. Bower, upon pulling from a HTTPS
source, will prompt for credentials that gets passed to TFS. Then, since TFS does not recognize the ".git
" suffix that Bower also expects from an online Git repository, you need to adjust the protocol.
bower install git+https://tfs.domain.com/tfs/Collection/_git/MyComponent
This should be enough to get Bower to talk to TFS and pull the component. You will need to enter your credentials as it runs, unless you feel comfortable putting them in the URL itself (which I wouldn't).
Now, where you'll run into issues is if you tag your commits with versions (as you would want to do to properly version your component). TFS doesn't seem to play nicely with tags, as you've noticed. If you do this, when bower runs a checkout, an error throws in TFS.
InvalidCastException: Unable to cast object of type 'Microsoft.TeamFoundation.Git.Server.TfsGitTag' to type 'Microsoft.TeamFoundation.Git.Server.TfsGitCommit'.
I found this looking at the administration logs at http://tfs.domain.com:8080/tfs/_oi.
If I tried to checkout a bower component where I did not tag any of my commits, things went successfully.
This information is also posted at MSDN Forums.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With