How do I change the name of a file? - windows

In visual studio 2015 I changed the name of a file in my project (from test.ps1 to test.psm1). I saved my project. I committed the file (this is a git bitbucket repo) and pushed.
The filename in VS changed, but it did not change in the file system. If I view it in explorer its still called test.ps1. If I view it in bitbucket its called "test.psm1"!
What the heck happened and how do I do this right?
Edit:
OK so now I have a problem where modifying a file in VS is not reflected in the file system. Maybe I'm just misunderstanding how VS works?
I create a file in my project, or edit an exiting file and save and I don't see any changes on the file system.
If I commit and push I see those changes in my commits in bitbucket, why don't I see them on the file system?
Whats crazy is if I create a new file in VS I don't see it in file explorer, BUT if I open a PS console and do "Get-Item fullPathOfFileICantSeeInExplorer.ps1" it finds it! What the hell is happening?

Copy the problem file to another file system location and rename it.
Delete the problem file using Visual Studio from your project.
Add the renamed file to your file system location of where it was in your project.
Add existing file using Visual Studio and select the renamed file.
Finally, Commit.

Related

Check in code to tfs from external zip-file

I've been working on a bug lately on my mac computer. This is what I did:
I downloaded the zip-file from tfs to my mac and fixed the bug. I ziped the file and got it over to my windows comp. What I wanna do now is to check in code from that zip file to the branch where I got the code from.
Im connected to the team on tfs but I cant see any changes in the team explorer while having the project in VS 17 and connected to tfs through team explorer at the same time. I appreciate any help I can get or any directions at all! Thanks in advance!
Generally you can not simply downlaod the zip files from web portal.
Get(downlaod) the zip file in workspace which mapped to the
specific branch.
Eextract the files --> change codes --> zip the files again. (You
can do this in anywhere with windows explorer)
The most important thing is that you need to copy the new zipped file
(with the same name) to the workspace to replace the old one, and you can see the
pending changes, then check in the changes.
I tested that on my side and that works as expected.
UPDATE:
If you can not see the zip file in Source Control Explorer, then that means the zip file is not in source control. You need to add the file to source control.
Copy the zip file to workspace folder
Right-click in Source Control Explorer --> Add items to
Folder --> Select the zip file in Add to Source Control dialog,
then Next --> Finish

Forget and Ignore a file in TFS while keeping it locally and in the project

I have a file that is currently:
Present in the TFS 2013 repository;
Included in the Visual Studio 2013 project;
And as such it's obviously also present on disk;
Previously, with Mercurial, I could just:
hg forget to remove it from version control;
add that file to my ignore pattern;
And all would be well. People that do a fresh/clean clone will see that file as "missing", which was exactly the point: everyone had (needed, even) his own local version of that file.
How do I emulate this with TFS? That is, how can I make sure:
The file is not present anymore in TFS 2013 repository;
The file is still included in the Visual Studio 2013 project;
The file might be present on disk if the user had created one;
Can I accomplish this with Visual Studio 2013? Do I need to dive into the command line?
If that file is already added to TFS Version Control, you need to run tf destroy command to delete it permanently from TFS server.
And, you need to create one .tfignore file to exclude one specific file during checking in. See: https://msdn.microsoft.com/en-us/library/ms245454.aspx#tfignore
and http://blog.appliedis.com/2014/11/06/excluding-files-from-team-foundation-version-control-using-tfignore-files/
In the end what I did was this:
Copy-paste "backup" of the file;
Delete the file from the solution explorer;
Put the "backup" back in the original file's location;
Edit the csproj (e.g. in Notepad) and revert the change done by TFS during step 2;
Check in these changes;
Warning: this does remove the file for others that currently have it. The file will show as "missing" for them after getting the latest updates from TFS. They will need to manually restore the file at that location (e.g. from an old version, or freshly created).
I don't think this is the proper way to do this, probably #Vickey's answer (i.e. use TFS command line and ignore files properly) is the correct way to do it. I just haven't gotten around to trying it yet. But this answer does work.

why is it whenever I open my solution file it always creates a new subfolder?

I am using visual sourcesafe 8.0 and there is a weird behavior that is extremely puzzling to me. We have this brand new project, the first time I got it from vss, everything was fine. But after I reset the working directory and got the source code, whenever I open the project by double-clicking the sln file, it always creates a subfolder under the current folder, and pull the source code from vss again. Furthermore, if I double-click the sln file under the subfolder, it will create another subfolder under that subfolder and pull the source code again. I think it must be a mapping issue or the sln file is not correct. Anyone know how to fix it? BTW, my project is a web site project (with a solution file)
You can go to Visual Studio menu File->Source Control->Change Source Control and check/update the mapping there.

Automatically include newly added files when pulling from GIT

User 1: creates a new class and commit and push that to git.
User 2: does a git pull. newly created class file gets downloaded but not included in project. Has to right click and do "Include in project"
Is there a way to automatically include a newly added file while doing pull from git?
Do I need to commit any other file (.csproj/.sln) to solve this issue?
IDE: Visual Studio 2010
The project files, .csproj, keep track of which files are loaded in a project. So yes, you will also need to commit the updated project file to the repository in order for User 2 to have the file added to their project as well.
In my experience, even if Visual Studio is open, it will recognize the changed project file and ask if you want to reload it. When you reload it, your project should have the new file loaded.
As an aside, there is a great blog post on why you should get fetch/merge instead of pull

Visual Studio and TortoiseHg: folder not visible in VS

I created a C# project and added it to source control (mercurial). I can edit files in VS, commit it and push it using TortoiseHg. It goes to the server. When some one pulls they get the files.
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
However, now someone pulled the latest code from the server - and they got the new file (it is visible through windows explorer), but when they open the solution in VS, they don't see the file.
Does someone have an idea what is wrong here? or things I should check? Thank you for the help.
P.S. I have visual studio 2010 express (so I can't use the VisualHg plugin).
Visual Studio caches changes to the solution and project until an explicit save or a build. In your comment:
In my visual studio I added a folder and a file inside that folder. I used TortoiseHg and it saw the new file in the new folder. I committed it and pushed it.
I see that an updated .sln or .vcproj file was not mentioned and checked in. Did you see an update to either of these files via TortoiseHg? If not, make sure to build or save your project after a change like this.
Did you make sure that the Visual Studio Project File or Solution file is being updated and committed?
VS solution contains projects and each project select managed files by metadata(***.vcproj file). It's not the way include all files from root directory.
So, your co-workers can see new added files by in following two ways.
1) share project file(***.vcproj)
2) manually add files in each person's VS instance.

Resources