Can I use different brace styles in different projects/solutions in VS2008? - visual-studio

I'm working with a couple of open-source projects that use different C# brace styles, and I'd like to configure VS text formatting to use different styles for each project so I can use Ctrl-K-D to reformat source code.
Is there any way I can configure Visual Studio 2008 to load a particular set of text formatting preferences along with a particular solution file?

As far as i know, there is no way to do this natively in VS 2008 (or even 2010 for that matter)
There is a resetsettings command line switch in Visual Studio which you can use to indicate what settings it should start up with. This works in 2005 and i presume it would with 2008 as well though i have personally not tried it with 2008. If you just make a bat file using this method as indicated here, that might be one workaround to your problem.
Also, there is an option to do a macro based solutions that might help you that i remember looking at in the past.You can probably check out this site which indicates how to do something very similar to what you are looking for

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

Enabling opening and closing tag guidelines in Visual Studio

I've recently started using Visual Studio quite heavily since starting to develop in .Net
I really like the intellisense as it increases my productivity by allowing me to code faster. Previously when authoring CSS I would just use Notepad ++ and I got very used to some of the little features that this awesome text editor possessed however, now that I am doing the bulk of my work in Visual Studio 2013 I want to try and avoid having too many environments open at once. With this in mind, there is one feature inparticular that I would like to try and replicate in Visual Studio when editing CSS or indeed any other type of code.
In Notepad ++ it automatically includes a sort of guideline which runs down the page between the opening and closing tags of elements as shown below:
My question is, how do I replicate this behaviour in Visual Studio 2013 as the currently setup I have at the moment isn't as clear/productive as you can see below:
Any help would be greatly appreciated.
There are a couple of free extensions you can use to do this. These will run on any of the Visual Studio versions except Express, which does not support extensions.
You can duplicate this with the Indent Guides extension.
You can also use the Structure Visualizer Feature of the Productivity Power Tools.
Note: The backgrounds in the example are different because they are taken on different machines with different themes.

Can I disable all compilation in Visual Studio?

This is a new one for me. I have been asked, for legal reasons, to setup a laptop with Visual Studio, but to disable the ability to compile projects/solutions. The purpose is to enable browsing of the source code, but not allow building or executing it.
Yes, I know this is really a stupid question and unfortunately I can't get into too many details. I've asked about using alternative text editors, but I have been told no. So until I can prove it isn't possible (or that I have at least made a reasonable effort), I have to try and make this work. Notepad++ would be an excellent alternative, but that has been rejected.
This would be in Visual Studio 2010 or later. Is there any way that I can do this?
UPDATE
After trying Marius Bancila's suggestion of removing the compilers and MSBuild, I was surprised to find out that VS continued to work fine (except for building, of course). I did not expect that functionality like F12 (Go To Definition) would continue to work.
This may mean that there still remains the ability to build something somewhere somehow. But as it stands with MSBuild permanently deleted and the Visual Studio Build command not working, it'll take some effort to get around it (if a way in fact does exist).
You didn't say what projects should not be possible to build (VC++, VC#, VB.NET, F#, etc.). Starting with VS2010 they are all built using MSBuild. So if you delete MSBuild they will not be able to build from inside Visual Studio. However, one can still be able to build from the command line, so the only possibility I see is that you delete all the compilers that come with Visual Studio.
It's a little bit crazy, but if you really have to ...
Try deleting some important binaries after installing Visual Studio e.g. linker (link.exe) and compiler (cl.exe).
Use a text editor instead. Notepad++ even comes with color syntax highlighting.
You cannot prevent people from compiling the code. Visual Studio Express is available to anyone, and the compiler can be executed from the command line, without Visual Studio's help.

Visual studio autoexp.dat alternative?

Custom debug visualization in visual studio:
Is there any way to do it per project instead of editing the "global" autoexp.dat?
Would be nice if it tagged along when changing workstation..
No: per-project (or per-user) visualizers in Visual Studio 2010 (C++ native) are not possible. Visual Studio 2012 added this feature; it is based on "natvis" XML files.
Rather old question, but lets give my cent:
For VS2008 SP1 and VS2010 you have the alternative to use your custom file, instead of invasively edit the native autoexp.dat file using the _vcee_autoexp environment variable.
Credit to: https://vtk.org/Wiki/ITK/Debug_Visualizers_for_Visual_Studio
Note: I have not tried, but maybe using a relative path VS loads it based on the solution folder. Alternatively I would also try using multiple path separated with semicolons. Just give it a try.

Syntax coloring for VBS file in Visual Studio with a different extension

A program we work with in my office can be automated through VBScript Files, yet the files are saved with an extension *.RVB other then *.VBS. I'd like to use Visual Studio as my editor/debugger, which is working. Yet it is not coloring the code like it does if I have a *.VBS file open.
Under Tools->Options->File Extension I added "RVB" and set it's editor to Microsoft Visual Basic, yet it is still not applying any syntax highlighting to my file. What am I missing?
I realize this might be beyond what you had in mind. However, I see no acknowledgement to your solution so I am going out on a limb here. You could create a language extension and totally control all aspects of the coloring. This is easily transfered to 2010 (the example is in 2008) but remains relevant.
http://msdn.microsoft.com/en-us/vstudio/bb851701
In this video, Hilton Giesenow illustrates a simple working Language Service. He begins by building a simple scanner colorizingsing based on regular expressions, then expands on this to implement the Managed Babel framework, integrating MPLex and MPPG directly into the Visual Studio build as well.

Resources