Move solution in Source Control - visual-studio-2012

I have a project under source control in Visual Studio 2012 using TFS2010. When I added this project, the solution was not added in the correct file folder location. I want to move the solution, but every time I try to do it within the Source Control Explorer I encounter an error: "The project file 'path/to/project.csproj' has been moved, renamed, or is not on your computer." What is causing this error? What is the proper way to move the solution to where I want it to be?

Move the solution file in TFS (this is more relevant if you have history you want to maintain)
Open the solution, it will complain that it can't load your projects, either edit the path to the project in the properties window, or remove each project and then re-add it. Check-in your changes

Delete the .suo file and try once. Has helped me in the past. This file is usually hidden. Restart VS after deleting.

The problem is the solution file has relative paths to the project files. I usually do any moving around when I first create the solution (before there are projects in it). However, in your case I would just use Source Control Explorer to move the solution, then edit the .sln file in a text editor and fix up the relative paths to the proj files.

Related

Android Studio Copying Projects

Hi I wrote a project on Android Studio, now I just want to create a exact duplicate to it so I could try some experiments on the new copy without ruining the old version.How can I do that?
Someone told me just to copy the file in finder(I'm using mac). I did that, and managed to open the new version as project. But it is not working.I am sure I need to edit a few places as the file name has changed, but I don't know where are the places to edit, any idea?
Thanks !
Well it depends on your project. Is it a small one or a big one with huge memory?
If it's a small one and you have enough memory in your Mac, just copy the whole folder instead of a file and paste it somewhere else. Then you can do anything you want to in the new one.
If your project is huge and don't want to waste memory, I suggest you to use GitHub.
Just Follow this steps:
Clean renamedProject
Go to java folder and Refactor > Rename to renamedProject
Change app name in strings.xml
Change applicationID to renamedProject if not already changed.
Sync Project
Check out Detailed Steps in Official Book:
https://google-developer-training.gitbooks.io/android-developer-fundamentals-course-practicals/content/en/appendix_utilities.html#copy_project
To answer your question, you can simply locate project folder in finder, and copy it at different location with new folder name. Now open it in Android studio. This would create a replica of your project.
But better approach to achieve your requirement is GIT. You can refer following documentation for better git understanding.

Rename Android Studio project causing a bunch of errors and java files missing

Following some links here I tried to rename a project. I went to c:\path\to\AndroidStudioProject and renamed the folder there, then found the .idea file and changed that. Now the project loads but java files are missing! However, on clicking java (in the bar at the top), then com I can see them each with a small red j.
I then looked in module Gradle build where there were 3 files, one with the new name and 2 older ones which stated that they did not belong so I deleted them, copying the compile info into the new one. Naturally on doing a Sync Now I get a bunch of errors.
Why does this have to be such a complex operation? Can anyone assist?
After you rename the folder, open the project in Android Studio. From there, right click something that needs to be renamed (e.g., module, package names, etc.) and use Refactor->Rename from the context menu. Keep doing this until everything that can be refactored is.
You will need to manually change the value of applicationId in the app-level build.gradle. Obviously, things like #string/app_name will also have to be changed manually. I recommend making these manual adjustments from inside Android Studio rather than directly editing the files. That way you'll know immediately if you break something.

Visual Studio 2012- How do you delete a new file?

I have Visual Studio 2012 with TFS. I created a new file (call it "x.h") and before I checked it in I decided I didn't need it.
MSDN makes it sound so simple:
In either Solution Explorer or Source Control Explorer, browse to the folder or file that you want to delete.
Select the items that you want to delete, open their shortcut menu, and choose Delete.
When you are ready, check in your changes.
So I went to Source Control Explorer, right-clicked the file, and chose Delete. It was removed from source control and my pending changes but is still on disk and in the Solution Explorer. When I right-click the file in Solution Explorer, Delete is not an option and Exclude From Project is disabled.
I might have more luck if I check it in first then delete it but that seems very unnecessary. Hopefully I'm just missing something obvious!
How do I delete this new file ("x.h") from my solution?
Yep. It was something obvious.
You can't delete files from the Solution while it is building.
I just tried again and the Delete option magically reappeared. I realized that it has stopped a build since I last tried.
In short, there are three different angles that a user can try to delete a file while a build is occurring and the behavior is different for each.
Undo the file add from Pending Changes -> Nice error messages are given.
Delete the file from Source Control Explorer -> It lets you remove the file as I described in the question but leaves it on disk and in Solution Explorer (same behavior regardless of whether or not a build happening).
Delete the file from Solution Explorer -> It quietly prevents you from shooting yourself in the foot and doesn't explain why.
The right way to do this is to cancel the build (or let it complete), then delete from Source Control AND from Solution Explorer.

Visual Studio 2012 constantly complaining that a file has been modified outside of the source editor

I am working on a parser, using the parser generator ANTLR in Visual Studio. Naturally, ANTLR is continually regenerating certain files. Every single time it does this, VS has a popup saying:
The file has been modified outside of the source editor.
Do you want to reload it?
The answer I want is always Yes to All.
Is there any way to tell Visual Studioto always assume I want to reload auto-generated files, without prompting?
Click Tools then options then under the environment node on the left choose documents then check the box that says Auto-load changes, if saved:
If you are using Visual Studio's internal editor and you know that nobody else is editing the file, you might be wondering why that happens. In my case, I realized I was working on a continuously backed-up network folder, that's why the file got re-saved every time I made a change on it and saved. So, if you can move your file to a local, not-backed-up folder, that might also solve this problem.

How to tell VS2012 C# debugger where to find sources

I'm trying to debug a third-party library. I have it's .pdb and sources. I put .pdb near my dlls. When I step-into third-party code for the first time, VS2012 asks where are the sources. I pick the correct file and everything is fine. Now, I'm rebuilding my code with another version of the same third-party lib. I have another version's .pdb and sources. When I step-into, it doesn't ask where are the sources, instead, it just connects to the SAME SOURCES it connected at the first place. I can close the file and open file from new sources, but each time I press F11 to step-into another file, it continues to open files from the old location.
Visual Studio remembered the selection you made and stored it in the hidden .suo file in the solution directory. You can edit it. First ensure that the Solution Explorer window displays the solution name (similar to "Solution 'name' (x projects)"). If not then use Tools + Options, Projects and Solutions, tick the "Always show solution" checkbox.
Right-click the solution in the Solution Explorer window, Properties, Debug Source Files setting. You should see the directory you added in the original debug sessions. Delete it and add the new directory.

Resources