Prevent comment conflicts in strings.resx (Visual Studio 2010) - visual-studio-2010

Suppose an international team of developers, using various flavors of Visual Studio 2010 (understand: in different languages), and working on a versioned project.
Every time one of them makes a modification on the Strings.resx, Visual Studio happily generates the file with localized comments. Every time two or more of them do so at the same time, some pretty annoying conflicts appear, which not only are time consuming, but also are completely pointless. Developers get angry and all.
How can this be prevented? Is there a way to tell Visual Studio not to regenerate those comments, or to drop them altogether?

I don't know how to prevent Visual Studio generating localized comments in the .Designer.cs file which backs every .resx file. And I'd certainly like to know.
Until someone finds out, you'll have to setup Visual Studio in English (or whatever language is shared by most of your team) everytime you want to change the resources.
You can do that in Tools > Options > Environment > International Settings (you need to restart VS).
When programming, I don't mind setting up everything in english, rather than in my native tongue, because exceptions and error messages are almost always easier to google when they are in english.
HTH

Related

Turn off formatting for T4 template generated code in VS2017

I've been running into an issue with Visual Studio 2017 where a T4 template that is generating a bunch of C# classes from metadata is auto formatting the files based on the settings in Visual Studio's C# formatting options. I have changed these options and verified that the changes are reflected in the generated code. Basically what is happening is the T4 code generation completes and then Visual Studio begins to open every single file that was just generated and format it.
I've turned off formatting for the C# language in Tools and Options and disabled .editorconfig files just in case it was picking up one of those, but the template generation seems to ignore this. The problem is that these T4 templates generate ~2000 files which are then formatted which causes TFS to check out the file and eventually crashes visual studio about halfway through the formatting. Is there an option somewhere I'm missing to turn off formatting for generated code? This was not an issue prior to our recent upgrade to VS2017.
The default setting for Visual Studio 2017 is that it doesn't do anything to template files on the onset, so in order for this to happen it should be something you've added to your VS environment. Few things to check...
Any Visual Studio extensions or features. T4 is not well supported so a lot of the extensions and features out there have bugs in them. It maybe that the software provider hasn't thought of your problem yet and you should raise a bug with them. If your using an extension or feature to assist in your software development of T4 then try a different one. Additionally extensions or features not related to T4 also format files. An examples are Productivity Power Tools or Resharper
Under the properties of your template files check the Custom Tool value. It may not seem like the obvious choice, but occasionally if this is not set to TextTemplatingFileGenerator or TextTemplatingFilePreprocessor, you need know why it's not set that way. There might be a perfectly good reason for why its set differently, just so long as you know what that reason is
Normally templates use the *.tt extension, however there are many different acceptable extensions that suit different occasions. Make sure the extension isn't named the same as an existing extension, that formats files in its own way
If the features for C# are off, you might want to consider turning off all formatting features one by one incase the templates files are being considered as part of a different language or under a different option. Start with Tools > Options > Text Editor > Basic > Advanced > Pretty listing as an example. That may give you a clue as to where the setting is being affected.
HTH

Stop Visual Studio 2010 from auto removing files from solution

I have a big solution (50+ projects, mixed C++, C++/CLI, C#) plus a number of support files (many are python files) in solution folders. From time to time, for no apparent reasons, Visual Studio removes references to one or more python file from the solution. It's easy to revert via the version control system, but gets annoying over time if you have to do this several times a week.
Anyone knows how to prevent Visual Studio from doing this?

Accessing the VS2010 version of the Microsoft.VisualStudio.VCProjectEngine assembly in VS2012

My company recently created a Visual Studio 2010 add-in that allows us to create LINT files from any given visual studio project from 2010, 2008 and 2005. We now want to get this same add-in to work in Visual Studio 2012, because we know that many of our customers will be using this in the near future, if not already.
We thought that it should be a simple "switch-in", and that the same code should work for both, but lo and behold, the VS10 add-in didn't work in VS12. So I copied the code (absolutely no changes) into a VS12 add-in, and surprise surpise, it did work. Naturally, we do not want to have two versions of the same code; bad for readability, bad for maintainability, so we still want to find a way to get the VS10 add-in to work in VS12.
I think the problem lies in the Microsoft.VisualStudio.VCProjectEngine assembly. This is interpreted differently in VS12 to how it was in VS10, meaning that when VS12 reads the add-in, it doesn't do what we want it to do.
I have done some research into this problem, and many people suggest creating a work around by using reflection, but I am reasonably new to this concept and don't feel confident enough to try it and risk seriously ruining the add-in.
So my question is this: Is there a nice and easy way of being able to read the VS10 version of the Microsoft.VisualStudio.VCProjectEngine into VS12?
Much appreciated :)
I later found an answer to this question and realised it hadn't been confirmed on the thread.
The answer indeed lies in the VCProjectEngine assembly. For some reason, this is a different module in Visual Studio 2010 to the module (with the same name) in Visual Studio 2012, which means any code requiring the module when written in VS2012 will not work in VS2010 and visa-versa.
It's a pain, because it means we have two lots of exactly the same code, but that is the way it has to be.

Perform a search in Visual Studio only on files that have been recently modified

I was wondering if there is a way for Visual Studio's built-in search to only look in files that have been modified in a certain time frame.
I think it would be very convenient, especially when working with a large codebase where you don't really need to search for certain things in ancient code (or even code older than, say a month, even a week).
No. Not in Visual Studio 2010. Also not in Visual Studio 2012 (which includes the Quick Find feature from the Productivity Power Tools extension.)
You'll probably need to make do with Windows Search or a third party tool like Agent Ransack.

Disabling Team Foundation Server extensions in VS2010

We're using Visual Studio 2010 (Premium edition if it matters), and pretty happy with it. However, We're never going to use the TFS features that's included in the IDE. (We're using Jira and Subversion, as it's not just Visual Studio that we work with, but also IntelliJ and a couple other IDE's.)
Is there any way to disable the TFS portions of the IDE? It's not a big deal or anything, just for the sake of "keeping things neat."
In Visual Studio 2010, go to Tools->Options In the list, select Source Control. Set your Current source control plug-in: to None
The main "TFS" parts of the IDE are in Team Explorer - Just don't install it.
Anything else you don't want/use, I'd advise you to simply ignore - VS has support for hundreds or even thousands of different things that you will probably never use, and you can't easily "clean" them all away.
In my experience the more you alter your installation of Visual Studio the more problems you will have with it. Every custom Option you set is another thing you have to repeatedly set every time you get a new PC or install a new VS. (Although it has improved a lot since import/export options became available and reliable). I used to spend about half a day setting up a visual studio to "work well", and now I just install it and use it. Ultimately I found that it was easier to just adjust my working practices (e.g. by relearning a few keyboard shortcuts etc) than to try to bend VS to my will.

Resources