Visual Studio prevent accidental checkin of dev testing - visual-studio

There are many times when we change code to test something. These are temporary changes that we do not want checking in. For example, I am currently migrating and cleansing a css file into a new css file, and so linked the site to the new css file. I dont want to accidentally check the re-link in, but would like to check the new css file in.
My question is, is there a way I can mark a change such that it does not accidentally get checked in.

Just be sure to review your pending changes before you check them in. I always give them a quick once over to make sure all the changes are things I intended to change.

Related

How to undo uploading files in code collab code review?

I started a code review from the command line using
ccollab adddiffs new D:\Development\review\before D:\Development\review\after
I made changes to the code and then went to upload those changes to the review using:
ccollab adddiffs ask D:\Development\WRONGpath\before D:\Development\WRONGpath\after
code collab errored out saying there were no files to upload. Okay, fine. I fixed the path and redid the command with the correct path
ccollab adddiffs ask D:\Development\review\before D:\Development\review\after
I properly edited the list of files in the text file leaving all the original file names in there except files I did not want added to the review, but Code collab proceeded to add the files as new rather than as diffs to the original files. I'm wondering how I can undo the last upload to the review?
It's only possible to delete files if there aren't any comments or defects on them. If the files you want to remove is part of a changelist (which it probably is in this case) then your only option is to remove the whole changelist.
In the Review Materials section you'll see a Delete button next to each changelist. You may need to change the View As option to Separate in order to delete the changelist.

Is there a way to recover erased code in a source-controlled project(TFS)?

I'm working on a project in Visual Studio 2012, that's hosted on TFS.Any way, I don't know if it's due to lack of sleep or sheer carelessness, when trying to move one large function body from one file to another, I copied the declaration to the new file, but forgot to copy the body and then erased the body from the old one, clicked save by reflex and closed the first .cpp file, so when I pasted it in the second one, to my surprised I pasted the declaration and not the definition.Undo pending changes would only undo the 'Add' alltogether.Is there ANY way to retrieve the lost source or should I start rewriting it ASAP?Because I spend quite a while writing it.
View the history of the file. Right click it >> Source Control >> View History, as below:
This obviously assumes you've checked it in at some point.
Under Visual Studio you have several levels of Copy / Paste, so you could have retrieved it by pressing CtrlAltIns (if I remember well).
If you still haven't closed Visual Studio, it might still be in your Copy / Paste ring, it might be worth giving it a try.
Otherwise, you can always rollback to a previous check-in state in your TFS server (if you checked in the code you want before you deleted it).
First, check-in your current state to the server. Then rollback to the previous version that had your code (right click your solution, then Source Control -> Get Specific Version). Now copy your code in a side editor. Re-go to the latest version (Get latest Version... on your solution). Now re-paste your code at the right place and you're done.
If CTRL+Z doesn't work inside VS, go to the empty folder of the deleted files and try CTRL+Z there. Has worked for me several times.

How to make VS2010 quietly reload files in editor

I'm using sass for a project. I keep the CSS file open sometimes, but every time I save the .scss file VS asks me if I want to reload the CSS file, which I do. Is there any way of telling it to always reload the file type without prompting?
In Tools/Options, navigate to Documents and check "Auto-Load changes, if saved."
EDIT: note that this will affect all files; as far as I know it's not possible to enable this selectively. I'm sure an extension could change that!

Visual Studio, how to add a project, but not save changes to the original project?

I want to add a project to a solution and make changes to it, but I don't want those changes to be saved to the original project (the changes will NEVER be needed again). How do I do this?
I assume you mean you don't want the changes to the original solution to be saved.
I would simply take a backup of the solution file, and put it back again afterwards. If your solution is in source control, simply revert it.
You could try making the solution file read-only, but I suspect that Visual Studio will complain.

How do I make a graphical asset in Visual Studio update?

I'm working on an XNA project and modify a graphical asset outside of Visual Studio. In order for those changes to show up in the application, I need to remove the reference to the original image, and then re-add the same image to see the changes. This happens whether I do a complete rebuild or not. Is there a way to streamline this process so that my project shows the changes I've made without having to remove the content reference and then re-adding it after each change.
XNA is pretty smart, and only wants to re-run assets through the content pipeline when it detects something has changed. For some reason it isn't seeing the changes you are making.
Make sure you are modifying the correct file. For example if your original image is at c:\myImage.png and your project is as c:\myGame when you add the image to the Content Project it gets copied to c:\myGame\myGameContent. Editing the image at c:\myImage.png wont get noticed. You need to edit c:\myGame\myGameContent\myImage.png
If you are editing the correct file and it still won't update, try touching another file. As smart as the engine is, it will run everything through the Content Pipeline when it detects 1 item has changed.* If that still doesn't work If you look at the top of the Solution Explorer there is a refresh button. Try pressing it as it should make sure your Solution Tree is in sync with the files on disk.
*note this is true for v3.1 it could have changed for 4.0
When you drag an item into a Visual Studio project (like, in this case, a Content Project), it will copy the file into the project directory. By default it does not reference the file you drag in (although that is available as an option).
(If the file you drag in is already in the project directory, it just leaves it there.)
The upshot of this is that you need to work on your content files in the content project directory, if you want to see your updates happen immediately.
If you don't know where the files are being copied to, select one of them in your content project and press F4 (properties window). Find the "Full Path" entry. That is where your files are stored.

Resources