Visual Studio: How to create project from existing GitHub repository? - visual-studio

I came from Eclipse background and I am apparently missing something.
There is an existing GitHub project with JS code in it and I would like to start adding TypeScript nature to it, one type at a time.
I have followed this tutorial to clone project from GitHub to my "local git repository". Now the Team Explorer window displays it as local repository and I can commit changes etc but it's not a project and I don't know how to open it as a project (I want to open it as TypeScript project).
The workflow I was used to from Eclipse would simply be New -> Other -> SVN -> Checkout Projects from SVN that is automatically followed by New Project Wizard.
How do I clone existing JS project from GitHub and make it a TypeScrip project while keeping the existing folder structure?
EDIT: I am using Visual Studio Express and I am limited to the native Git extension.

What I typically do in this situation;
Clone repository using Git in Visual Studio; or use GitHub for Windows and Clone in Desktop from the Git project's web page. This will create a directory (repository) with the project files where you specify.
In visual studio, File->New->create a new project from existing code. From the wizard, select C# or C++ (whatever your choice it does not really matter)
The wizard requires a project file location: give the location of the Git folder that contains the project files (where you cloned the project's repository).
The Wizard requires a unique project name, for example you can use the name of the Git project with VisualStudio (or VS) appended to the end.
Git will now be in sync and you will be able to see all the git files. Making changes will check them out and allow you to push them to the project etc...
***** By default Git will want to check in the newly created .csproj file that Visual Studio creates to allow you to open the project in Visual Studio. You will just want to drag this into the excluded changes section because most likely the project in question will not be using Visual Studio.**

I solved this by opening the site as a website. File->Open->Website.
No Project Files/Solution files required. It just opens up the folder in the solution explorer.
To make it a typescript project, just add a tsconfig.json file to the directory.

Do you have any code in that repository yet that you want to open? I'm guessing not in which case you need to create a new VS project (just like you'd create a new Eclipse project and have it in your workspace)
Go to File, New..., Project... and pick the project type that you want. Give the project a name and set the location to be a folder INSIDE the folder that you cloned your Git repo to earlier (i.e. c:\mycode\mygitproject). Also give your solution a name. A "Solution" in Visual Studio is a wrapper for the projects inside it, kinda like the closest thing to a workspace or a working set in Eclipse but not quite the same thing.
Then Visual Studio should then be smart enough to pick up that this is in Git repo and allow you to commit locally as well as push/pull to GitHub etc.
Finally, while I work with the team that created the Visual Studio Tools for Git, I'd still highly recommend that you get hold of a command line should you want to do some more powerful stuff with Git other than simply committing code, push/pulling changes and branching or merging branches. If you are working against GitHub then you might also want to install GitHub for Windows which will bring some Git tools with it or you can install Git for Windows and also install Posh-Git separately. All of these things work together and give you the maximum power of Git but you can pick and choose the tool that works best for you. You'll probably find a workflow of Clone using GitHub for Windows, commit/push/pull/branch/merge in VS and then Posh-Git if you do more advanced stuff or want to hand-tweak settings.

Related

Visual Studio Team Services opens an empty/unupdated solution?

We're trying to work together on our project, using VS Team Services. The problem is when we're opening the project from within its' VSTS website - what we see is the project empty and not updated with any recent changes.
The project's repo is on my PC, so I'm able to open it not from its' website.
'Sync' was being used.
edit: It seems that whenever I commit changes the VSTS saves our project to its' VS-site. why is that necessary?
You should add the source files to source control first. Then you could use Push with Git (or Check-in for TFVC) effectively. In your case, you should use the "Add to Source Control" option on the Solution itself to add all the appropriate files to source control.
Note that VSTS host two different source control technologies: Git and TFVC.
I would advice you to understand which technology you are currently using by reading this detailed article, then you will be able to add the source and work with team on the same repository.

Tracking multiple sub-projects using Visual Studio 2012 git

I have been struggling with what (at least in my mind) should be simple:
I have two projects, the "MainProgram" and a "SubLibrary". Both were created with a Git Repository using the new Visual Studio 2012 Git support.
Both repositories work fine independently.
However when I "Add Existing Project"/SubLibrary to my MainProgram Solution, SubLibrary is not being "git-monitored" by Visual Studio at all - no overlaid status icons in Solution Explorer etc. - its just as if that project was not under source-control.
Through some research, I added a git submodule to the MainProgram repo, added the cloned version of SubLibrary project to the solution and .. the git-icons in Solution Explorer appeared!! ... but my joy was short-lived ..... No History, the status of changed files did not show in Solution Explorer. The changes were however picked up by TortoiseGit from within File Explorer.
The .gitmodules file looked OK (but as you can gather I am NO git guru!) .....
Surely it must be possible to have version control over multiple projects/repos within a single solution!
I would be very greatful if anyone could point me in the right direction!
In Git it is indeed usual to have smaller repositories. A typical repository will contain a single project while TFS and Subversion tend to have multiple projects in a single repository.
That will lead to the situation you described. Currently as far as I can see there is no git multi-repository support within Visual Studio (and TFS). It is simply not possible to have a single solution with multiple projects while each project resides in its own Git repository.
What I've done in the past:
I created a directory that served as the root
In that directory create a subdirectory for each individual project
Clone each git repository in its respective subdirectory
In a project use a file reference with a relative path to add references
(optional) create a single MSBuild file that builds all the solutions in its correct order. This way you can create a build using multiple Git repositories.
You won't have a single solution this way, but you will be able to track your changes in each individual repository.
Hope this helps you.

Adding an existing folder to SVN outside of visual studio

I have created a repository online and I want to add an existing folder to it and make it version controlled. I am using TortoiseSVN.
When using Visual Studio I can just click "Add to Subversion" and it automatically adds the versioning to my project. When I click into the physical folder everything has icons next to it implying it's now versioned. I can then just commit it all either in or out of visual studio.
My problem is, I now have a folder that isn't part of a Visual Studio project that I want versioned. But I can't work out how to do it. If I click import I can import all the files but it doesn't add the versioning to the folder. I can then export it else where, but still I don't have the versioning.
What do I have to do to make my existing folder versioned without Visual Studio doing it?
You should read the SVNBook and TortoiseSVN manual. At least they'll help you to understand the concept behind Subversion and version-control in general.
When you svn import some folder to Subversion you can later get the working copy of this folder by doing a svn checkout operation in TortoiseSVN or a command-line client.
Whatever tool you are using in Visual Studio is using a subversion client under the hood - you can normally invoke this tool directly from the command line if wanted.
If you are not comfortable with that, you can download and install the free TortoiseSVN tool that integrates with the windows shell. Once installed, you can right click on the files/folders to add them to your repository outside of Visual Studio.
I have just worked out how to do this, so am answering my own question in case someone else is trying to do this:
Create the repository on the server,
svn import everything into it,
svn checkout what you just imported over the top of your existing folder.
Everything now will have ticks by it ready to commit!

Ankhsvn integration with Visual Studio 2010 - Adding Solution - Working Folders Issue

Newb to Ankhsvn and Ubersvn integration.
I have existing web projects built in Visual Studio 2010 and am attempting to add them into a newly created repositories. The issue I'm having is trying to configure the working local directory. I've got my projects contained in various folders on my machine but it seems Ankhsvn will not let you change the "Local Folder" (which I'm assuming is the working folder) on your machine, it only gives selected options in a dropdown. I know Visual Studio generates it's own solution file in the standard directories (my docs../vis stud../projects/...) but that is not my working directory which it seems Ankhsvn is fixed in.
I don't want to have to move my projects around (and probably don't have enough space on my c: drive anyway). Does someone have any insight on how I can configure the local folders ankhsvn and Ubersvn can work out of?
Using Windows 7 64bit if that has any bearing as well. Our svn repository is hosted externally.
UPDATE
Well I haven't heard any feedback yet on this so I basically went ahead and used the following methodology to get my files into the repository:
1) Used TortoiseSVN to add the files to the svn repository (with TortoiseSVN installed, right click on the folder you want to add, TortoiseSVN -> Import and basically add in the repository URL ad go about adding in folders and files as desired.
2) next step was to then open Visual Studio 2010 and open the given web project folder and then go File -> Subversion -> Open project from subversion. NOTE: make sure when you open that you select the correct folder to import to. It should be one level above the given folder you selected.
3) after the import, all my files appeared as in conflict. I basically just commited the files and the issue went away.
So I now have my project hooked into svn and working through Ankhsvn but has to use TortoiseSVN to get it done...hmmm
To administer the repository in uberSVN you need to make it aware of the repository. The easiest way to do this is to create the repository within the uberSVN admin page, but you've already done that bit, so we need to make uberSVN aware of it.
To do this:
Create a Dump file based on your manually created repository
Login to uberSVN as an System Admin or Repository Admin
Click on Repositories
Click on Add
Enter a Repository Name (which will enter a Location automatically)
Click Next
Click Import From Uploaded Dump File or Import From Dump File Located On The Server
Select the Dump file in question
Click Done
Your repo will now be brought underneath uberSVN, loaded into a newly created Repo sat in the /uberSVN/repositories storage location.
From there you just continue as normal with your preferred subversion client.
Know this QA is old but thought worth updating.
Got a solid, reproducable method for adding projects into remote UberSVN repository from Visual Studio 2010...trial and repeat seems to work consistantly on my side. Here goes
Go to remote UberSVN server, Login
Create Repository
"Your Repository Name"
Added users to repository
Created Visual Studio project (File -> New Project) in similar ubersvn structure…in this case
In windows explorer, created folders D:\\\trunk\
In Visual Studio, create new project, uncheck “Create directory for solution” and I set the “Name” to
"Your Project Name"
In the first solution and subversion create phase, I checked off “Add to Subversion”
Created project and the subversion repository selection popup came up.
typed in the new repository url
http://"your UberSVN Repository URL"/"Your Repository Name"/
Below the Repository URL, I selected the repository “Database” image and then I clicked “Create Folder”
NOTE: When I did again, it seemed that there was already a “trunk”, ”branches” and “tags” folders generated under the repository database -> I clicked on the trunk folder).
If the folders from above notes do not exist, I typed in “trunk” as new folder and then the proper Project url appeared in the “Project will be created in:” section at the bottom of the popup (
http://"your UberSVN Repository URL"/"Your Repository
Name"/trunk/"Your Project Name"/
)
Clicked OK
Started copying files from existing website/project to new project
Once all files are in and no more errors exist, start to do initial commits
Visual Studio 2010 NOTES:
May have to regenerate designer files from older visual studio 2008 projects. Right click on the web form page you want to convert to “Web Application” and it will autogenerate the designer file for the given webform (web page)
Will have to add in references from the bin folder for any dlls needed in project
If bringing over classes from another project (i.e. in App_Code folder), need to right click on each (or select multiple) and go to properties -> Build Action and change from “Content” to “Compile”

Using a BitBucket Repository Locally with Visual Studio

My company has just begun using BitBucket with Mercurial for version control and I am having a heck of a time integrating it locally with Visual Studio 2010. I can easily create a folder on my local system and clone the BitBucket repository using TortoiseHg and it brings down all the files appropriately. However, when I try to create a Visual Studio project in the same folder, it insists on creating it's own sub-folder for the project files, leaving my version controlled source files out of the project. When I try to do it the opposite way, creating my solution in Visual Studio first, TortoiseHg will not let me clone my repository into the same directory, saying that it needs a new folder. All of my google-foo seems to be coming up fruitless.
Anyone have a clean way of setting up a cloned repository from which to work locally in Visual Studio using Mercurial and BitBucket?
You can
Create your Visual Studio project.
Right-click the project folder and choose TortoiseHg -> Create Repostory Here.
Add and commit files in TortoiseHg.
Push the repository into a new empty repository on Bitbucket. To push, you use the synchronize view and add a new path to the repository. Name the path default and it will become the default push and pull path.
The important point is that you can always push into an empty repository. This is how you copy a repository you've worked on locally to Bitbucket: create a new empty repository online and push to it.

Resources