IVsProjectFactory.CreateProject Method

Creates a new project.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function CreateProject ( _
    pszFilename As String, _
    pszLocation As String, _
    pszName As String, _
    grfCreateFlags As UInteger, _
    ByRef iidProject As Guid, _
    <OutAttribute> ByRef ppvProject As IntPtr, _
    <OutAttribute> ByRef pfCanceled As Integer _
) As Integer
'Usage
Dim instance As IVsProjectFactory 
Dim pszFilename As String 
Dim pszLocation As String 
Dim pszName As String 
Dim grfCreateFlags As UInteger 
Dim iidProject As Guid 
Dim ppvProject As IntPtr 
Dim pfCanceled As Integer 
Dim returnValue As Integer 

returnValue = instance.CreateProject(pszFilename, _
    pszLocation, pszName, grfCreateFlags, _
    iidProject, ppvProject, pfCanceled)
int CreateProject(
    string pszFilename,
    string pszLocation,
    string pszName,
    uint grfCreateFlags,
    ref Guid iidProject,
    out IntPtr ppvProject,
    out int pfCanceled
)
int CreateProject(
    [InAttribute] String^ pszFilename, 
    [InAttribute] String^ pszLocation, 
    [InAttribute] String^ pszName, 
    [InAttribute] unsigned int grfCreateFlags, 
    [InAttribute] Guid% iidProject, 
    [OutAttribute] IntPtr% ppvProject, 
    [OutAttribute] int% pfCanceled
)
function CreateProject(
    pszFilename : String, 
    pszLocation : String, 
    pszName : String, 
    grfCreateFlags : uint, 
    iidProject : Guid, 
    ppvProject : IntPtr, 
    pfCanceled : int
) : int

Parameters

  • pszFilename
    Type: System.String

    [in] File name of the project that will be created.

  • pszLocation
    Type: System.String

    [in] Location where the project will be created.

  • pszName
    Type: System.String

    [in] If applicable, the name of the template to use when cloning a new project.

  • iidProject
    Type: System.Guid%

    [in] Identifier of the interface that the caller wants returned.

  • ppvProject
    Type: System.IntPtr%

    [out, iid_is(iidProject)] Pointer to the interface specified by iidProject.

  • pfCanceled
    Type: System.Int32%

    [out] Returns true if the user presses the Cancel button to abort the creation of this project. Otherwise, it is false.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsProjectFactory::CreateProject(
   [in] LPCOLESTR pszFilename,
   [in] LPCOLESTR pszLocation,
   [in] LPCOLESTR pszName,
   [in] VSCREATEPROJFLAGS grfCreateFlags,
   [in] REFIID iidProject,
   [out, iid_is(iidProject)] void **ppvProject,
   [out] BOOL *pfCanceled
);

CreateProject is called by the shell when a user tries to create a new project.

Create a new project by cloning an existing template project (which could be empty). See Managed Visual Studio Project and Basic Project samples for examples. The environment uses the file extension to determine the VSPackage on which to call this method.

.NET Framework Security

See Also

Reference

IVsProjectFactory Interface

IVsProjectFactory Members

Microsoft.VisualStudio.Shell.Interop Namespace