How to write Visual Studio Converter - visual-studio

I would like to write a Converter (usable over File -> Open -> Convert...) so that I can convert build information in non-VS format into a VS-Solution.
Now I could not yet find where in the Extension I can actually create a Converter.
Is there any documentation about all the ways how to extend the VS-UI with the Visual Studio SDK?

It's not documented IMHO (at least I can't find it anywhere). It's based on the content of a file called convert.dir located in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE (for Visual Studio 2010). This file may not exist or its size may be 0.
When defined, it contains a list of lines, each line corresponding to a converter. The line format is 5 values separated by the '|' character, like this;
relative path to .vsz|relative icon path|localized name|localized description|priority
The .vsz file is a standard Visual Studio wizard file.
How to provide a converter that shows up in Convert dialog
In addition, here is a sample about VSProjectConverter for your reference.
https://github.com/ssvaidya/VSProjectConverter

Related

Remove Whitespace Before Committing Files to TFS

Visual Studio gives us this great ability to completely customize our work environment, including how we wish to format whitespace. I am very particular about how and where I want tabs, spaces, braces, etc. to appear.
For instance, I prefer tabs to be inserted as tabs not spaces. I also prefer the indentation (Tab size/Indent size) to only be 2 spaces (frankly I don't need 4 spaces to see that the line has been indented).
This is all well and good until I work collaboratively. Everyone else I work with just seem to use the defaults for whitespace/formatting. This causes problems when using source control like TFS. If you compare files worked on by me and then a co-worker, the changes in whitespace also show up. I don't want to see these changes; they're not significant.
Please don't tell me the answer is that the entire team should use the same settings. This isn't the correct answer. That answer is a cop-out for bad design. Why have the ability to customize your environment if everyone is forced to use the same settings?
Why doesn't TFS (or any other source control) remove unnecessary whitespace before committing a file based upon the file type? This has several benefits. One, the storage required to hold the file is less. Two, the transmission of the file to the source control server should be more efficient since the file is smaller (these first two benefits are probably negligible since the files are probably compressed anyway). Three, and most importantly, TFS (or any source control) will no longer report changes in whitespace when doing a file diff.
When I view/edit the file in my environment, it will be reformatted how I've defined it. When someone else views/edits the file, it will be reformatted to their specification.
Is there a way to do this currently in TFS?
Although what you said about is very reasonable, I still want to say the best solution is to get the entire team to use the same standards for white space in code. After all, you are teams.
If you insist on it, below is a workaround that to this problem (only works on your local machine).
In Visual Studio, select Tools / Options / Source Control / Visual Studio Team Foundation System and click the Configure User Tools button.
In the dialog, Add an item with the following settings.
Extension : .*
Operation : Compare
Command : C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe
Arguments : %1 %2 %6 %7 %5 /ignorespace
Depending on your Visual Studio version and instalation path (x64/x86), the command option may be...
VS2010: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\diffmerge.exe
VS2012: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\diffmerge.exe
VS2013: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsDiffMerge.exe
VS2015: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\vsDiffMerge.exe
In the argument option leave it with the same number of arguments as the VS suggests and just add /ignorespace in the end. For example, in the VS2015 it will be:
%1 %2 /ignorespace
More details you can refer this blog: Configure Diff to Show Whitespace
You could also use another alternative. WinMerge is. It also has an option to ignore whitespace (menu Edit -> Options -> Compare -> Ignore all (under the groupbox "Whitespace" at the top)).
How to use WinMerge with TFS you can refer:
Using WinMerge with Team Foundation Server (TFS)
Using WinMerge as the default diff/merge tool in Visual Studio
2012/2013

Visual Studio: Defining File Type Regardless of File Extension

Where to define, what kind of type a particular file within Visual Studio solution is?
I have observed that file extensions do not necessarily have to relate to the actual file types within VS.(observed within Visual Studio 2010, 2012).
For example: I have an existing Visual Studio solution. In another tool, I have created an HTML file with .html extension. After importing it into Visual Studio solution, the file does not gain HTML Intellisense and Code Completion.
On the other hand, I can create an HTML file within Visual Studio through: Visual Studio -> FILE -> New File -> HTML Page
This file will gain all its HTML related Code Highlight, Intellisense, and Code Completion features. I can then rename its extension to, say, .txt. The file will still keep its HTML properties such as code highlight, intellisense, etc..
My question therefore is, where can I define/change, what kind of file type (HTML, CSS, JavaScript) the particular file is, regardless of its extension? This is important, to be able to assign appropriate Intellisense, Code Highlight, Code Completion features.

Custom syntax highlighting in Visual Studio 2010 in a html file

Is it possible to create syntax highlighting for custom defined words in known file type?
For example I want to have VS text editor color the tags <# and #> a specified color when viewed in a html file.
Can you do this, and if so then how is it possible?
Yes, well, certainly this is possible for C++ files and files that Visual Studio recognises; so if VS is set up to recognise your HTML as C++ files you should be good.
You will need to create a usertype.dat file and place it in your
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
folder (or equivalent for VS2010, this is for VS2008)
This file should have the keywords you want listed separately on each line;
for example; I develop with Qt and I have a usertype.dat file as:
signal
slots
Q_OBJECT
(and so on)
Restart VS and your keywords will be highlighted.
I got the info from here and verified it on my system.

visual studio 2010 Character encoding

After creating a batch file in visual studio, I get an error when I run it about invalid characters. Does anyone know the default character encoding for txt files?
The default encoding for a text file in Visual Studio 2010 is UTF-8.
Therefore if you need to use ANSI I would recommend created the file outside of VS and then drag it to the project or add existing file to get it in the project. From their VS will respect the file encoding.

Automatically adding specified text at beginning of files in VS 2008

Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.
I assume you'd like to modify the class file templates. They're in:
%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
More specific details here
I found a better solution than modifying the template file directly. This utility allows you to create and save header/footer templates and apply them to entire source trees.
C# Header Designer from MSDN Code Gallery

Resources