How to NOT include Visual Studio Project folder names in generated namespaces - visual-studio

How do I prevent the name of the Solution Folder in a VS project from being appended to the namespace generated for new items added to the solution folder?
Example: C# project in a VS solution
Default Namespace set in C# project properties: "BigClient.Domain"
If you create a solution folder in this project called "MySpecialStuff" and then add a new class to the 'MySpecialStuff" solution folder, VS creates the new .cs file with a "BigClient.Domain.MySpecialStuff" namespace. I want to find a way to allow the namespace of the newly-added class to retain just the 'project-level' namespace of "BigClient.Domain" instead of VS appending the "MySpecialStuff" solution-folder-name to the namespace.
I seem to recall reading a blog post by someone that this was possible (either via options/settings in VS or a registry setting) but I cannot recall where or how now that I want it :)
My platform is VS 2008 if answer = different for different VS versions.

If you have ReSharper installed, on the settings for the directory (F4), set Namespace Provider to false.

Make a new class template or change Visual Studio's class template. See the MSDN documentation for how to this. In the template file, you quickly see the line that inserts the 'safe' namespace name.

Related

Add a set of Namespaces to every Class file?

Often when working in VS2010 I find that I have a list of namespaces I want in all files. For example
using Common.Logging;
Is there a way I can configure this, preferably at a project or solution level?
There really isn't something built-in to do that. You can edit the Class.zip file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\1033 to change the usings in the default class created by "Add Class".
You might want to consider using a custom snippet instead of "add class" if you want something project/solution specific.

Copy Files to Project Folder with Visual Studio Project Template

I'm making a custom Visual Studio Project Template for a CSharp project and was wondering if there was a way to copy a dll from the template zip file to the new project file without including the dll in the project files?
The idea is that the project references the dll, but I just dont want the developers to care about the assembly.
What I did was, created new template wizard i.e. by implementing IWizard interface.
This article(http://msdn.microsoft.com/en-us/magazine/cc188697.aspx) will help you to get started with custom wizard.
Then in the RunStarted() method you will be able to get path to the current template like this
Path.GetDirectoryName((string)customParams[0])
Also you can get the path where the project is created using below code
replacementsDictionary["$destinationdirectory$"]
Once you have these values, do a normal file copy on the RunFinished() method

Is it possible to prompt the user for information in a Visual Studio template?

Is it possible to prompt the user for more than just a file name when they create a new item from a Visual Studio 2005 template? It would be nice to have more than just the class's name filled in when a template is used.
Apparently, the only way to accomplish this is by creating a WizardExtension (compile a DLL with a class that implements IWizard), and referencing it in the VSTEMPLATE file.

Using Intellisense in Visual C++ 2008 Express. Intellisense for one project not available when editing file in another project

I have a multiple vcproj solution going and it seems that no other project's intellisense information is available when editing a file in another project. However when I'm within a file in a project, all intellisense information is available for that project.
Any idea why?
Are you missing a using directive or a reference ?
you need to include the other project's namespace in the file with a using directive in order for the intellisense to show for the other project.

Visual studio - is there a way to select multiple files and wrap a namespace around each of them?

Is there a way to select all classes within a folder and assign a namespace to each of them in visual studio?
If there is no tool to do it, is there a regex pattern that will match everything before the class declatarion, but after the imports?
Resharper has a feature of changing namespaces for files.
For a manual solution, you could:
close all files in your solution
open only those files who need their namespace changed
perform a find-and-replace for namespace old to namespace new

Resources