Hello every one, i have small question, How to add reference automatically in all projects which i create in Visual Studio like System,
System.Collections.Generic and others in Console Application Projects
Thanks in Advance

Those default namespaces and references, depending on the type of project that is created, are added because the chosen type of application or library requires them. Are you wanting to create a project template that can be chosen like "Windows Form Application", or "Console Application"?

How to: Create Project Templates

Edited 7 Years Ago by DdoubleD: n/a

What i need, in console application there are some namespaces which are added automatically, How can i change these namespaces and add to them other namespaces which i already made

I would advise creating a macro to insert the desired namespaces automatically. I haven't had much luck modifying visual studios default behavior for new units.

@ sknake : How to add macros to do something like what i want

Go to "Tools -- Macro -- New Macro Project" and create a macro project, then a macro. A guy I work with figured this and here is the procedure separator macro we use:

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module ScottsModule

    Sub ProcedureSeparator()
        DTE.ActiveDocument.Selection.SelectLine()

        If (ActiveDocument.Selection.Text.Trim().Length = 0) Then
            DTE.ActiveDocument.Selection.CharLeft()
            DTE.ActiveDocument.Selection.Text = "    /* -------------------------------------------------------------------- */"
        Else
            DTE.ActiveDocument.Selection.CharLeft()
            DTE.ActiveDocument.Selection.Text = "    /* -------------------------------------------------------------------- */"
            DTE.ActiveDocument.Selection.NewLine()

        End If
    End Sub

End Module

Then right click on your toolbars up top and create a toolbar. In your toolbar add a shortcut to the macro you just created. My macro caption is "&A Procedure Separator" so i hit ALT+A and it inserts a procedure separator at the active cursor point.

You can modify this to your default "Using ..." statements then position your cursor near the top and fire it.

This article has been dead for over six months. Start a new discussion instead.