Search code examples
tfsvisual-studio-2019tfvc

How to get Visual Studio 2019 to recognise that my projects are in source control?


We have a solution which is made of a number of projects, and is saved in TFS. We don't want the solution file to be saved to TFS as we've found this causes problems, so after we clone the repository we create a new project and solution, saving them away from our TFS code. We then add top level folder as a website to the solution and then its sub folders, also as websites. At the bottom right hand corner of Visual Studio I would expect to see the name of the current branch in TFS, but instead I see 'Add to Source Control'. If I click this it tries to add the code to TFS - but it is already there.

We have another solution which I have set up in the same way and that behaves correctly, so why doesn't this? Isn't there some way to tell Visual Studio that the files are already in TFS and which repository and branch to use? I am using Visual Studio 2019. Can anyone suggest how I get this to work?


Solution

  • Well, I finally figured it out. Turns out the problem wasn't with Visual Studio but IIS. One of the Aliases had a space in it. For some reason I decided to see what would happen if I replaced the space with an underscore. You can't actually do that in IIS Manager, so I had to edit C:\Windows\system32\inetsrv\config\applicationHost.config, and that did the trick.

    You would think that spaces would automatically be replaced as IIS doesn't like them, but apparently not. It's a shame it took me a week to solve this, but maybe this will help someone else in future.