Auto disable specific extension when launch visual studio? - visual-studio

I want to configure different extensions for different projects, for example, enable visual assist for c++ projects, but disable it for c# projects.
I try to export two vssetting files, and run "devenv.exe /Resetting 1.vssetting" or "devenv.exe /Resetting 2.vssetting", but it fails to retain extensions status.
Any one helps me? Thanks very much

One hacky method is to modify the ExtensionManager\EnabledExtensions list in the registry. For example, for Visual Assist in VS 2015 its registry entry is like this (name is a fixed guid plus version number, path is random):
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\ExtensionManager\EnabledExtensions]
"44630d46-96b5-488c-8df926e21db8c1a3,10.9.2102.0"="C:\\Users\\sv\\AppData\\Local\\Microsoft\\VisualStudio\\14.0\\Extensions\\w1vivolz.4tz\\"
If you remove this entry, Visual Assist becomes disabled. Put it back and it is enabled again.

Related

Visual Studio 2015 Find in Files not remembering file types or locations

I rely on the Find in Files dialog in Visual Studio a great deal. (Sometimes Intellisense/Resharper just don't cut it.) Since upgrading to 2015, I've noticed that the dialog doesn't remember my custom "Look in" paths or "Look at these file types" lists between sessions.
If I close my solution and VS instance, then reopen, I have to enter my custom path and file types again. Huge waste of time. Has anyone run else run into this? Any workaround? 2013 used to remember this stuff.
Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081
Installed Version: Professional
I've never had any problems with it not remembering my settings, but I imagine that you could run a custom registry modifier to add the appropriate keys, you could make sure your settings are always pristine. The custom search information is stored in HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\Find.
The file types are stored in a string key called Filter with whatever you would normally input into the custom file type category in the VS search window. For example searching for only .cs and .txt files you would put *.cs;*.txt.
The folders are located in a string key called Query with values such as C:\Folder1;C:\Folder2. However, it's behavior seems a little weird. You have change the value of Query and a Query+integer value (i.e. Query0) to the same value to have it appear in Visual Studio.
If you just run a script to modify the above values to the files types/folder locations you want, that should work.
I ran into this today. After much searching I found a post on the visual studio forums somehow. This pointed me towards ReSharper. This directed me towards a workaround.
Start visual studio in safe mode with the command line argument /SafeMode
Create the folder sets you want for searching
Restart visual studio not in safemode
Once I had restarted all my created custom searches remained, and the registry values were created. This might not work in the specific case, but this worked for me.
You can set these values programmatically inside Visual Studio for the Find and Replace dialog (for example with Visual Commander):
DTE.Find.FilesOfType = "*.txt";
DTE.Find.SearchPath = #"c:\temp";
If you have an earlier version of VS, export the environment settings, copy the NumberOfScopes and NamedScopes* settings from the Environment_UnifiedFind section to the same section in your VS2015 settings file and then re-import settings.
Once I did this, it allowed VS2015 to start saving folder specifications for future settings exports.
Or you could try replacing this in your VS2015 export:
<PropertyValue name="NumberOfScopes">0</PropertyValue>
With this:
<PropertyValue name="NumberOfScopes">1</PropertyValue>
<PropertyValue name="NamedScopes>0">FOLDER_SPEC_NAME>SEMICOLON_SEPARATED_LIST_OF_FOLDERS>{4A812F3C-7B1A-4987-9769-461F20EB25CB}</PropertyValue>
(Don't forget to re-import after you make the change)

Multiple Visual Studio (2012) profiles (addons + settings)

I use Visual Studio 2012 for both C# and C++ development. I also use different extensions depending on the current working project: ReSharper for C# and Visual Assist X for C++.
Is there a way of creating multiple Visual Studio profiles (or installations of the same version) that will use a specific (and different) set of extensions? Currently I have to deactivate/reactivate some manually and it's getting annoying that such a feature doesn't exist (at least something like Eclipse's workspace)
Combine this with different environment setting (e.g.: tabs and spaces settings) for each project and you'll soon get mad. I know we can use different settings files, but it's still annoying to have to re-import a specific .vssettings file each time you open a different project.
Thanks.
Have you considered "Run As" for Visual Studio and use another Windows User Account? That should allow you to disable R# and VisualAssist separately.
There used to be a way to run a Macro to import an exported settings file, but they removed the Macro functionality in VS2012 (sadly). You could write an extension that manages importing different settings I guess.

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.

how to add logic to msi installer

I have a Setup Project in Visual Studio 2010 which creates a .msi installer. I am wondering if it is possible to add some logic to check some conditions. e.g if there is my software installed yet.
Thanks,
This is done through installer properties. You can set them and check them against values. They are just like variables in code.
However, Visual Studio is limited when it comes to custom installation logic. If you don't figure out how to do what you need, give us more details.
As a side note, launching the installer for an already installed product makes it go into maintenance mode (Modify, Repair and Remove options). So you don't need to check if your application is already installed.
You need to add installer class to one of your library or assembly. In Visual Studio, attach installer events to custom action. See how http://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/ or here http://msdn.microsoft.com/en-us/library/d9k65z2d.aspx

Developing multiple Visual Studio 2010 extensions

Im working on a couple of independent Visual Studio extensions in separate solutions. When I open one of them and launch the experimental instance in the debugger, the other extensions from the other solutions (which aren't open) are loaded as well. There must be a way to only launch one extension in the experimental instance at a time (in particular the one you're currently working on), right?
You can actually create as many experimental instances as you like by using different, arbitrary values of the "RootSuffix" parameter (which will create multiple separate base keys in the registry) but I'm not sure how easy it is to configure VSSDK projects (such as VsPackage ones) to publish to a different VS hive. Probably just a property you set inside each project file. Each experimental instance is completely separate.
So you can run "devenv.exe /RootSuffix MyFirstInstance" and "devenv.exe /RootSuffix MySecondInstance" and each will use separate sets of user extensions. This would result in using the registry keys HKCU\Software\Microsoft\VisualStudio\10.0MyFirstInstance_Config and HKCU\Software\Microsoft\VisualStudio\10.0MySecondInstance_Config, respectively.
They seem to have removed a lot of the documentation for this feature since VS2005, but it all still seems to work.
Not really. When you build and run the extension project in VS, it is actually deployed to the experimental instance of VS, but they're not uninstalled when you finish debugging/running.
Your best bet is to use the script to reset the experiment instance that is provided with the VS SDK. Unfortunately you'll have to do this every time you switch between your solutions.
Look in the start menu for:
Microsoft Visual Studio 2010 SDK\Tools\Reset the Microsoft Visual Studio 2010 Experimental instance.lnk

Resources