Is there a way to make a property for a vcxproj in the Property Pages not be bolded using Visual Studio 2013? - c++

I know that when a property appears bold in Property Pages it indicates that it has been modified.
https://msdn.microsoft.com/en-us/library/675f1588.aspx
I have an API that we ship samples with, and I want all of the settings across all of them to be consistent and the same.
Unfortunately, some sample vcxprojs appear to have the right setting and are not bolded, while others somehow had a wrong setting and after changing it to the right one, it's obviously still bold.
I want all of the samples Property Pages to be consistent across all of the samples, even the bolding of text. I realize this is really just an OCD cosmetic type of an issue, and there is no technical problem behind it.

The .vcxproj file is just an XML file. I'm assuming that bold means that there is a setting specified in the file, even if it's the default.
So: edit the file in a normal text editor. Remove the setting, so that it uses the default value, and so that it no longer appears in bold in Visual Studio.

Related

Visual Studio 2019 - open files with specific encoding (e.g. 437)

I got some legacy projects, with a source code encoding of IBM437/CP437. They need to be encoded that way at the moment, so please refrain from recommending a switch to utf-8.
So far I have unfortunately not found exactly what I need.
I experimented a lot and searched for several hours, yet my best workaround is the following:
While having the project opened in solution explorer, right click -> open with -> C++ Source Code Editor (with encoding).
In this huge dropdown I can choose the file encoding I need OEM United States - Codepage 437.
This is exactly what I need, but preferably automatic / persistent.
In the "Open With" window, the "C++ Source Code Editor (with encoding)" can also be set as default. This is a step in the right direction already, yet not at the right destination! With this setting, every time I open one of the files, I still need to use the dropdown and select the correct codepage every single time!
If anyone have anidea how to get this to work automatically, this would be great!
Most of the search results are about saving files in specific codepages, rather than opening them.
I tried playing around with .EditorConfig, yet it seems to support only like 5 codepages.
Also looked into the VS extensions and tried some. The FileEncoding extension looked promising, but it seems to just use .EditorConfig below the surface, since it's limited to the same few codepages.
Side note: I would even be perfectly fine with my Visual Studio opening all files in this codepage (for editor). So if someone knows a hack in that direction, it would be good too.
For example if I change the whole system codepage via registry keys:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP=437 (this is usually default for Western Europe)
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP=437 (ANSII Code Page)
It might work too, yet it's super dirty and system wide. Therefore I would rather live with the manual selection every time...
Also I could live with a shortcut, switching to the desired codepage. I used this approad in notepad++ for quite some time and got used to it. There I had a shortcut, e.g. ALT+X, switching to OEM US.
To summarize this up:
My perfect solution would be similar to the Open With -> C++ Source Code Editor (with encoding) workaround, but without having to select the codepage every single time!

P4VS code lens integration shows all file-level changes for each function

(I've looked far and wide but I can't even find anyone having the same problem, not to mention a fix or anything. Closest is this thread which just announces the feature...)
The way it currently works for me, the VS2019 code lens integration of P4VS (for C++ at least) is almost completely pointless. Each function has an indicator added, but the information in each is identical - namely the change history of the entire file:
According to this Microsoft article, I would expect to either get function-level change information that pertains only to that function or a single change summary of the file at the bottom of the editor. But instead I get the worst combination of both.
I'm mainly surprised that I can't find anyone else talking about this, so I assume something is misconfigured on my part. Can't find anything in the configuration options though...
Is this just a bad implementation by Perforce or is something wrong on my end?
I have just found out that it can be turned off by Visual Studio options.
How to turn off CodeLens-References
Text Editor > All Languagues > CodeLens

msbuild - tag propertygroup has attribute Label but not documented

I need to manually modify my .vcxproj and I'm trying to understand the MSbuild schema using the documentation.
In my existing .vcxproj, I have the tag <PropertyGroup Label="Globals"> but in the documentation there is no mention of the Label attribute.
This is for an existing Visual Studio C++ project and there's no error when I launch it.
What does the Label attribute do?
It is nowhere fully documented; the Target element documentation mentions it, but it has just
Optional attribute.
An identifier that can identify or order system and user elements.
A quick glance at the source code also reveals it is not actively used by the build system itself: it's just there, you can assign values to it and get them back, that's it. As such it can serve as a means of adding a description to the xml (instead of using a comment). This description can also be retrieved programmatically by the build system. Which is the only use I have actually seen by a tool, namely Visual Studio: as you figured it generates project files which contains some labels. VS uses these to determine where to find/insert code produced by it's user interface. Good example is the PropertySheets label: it's just an ImportGroup, you can have an arbitrary amount of those, but only the ImportGroup with the label PropertySheets will be displayed and modified by the Property Manager in VS. Likewise for the ProjectConfigurations ItemGroup, the Globals PropertyGroup, the Configuration Items etc.

How do you change your app icon in visual studio 2013?

I'm new to visual studios and I just created this very short calculator and I want to put it on mediafire for people to download but I wanted to change the icon..
I've heard that you select your app in solution explorer and Project>Properties
But my properties menu seems different.
It saids calculator property pages.
It doesnt have the tabs like ~Publish~ or ~Applications~ where people said you change your icon.
My properties is like this:
Configuration: Active(Debug)
and some other stuff below it some complicated stuff(to me)
Why doesnt mine have what other people have? I just want to share my first ever app with a custom icon. Help please, will appreciate it.
Create a text file, rename it res.rc, edit it to contain the line:
201 ICON "myicon.ico"
Add that file to your project. The file myicon.ico must exists.
Note: This is a bit hacky, the numerical vaulues should preferably be defined in a header.
You might be confused because Visual Studio supports different languages, and its UI is not consistent across those languages. Since you tagged it C++, the "old" rules apply. An application icon is a so-called resource.
You have to provide an .ico file, and reference it in a .rc file. The resource compiler (RC) compiles it into a .res file, and the linker then adds it to the EXE.
In C++, if you open the form in designer view, the properties window has an icon property that will allow you to browse for the icon of your choice.
Just for reference, i spent two hours trying to change it without any success until i resized the icon, it should be 32x32 and another one for small icon -not sure if its necessary though- with 16x16.
visual studio creates two icons when create the project , one is called small.ico and one is name yourexe.ico, just replace those and make sure to have correct sizes.

Is there a way to prevent a "keyword" from being syntax highlited in MS Visual Studio

MS Visual Studio editor highlights some non-keyword identifiers as keywords
in C++ files. Particularly "event" and "array" are treated as keywords.
That's very annoying to me, because they are not C++ keywords.
I know how to add my own keywords to the list of syntax-highlighted identifiers,
but how to remove existing built-in ones?
I'm aware that this may require patching some executable files.
So does anyone know how to do this?
Thanks to article mentioned by Steve Guidi, I was able to find executable file that contains Colorizer and IScanner classes. It is named vcpkg.dll and located in /Microsoft Visual Studio 8/VC/vcpackages. (I'm using Visual C++ 2005 Express Edition, things may be different in other versions.)
The vcpkg.dll contains null-terminated UTF-16 encoded strings. I've opened it with hex editor, and searched for "array". There is only one such string in the file, so I've replaced it with "arrry". (It is important to maintain relative alphabetical order with respect to other keywords.) Then I've searched for "event", it shows up in several places, but there is only one that isn't part of some longer string, so I've replaced this one with "evvvt". After starting Visual Studio, it turned out that "array" and "event" weren't any longer highlighted, but "arrry" and "evvvt" were!
Of course this is an ugly hack, and it will void your warranty,
and probably goes against Microsoft EULA, but what a relief for the eyes!
Anyway, if you want to do it, be careful and remember to backup the file.
It doesn't look like a disable-syntax-coloring feature is exposed in a user-friendly way.
The only way I can think of selectively disabling syntax coloring is to create a new syntax coloring plugin for the IDE, and list all of the keywords you want colored. Microsoft gives information in this article on how to accomplish this task.
The drawback to this approach is that your IDE will now have two C++ languages and I'm not sure how it will select which plug-in to choose from once it loads a .h or .cpp file. However, this article suggests that you can override the existing C++ plug-ins by rewriting some registry keys.
I think the only "semi-practical" way to accomplish this to create a Visual Studio package that uses Text Markers to selectively cover up the keywords you don't want colored. Even that is not a little one-day task. Edit: Probably not even a full week task for someone not intricately familiar with the Visual Studio API and all its quirks, especially not getting it bug-free.
In other words, you probably want to just ignore them.