How to work on an external developer's project using Team Foundation Server - visual-studio

Me - Front End web developer with an ok working knowledge of writing VB.NET code but I have never built a .NET project from scratch using Visual Studio.
External developer - Experienced VB.NET developer but completely new to version control and TFS. Also extremely cheap and prone to infuriatingly poor programming practices. He does things that make you bang your head on the table.
Background
Our external developer has coded our site but over the last few years I have been tweaking aspects of pages and have managed to learn quite a bit of VB.NET along the way. He has never used source control and I don't think he's ever had to work with another developer before.
Up until now he has maintained a local copy of the website. He makes changes to this local copy and when he wants us to test it he uploads the relevant files to our dev server. I have no experience of Visual Studio projects/solutions so if I have made tweaks to things I have edited the aspx/asxh/config files in my preferred editor and then uploaded them to the dev server. If everything works correctly I ask him to download them from the server so he can update his local copy.
I have been maintaining a local git repository of the website for the last 2 years. If he makes a change I check it in.
Obviously this is a nightmare to work with so we have now insisted that he starts using version control. I recommended GIT but he has decided to use TFS.
He has now put his solution and all the files into TFS. I have installed Visual Studio 2015 and successfully connected to TFS. I have mapped the files from source control to my own workspace but I am now at a loss as to what to do next.
Questions
As soon as I open the .sln file he has uploaded it says I have checked out the file and made changes. When I check the diff it seems to be because I am using a newer version of Visual Studio than he is. Does the .sln file need to be in version control? Or are we suppose to maintain our own versions of the .sln file and simply check in everything else?
If I try and build the project it fails because the web.config is set up for his machine and not mine. How can we maintain 3 versions of the web.config file? One for my local, one for his, and one for our dev/live environments?
I am not convinced he will have added the project to TFS correctly because he's never used it before. This is basically the blind leading the blind.

Question 1:
You need to put the .sln file in version control. Before check out the .sln file, please do a "get latest" step, which will make sure both of you are working on the latest version. When you try to check your local version in the server, and he had uploaded his local version in the server. You may have to solve conflicts before the check in.
Question 2:
You should build your project and published the website on the server. The build agent will only maintain one version of the web.config file. If he has built the project with his web.config. And you want to build the project again with your web.config, the build agent will delete the previous web.config and pull down your version. Then build the project with your's web.config.
Moreover, if both of you are not similar with TFS. Suggest you taking a look at below MSDN link which related to source control and build.
Use Team Foundation Version Control
TFS Vnext Build

Related

Create Visual Studio 2019 project from existing Azure Web App

I have a v7 Umbraco instance as a Web App on Azure but the machine the dev copy was on has been decommissioned and I need now to recreate the dev site in Visual Studio 2019, ideally cloning it from the live site in some way. I have created an empty project and, using the cloud explorer, downloaded the files from the app, but I am unclear whether I just copy them directly into the solution folder or into their own subfolder of the solution folder or whether simply copying them in will do the trick anyway as there's still the database to consider as well. I'm afraid I haven't used Visual Studio since creating this site three or so years ago and I seem to have forgotten most of what I did then anyway, so any help wpuld be greatly appreciated. The only advice I coud find via google was for older versions of VS and so not much help.
Recreating the original project from the live site is probably not going to be possible. It depends how and what you deployed to the live site.
It sounds like what you have is a working live site, but have lost access to the original source code. You should be able to copy the site and get it working elsewhere, but you're probably going to struggle to recreate the original development environment and amend the compiled elements of the website without access to the source code.
The Umbraco.com website has some great documentation on getting started and setting up Umbraco. Umbraco TV is great for getting up to speed quickly too. This should help explain the project structure. I suggest you create a blank Umbraco install to familiarise yourself with how Umbraco works(I wrote a post explaining how to do this with MS VS2015 here).
A typical deployment, using MS WebDeploy or FTP from Visual Studio, wouldn't deploy the project files or source-code for the compiled (.cs) elements of the website, these are usually kept as development files and checked in to source control.The live site probably only has the compiled versions of these file in the bin folder. The good news is the Razor template and view files(.cshtml) should be on the server.
However, if everything was uploaded (it happens) then you may have a chance, in which case you can download the files, potentially open the project and try to run the project locally on the development machine. There's no reason why you can't install an older version of MS Visual Studio alongside 2019 if there's an issue with that version. Although, I suspect this isn't an option since you felt the need to create a new empty project. If this is the case you might be able to add any project files to the the new empty project and attempt to recreate the project that way.
Regarding the database. You're going to need a copy or backup installed on a Microsoft SQL Server (unless you used MS SQL CE which is file based). You should be able to download a .bak file from the server if you're using Plesk or connect remotely using MS Management Studio if not, it depends on the host (Azure will allow access via MS Management Studio). Umbraco will need the connection string configured in it's web.config, the one you downloaded may be trying to connect to the live server so be careful.
Long shot ideas:
If you're really desperate you might be able to reverse engineer some of your compiled .dll using a tool like ILASM.exe but it's not going to be easy;
Perhaps you could reference the .dll in a the new project and it will all work auto-magically?! but I doubt this will work as there will be two application starting points and you'll probably get a runtime exception.

How to pull new files from github to Visual Studio?

I'm new to developing on Windows and getting frustrated with how non-intuitive Visual Studio feels compared to Eclipse. Here's where I'm at:
I created a local VS project, and wrote some code.
I pushed the code to github via the built-in source control options. No problems, source is all there.
My collaborator made new files, and commited them to github. Those are up and live.
I pulled from github, but I don't see the files anywhere in my solution. Where are they? How can I get them to automatically add to my VS project?
How do I pull ALL files on github into VS without having to manual download them and add them to my solution? Visual Studio version is 2019 Community edition.
--EDIT--
I finally found them by switching my solution explorer to the project's folder view using the "Switch Views" button at the top of the solution explorer pane. How do I add these to the solution view?
The concept of having a "solution" completely abstracted from the actual file contents is... strange. I think I'm just going to back to Eclipse. I want to like VS because of vast amount of content in it, but the user experience has been a much more hostile learning environment.
This is not a problem with Windows nor Visual Studio; this is a Git issue.
here are some steps to follow:
make sure that you are pushing to the same branch. checkout this link
if you are pushing into different branch make sure that you do rebasing. checkout this link

File gets excluded every time the latest code is taken from TFS

Let's understand the problem:
For our ASP.NET project using Visual Studio 2013 premium on a Windows 7 x64
On developer A's machine:
We've got a TFS setup
We added a new file A in the project
We checked-in the newly created file in the TFS source control
On developer B's machine:
We've got the same TFS setup
We forcefully took the latest (by specific option - overwrite option) version
File A gets loaded in the project, however it stays excluded
Developer B manually includes the file in the project
The files are well included and that is our concern. Why files which're included are getting excluded on other devs' machines?
The newly added files gets loaded on dev B's machine however they doesn't show up in the solution tree. We've to manually include them in the project after show all files
There's only one mapping on each dev's machine. The code is going to locally mapped workspace only
We've a little big team, so for every developer. It happens every time we take the latest version.
How do we suppress this behaviour? Is there a setting as such?
We've tried searching the web, couldn't find a solution.
It seems TFS automatically excluded the changes. You may encounter such a situation as below:
They're not loaded in your current solution, so Team Explorer assumes they're made as part of either a different solution and
that you don't want to check them in together with the changes that
do match the context you're in.
They're made in a different workspace, again Team explorer assumes you want to check in groups of files that logically make sense.
More detail info please refer the very detailed answer from jessehouwing in this question What are "Excluded Changes" in Team Foundation Server?
And if you are working with a little big team, the way you are using to "forcefully" take latest is not a recommend solution. Suggest you to still use get latest to download the files on the TFS server. Even though you may not obtain the "really latest version" of the file. You can still work on it and figure out the conflicts if there are during the check in action.
Update
If develop A has checked in the files, but not checked in the project file( .csproj file), then TFS will not download them if you execute a "Get Latest" by right clicking on the project or solution in Solution Explorer.
You will however get the files downloaded correctly if you right click and "Get Latest" on the folder in the source control window. But, they won't get loaded into your solution, because you haven't told TFS that they belong there.

Web.config Vandalized Mystically During Azure Deployment

I know this is super weird, so to make you believe me and help me, I provide lots of evidence here.
Problem: the web.config file under site/1/views has been changed during Azure Deployment.
Facts:
The file exist in .cspkg package, not the case here
No other web.config been changed, not the root one, not the one in site 2,3,4.., not in area, not in any other places. The whole solution has 10+ web.config files, but only this one, the one under Views of site/1 has been changed.
File is not been replaced, is been edited, only change is 2.0.0.0 -> 1.0.0.0 and
4.0.0.0 to 3.0.0.0, which is a targeted vandalize, I have to say. Nothing else changed, my own namespaces defined still there.
Tried:
Remote Desktop to the Azure Instance, edit the file, the site works, and it won't change back even after reboot (except the reboot at Azure interface which whole package just reloaded)
Repackage and redeploy, twice, no use.
Changes I made from last deployment, which was a success one
Install Visual Studio 2012 Ultimate trial today
Upgrade the whole solution from MVC3 to MVC4, Azure SDK from 1.0 to 1.7
Change all project from framework 4.0 to 4.5, found Azure cannot support 4.5, then change back to 4.0
finally built and packaged
Whole package works well before under Visual Studio 2010
Whole solution works well in local as well
Pictures
pic1
Original web.config file under site(1) Views folder
pic2
It's in .cspkg package.
pic3
Check again from remote desktop
Final words
I know there's a solution is make site(1) empty, a dummy site, so whatever been changed will not matter. Or just load my backup and back to VS2010. But I do really really like to know how it got changed, and how to avoid it, thanks.

Setting up BitBucket and Mercurial for Use In a Group Environment

My company is currently implementing a versioning system using Mercurial and BitBucket. We currently have respositories set up on bitbucket and are able to use them, but our work processes for doing so are a bit clunky. We use Visual Studio for web programming in .Net. Currently, we have set up a cloned repository locally and work from there. We can do this using Visual Studio with VisualHg.
In order to edit files we open them in Visual Studio from the local repository and make our edits. We then commit our changes to Hg, which updates the repository as it should. Then we need to FTP the files from our local system to the DEV server for testing and then FTP again to the Production server once QA is completed and approved.
It would help streamline things if we could have the BitBucket repository synced with our DEV server so that all that was required is to commit changes for testing in DEV, bypassing the otherwise necessary step of locating and FTP'ing all relevant files.
Does anyone know if this is possible? If so, can you point me to any documentation that would show me how to set this up? Our developers would be eternally grateful. Thanks for your time.
In my opinion, using Mercurial is not the correct solution for this problem.
The main reason for it not being the correct solution is that the files that are in Mercurial are not the files that you want on the production server and so aren't the files that you want to use on your development server (because you want the QA environment to be as close to the production environment as possible). There are no assembly files stored in Mercurial (or there shouldn't be) and those are the files that the server should be using to run the application.
There are deployment tools built into Visual Studio that you can use for this task. They can be configured to upload all the necessary files with one button click.
Scott Hanselman has a post on his blog about this.
Troy Hunt takes it one step further by introducing a build server with this excellent set of posts. It uses Subversion as the repository but it can be done using Mercurial too.
I prefer the build server method as, once you have it set up correctly, it makes it 100% reliable. It will do the same thing every time you ask it to do the deployment. If you use Visual Studio to do it the developer doing the publish could choose different options and get it wrong.

Resources