TFS Get latest version - delete local files when they deleted from remote TFS Repository - azure-devops

We are migrating a tfs repository (az devops cloud) to tfs (another organization, cloud also.)
when getting latest version from the source repository, the files that were deleted from the remote repo are not getting deleted in the local workspace.
We are using visual studio to manage our tfs files.
Our repository is something like 800 GB. so cloning again is not an option.
Steps i did :
Get Latest version - Did not delete the local files (if they deleted remote)
Compare (local to remote) - checkout - did not delete local files.
any thoughts here ?

Make sure you clean the workspace first before everything else.
Retry getting latest version after you clean.
In visual studio, you can check for pending deletes, if you find any, check them in to complete the deletion.
Then you can compare workspaces if none of the above work. Compare local and remote.
A last resort would be to manually delete the files (DANGEROUS move, make sure you have backup)

Related

Github Visual Studio Pull : Will it include the Project's references?

Github Visual Studio 2022 Git Pull : Will it include the Project's references?
Using Visual Studio 2022 with Git. When pulling from a hosted repository into my local machine, will that also automatically set the same project references in my local machine as it is in the hosted repositories?
What should be the expected behaviour?
Thank you
I tried but I see other references than other users on other machines.
The project references should be defined in the .csproj file (or .vbproj, etc). This file should be included in ones source control repository.
You may need to perform a nuget restore if the references are fetched from a package manager (i.e. https://nuget.org), especially if someone else modified the references and pushed them to your remote in GitHub
For example, someone else on your project updates a reference to a newer version and pushes it up to GitHub. You then perform a git pull on the branch that these changes were made on, and suddenly you have new references or possibly see errors all over your code. When this happens, you almost certainly need to perform a nuget restore to get the new package references.

When I add a solution to source control in VS 2019 Azure Devops only the startup project gets added - how do I add the others?

I am working on a solution that has 14 projects (so far) in it. I added the solution to Azure Devops source control and can see that the solution and the startup project have the little locks in the solution explorer, also I can see the startup project files in the devops repo, but I can't see how to add the other projects. Obviously I messed up somewhere, since ideally the repo would contain a folder for the startup project rather than the files themselves, but I don't know how to "undo" the source control and reset my solution back to its original state.
Can someone tell me how to either fix the source control so that the master branch contains all of the projects in sub-folders (as per the visual studio folder structure) - i.e. how to move the startup project files in the devops repo to a sub-folder and how to add the other projects to their own sub-folders, or, failing that, how to undo the source control so that all of my solution files are back on my local hard disk?
Any advice will be appreciated.
You mentioned that you are using git. So when you DO NOT have local changes which are not pushed to your git server, that means everything is "synced".
Make a backup of your folder, just copy & paste everything!
You can just delete the .git folder. So you have no "link" to the git server anymore.
You can the link the "folder" again to your git server, with sth. like:
git remote add origin https://YOURNAME.visualstudio.com/YOURPROJECT.git
Other option is check your .gitignore file, maybe some of your projects are excluded.
When you are working with Visual Studio, can can also create a new empty solution and add the projects one by one. Also be sure that there is NO Filter in Project Explorer in Visual Studio.
You can also check your git changes, with git log or git status from any terminal or command line tool.

Running a .sql file in VS Code using mssql extension - not executing when file saved to git versioned network folder

I'm using VS Code with the mssql extension - both installed this week so up-to-date.
I can connect to our sql-server.
I then right-click the database name and select 'New Query' and do the following:
SELECT 1
I then save the file onto a network drive, re-run the script and all is still good.
I then save the file into a git versioned folder and this now happens:
It does not return a result - the query cannot be cancelled from within Code and I need to close the application. Moreover any .sql files I have saved in this git versioned directory are not usable from within Code.
Anyone any ideas what is happening and how to solve it?
Edit the git directory is cloned and synced from an Azure DevOps Repo
Unsure why the following works and there are likely other solutions.
I deleted my local Repo.
Then in Azure DevOps I cloned the repo using the "Clone to VS" option.
The SQL scripts now execute fine.

Github local repo with VS code : Too many changes

I have install Github Enterprise on a self-managed server. I am connecting to my Github repo through VS Code. Every time I open VS code:
1 - It's trying to connect automatically to my cloud repo (Which I would like to be able to manually connect)
2 - VS code is installed in Anaconda and it's detecting 5000 changes....all anaconda files on my local machine
Can anyone help me with this issue?
thank you
I guess you have Anaconda or a conda environment installed into your project folder? Then you have to add that folder to your .gitignore file.
In VSCode you can rightclick on one of the 5000 files, select "Add to .gitignore" from the context menu, then the file .gitignore opens and you can delete everything but the top folder from the new entry and then that folder will be ignored.
Btw., VSCode doesn't update your local git repository automatically but just checks, if there are new changes in your remote repo (github) or how far it is behind your local changes. You can see that in the VSCode status bar. If you want to actually change one of the repos you either have to "pull" or "push" manually.

Use Git list output to copy files for archiving

I'm currently helping to maintain a project for a client remotely. I'm the only developer ergo some of my unorthodox approaches/thinking.
the problem
The client is using Visual Studio 2010 + Team Foundation Server for their source control. I am working on a Mac over VPN and have tried several approaches to make committing to their TFS workable. I've tried TFS plugin for Eclipse with no luck (VPN really hoses the connection to TFS). Currently I am having to do a full "checkout for edit" through a virtual machine to the TFS, then transferring the project over the VPN to overwrite those files. Not a sustainable solution to say the least.
the solution?
I'm wondering if there is a way to:
get a list of changed files from GIT (I think this is the solution
(How to list all the files in a commit?)
then use that list as a means to go in and fetch those file, maintaining their folder structure
from there I can do my dump over
VPN into the VM that has the project mapped in TFS.
Or if there is something I've overlooked or hadn't thought of, please do recommend them, I'm all ears.
First, I'm assuming you are running the VM on or near the TFS server, not on your Mac. If not, you can just share a directory using VMware/VirtualBox and edit away on your Mac...
It sounds like you could achieve what you want with plain old Git. If you:
Create a bare repository on the VM (git init --bare)
Add a post-receive hook to copy the files from the master branch (for example) into the TFS directory, overwriting merrily (http://git-scm.com/book/en/Customizing-Git-Git-Hooks)
Initialise your local copy of the source as a Git repository (git init)
Add the remote repository. Assuming it's a Windows box you can use an SMB shared folder over the VPN so your remote is "local" as far as Git is concerned. (git remote add tfsserver file:///Volumes/tfsmount/code
Your first push will be expensive (but you could prepopulate the remote repo to get around that), but subsequent pushes would be just the changesets. The post-receive hook would then take care of updating the files, and you're laughing.
Of course, you then get to impress them with how amazing Git is, get them to migrate, and your problem goes away forever :).
Update: Here's a link which describes these steps in more detail, under the guise of updating a remote website: http://toroid.org/ams/git-website-howto.