Code Cleanup option isn't available in .Designer files. Is there any option to enable this feature?
Remove the *.Designer.cs and/or *Designer.vb option from the Generated file masks area in ReSharper > Options > Code Inspection > Generated Code.
Be careful with cleaning them up, though, as in some cases doing so might render the code uncompilable.
Why do you need this, you are often examining code withing .designer files? I believe the main reason is the fact that these file are regenerated every time you make change and save the control, page etc.
Related
this debugging option: Require source files to exactly match the original version
This is from MSDN:
Tells the debugger to verify that a source file matches the version of the source code used to build the executable you are debugging. If the version does not match, you will be prompted to find matching source. If matching source is not found, the source code will not be displayed during debugging.
But still I do not understand it! So is it better to select it or unselect it?
Situation:
You have loaded in your editor a version of a file which is different than the one compiled into the executable you are debugging.
If the option is selected, and you try to debug code in that file, you will be prompted to find the right one, or else you will not be able to step into or break on any of that file's functions. (I think the pop-up dialog also allows you to select "use this version anyway").
If the option is not selected, you will see your version of the file. However, the code you see may be very different from the code that is executing. The breakpoint will be displayed on the line number matching the old file. It may show up in a blank line, or a comment, or some other function entirely.
In general, you should select it, so that you know that what you are seeing is what you are running.
I would leave the option selected.
Consider the following situation:
Build some code
Make a change to a source file
Start debugging
Now when you are debugging, the source file no longer matches what was used during compilation. This might leave you with breakpoints or line numbers that no longer match what's actually happening in the debugger.
If there is some reason why you want to see your local code instead, deselect the option.
try to rebuild the whole solution instead of just rebuild the project and keep ...this worked for me.
Try to see if your files are not read only!!!
old code some times have this tricks
To change this please do as follows :
Tools -> Options -> Debugging -> Require source files to exactly match the original version
You can change it from here.
Another is :
Tools -> Options -> Debugging -> Enable Edit and Continue (with all its children checked)
This option works only in debugging mode and is helpful thing
I use the code reformatting tool in ReSharper to get some standard format on my code, but I don't like that it moves methods around.
For instance if I rename a method, and then reformat, the method is moved. This makes merging changes between branches a nightmare.
Is there any setting I have missed that will disable this particular part of the reformatting?
Set up a custom R# profile
Click Resharper > Tools > Code Cleanup
Then choose "Edit profiles", add a new profile, deselect what you don't want and save it.
Run this profile in the future
You should modify the Type Members Layout xml for that. In that file you have several patterns which you can reorder or delete to get the behaviour you want. All the changes you make in that file will be reflected in the following file:
C:\Documents and Settings\user\Program Data\JetBrains\ReSharper\v4.5\vs8.0\UserSettings.xml
so you can make a backup before playing with it or add it to your source code tree.
I have a command-line tool that I run as a post-build event. The tool does some analysis on the code in my project and generates a text file as its output.
I'd like to take the text file generated by the tool and add its contents to my project's Error List window as a set of warnings.
Is this possible or do I need to write my own VS extension to make it happen?
It sounds like you're looking for a tool which will read a text file from disk and translate it into items in the Errors and Warnings dialog. If so no unfortunately that tool does not currently exist.
However it shouldn't be that difficult to add. There are several samples out there for adding items to the Errors window would could be applied to this scenario
http://www.mztools.com/articles/2008/MZ2008022.aspx
I have a Visual Studio 2008 project where some code files are generated with each build (a parser, integrated via MSBuild aka editing the *.csproj file).
VS does not know about the generated nature of these files (i.e. they are not the result of a "Custom Tool). So they "change" with every build, naturally. And VS2008 asks me after every build if I would like to reload those files:
This file has been modified outside the source
Do you want to reload it?
That would be ok if I had one of those files opened and in front of me, but I get these modal dialogs even with none of the code files opened.
So my question is: Is there a way to disable this dialog, per project, per solution or globally?
Thanks!
For VS2008: Tools > Options > Documents > Detect when a file is changed outside the environment
For VS2010/2012/2013/2015: Tools > Options > Environment > Documents > Detect when a file is changed outside the environment
In Visual Studio Pro 2012
There is an "Auto-Load changes, if saved" that works.
Tools > Options > Environment > Documents > Detect when a file is changed > Auto-Load changes, if saved
Because a picture paints a thousand words...
I generate source files on every build, and I don't (normally) get a "file has been modified" message if the file is not open in the editor.
I was getting it just now, however, on a closed file. (That's why I went searching for this question.)
I think that's a bug. The file seems to get wedged sometimes. (But this is the first time it has happened in about a year.)
I think I've found a work-around just now: Open the offending file and then close it again.
The point is, you shouldn't need to turn off changed file detection.
This is an old post, but what worked for me was slightly different and I wanted to share:
This file has been modified outside the source
Go to Tools -> Options -> Debugging -> General and uncheck "Require source files to exactly match the original version". This allows you to use source code which is not the same as original version.
Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping many files open as I am working on them, so next time I open the project, it (very slowly) loads up a bunch of files into the editor that I may not even need open. I have searched through the settings and cannot find anything to stop this behavior.
Simply delete the .suo file.
It contains the list of open files.
A bit of research turns up the fact that you can do it with a macro:
Create a new macro (or use an existing one). You should see a module called EnvironmentEvents in Macro Explorer. (For details, see here.)
Open the EnvironmentEvents module.
Put in this code:
Public Sub CloseDocsOnExit() Handles SolutionEvents.BeforeClosing
DTE.ExecuteCommand("Window.CloseAllDocuments")
End Sub
Save and Build the macro.
Open a whole bunch of documents in your solution, then close Visual Studio.
Yay! No more open documents!
(Note: Despite that it says SolutionEvents, it also works if you're working on a project that doesn't have a solution.)
I never realized how much that annoyed me as well! I haven't been able to find a setting, but in Options > Environment > Keyboard you can bind a shortcut to Window.CloseAllDocuments. ALT+X was unbound for me so I just used that. I'm interested if there's some hidden setting to automatically do this on solution exit though (or load).
Edit: Totally read the question wrong at first - ignore my first (now gone) answer. :)
I changed the keyboard mapping for CTRL-SHIFT-C from bringing up the Class View to closing all document windows - something I use several orders of magnitude more often - and then I just clear my workspace before closing a solution.
Try the following:
Close the program after closing all files.
Make a copy of [whatever].suo
Open the solution again, open some files, and exit.
Copy (don't move) the old .suo file over the one that was just generated.
Make the .suo file read only.
If you have a repository you might want to check that file in.
I suggest this because I was having the reverse problem, where it wasn't opening my old files automatically, and the cause was a .suo file that had been checked into the repository and was (for some reason) not being overwritten by Studio. The file wasn't even write protected.
I was hoping for something a little more automatic. VS will create a new .suo file every time the project is saved. So I would have to delete that file every time I open the project. I also don't want to have to remember to close all the files before closing VS.
Other IDEs that I have used have similar functionality, but also make it rather simple to turn on/off.
Thanks for your help.
Or you can close all open document from the Window menu before closing VS.
In Visual Studio 6.0 (VC++), the procedure is slightly different.
Delete the .ncb file (located normally in the same place as your .dsp or .dsw files).
The only way works for me is : change the project location and again reopen the solutions form there. :)