Per Project ConfigurationIntroductionPer Project Configuration is an extension that allows to export Visual Studio settings to a file and load the settings based on active solution, project or document. It is possible to assign different settings for each directory or file. Directory hierarchy is traversed so you can store common settings in root directory and only changed values in project directory. Configuration files are watched and loaded automatically whenever they are changed (on the fly). This extension works great in team projects, when each project you are working on requires different code formatting. Settings are stored in file named ".vsconfig" or "document.vsconfig" and is in human-editable ini format. Since settings are read from directory tree, it is possible to store only differences between configurations and keep the file short and clean. InstructionsExport Settings
Export Settings to make incremental differenceLet's assume that you store projects in directory 'C:\Projects' and that the project you want to make incremental setting file is in directory 'C:\Projects\MyProject'
Now you have 2 exported files. First 'C:\Projects\.vsconfig', which is used for ALL documents under 'C:\Projects' directory (and its childs), second 'C:\Projects\MyProject\.vsconfig' which is used for all documents under 'C:\Projects\MyProject'. Project MyProject now used BOTH configuration files - it loads the full settings from 'C:\Projects\.vsconfig' and incremental changes from 'C:\Projects\MyProject\.vsconfig'. How the settings hierarchy worksLet's assume that you store projects in directory 'C:\Projects' and you have 3 projects in that directory: 'NormalProject1', 'NormalProject2' and 'DifferentProject1'. If you store settings in 'C:\Projects\.vsconfig' file, it will be used by all 3 projects. Now, if you add settings to 'C:\Projects\DifferentProject1\.vsconfig', 'DifferentProject1' will now use both setting files. It first loads file 'C:\Projects\.vsconfig' and then 'C:\Projects\DifferentProject1\.vsconfig'. Now, let's assume that for some reason you want to change settings only for one file 'C:\Projects\DifferentProject1\MySpecialFile.cs'. Export & Diff another settings file and name it 'C:\Projects\DifferentProject1\MySpecialFile.cs.vsconfig'. Now, when you switch to 'MySpecialFile.cs' in Visual Studio, it loads all 3 settings files in the hierarchy (in Projects dir, in DifferentProject1 dir and in MySpecialFile.cs.vsconfig), and when you switch back to file 'Program.cs', VS will load only the configs in Projects and DifferentProject1. You may use any number of .vsconfig files you want (it is only limited by the directory structure that you have). One for each directory and one for each file. But I want to turn this 'settings hierarchy' thing off for my projectYes, that is possible. If you don't want project 'DifferentProject1' to load the shared .vsconfig in 'C:\Projects', you could use special value 'root = true' set in the settings file. Just open 'C:\Projects\DifferentProject1\.vsconfig' in your favorite text editor (Notepad will do) and add line 'root = true' (without the quotes) just in the beginning of the file (line 1; or simply section named [] will be enough). Known limitations
If something can't be exported, imported or some error occurs, check messages in 'Output' window, 'Show output from' 'PerProjectConfig' dropdown. If automatically exported file contains settings that can't be imported, feel free to edit the .vsconfig file and remove the affected entries. Contact meFeel free to ask questions if something is not clear, I am ready for CONSTRUCTIVE feedback and suggestions. Please, if you did not understand how this works, read this document or ask question, do not give me 1 star. Also, if you don't need such functionality, do not rate it with 1 star and comment 'Useless'. I have written this extension for myself 3 years ago and it never crashed my Visual Studio, so please do not 1-star me - the problem will probably be somewhere else, e.g. conflicting extensions. Updates |