visual studio 2010 Character encoding - visual-studio

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.

Related

How to write Visual Studio Converter

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

TypeScript garbled characters with Visual Studio

I've used Sublime Text and WebStorm, and now I am trying to use Visual Studio to code TypeScript.
But characters garble in new project as below:
Source code:
タグ
Evaluated string:
\u30BF\u30B0
I've never met this problem before start using Visual Studio. Why? What is different from Sublime Text and WebStorm?
Due to a missing BOM header (http://en.wikipedia.org/wiki/Byte_order_mark). Go to advanced save options :
And save as UTF8.

Replace tabs with spaces in Visual Studio project files (sln & vcproj)

I'm trying to have a strict no-tab policy at my company by adding blockers on commits which introduce tabs.
Problem is visual studio uses tabs for their .sln & .vcproj files even when your settings are set to use spaces instead of tabs in the VS editor.
Anyone know how I can change that or am I stuck making another microsoft exception?
For your information, spaces are supported in vcxproj but not in sln files. Replacing tabs by spaces in .sln will make it load incorrectly (not generate exceptions or anything).
There are no settings in visual studio itself to change that though.
There are scripts that can do it before submitting in a source control but keep in mind that .sln files must keep the tabs to work correctly.
This is fixed in Visual Studio 2019.

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.

Diffing web.config is hard, any way to prevent IIS Manager from formatting Web.config differently than Visual Studio's format?

this drives me crazy.
Visual Studio does not format Web.config the same way than IIS Manager, which prevent easy diffing of different versions or the same file editing in both tools.
When Visual Studio edits a Web.config thru a wizard (like adding a reference) or when you click on Edit\Format Document (Ctrl+K, Ctrl+D), Visual Studio formats the XML in a beautiful way.
Unfortunately, if you change a value in IIS, it will reformat it with a different style.
Do you know any workaround?
no matter how ugly the xml is inside a file, when you open the file with visual studio press control k and then control d and it will format the XML for you instantly.

Resources