CreateProject Method
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

IVsProjectFactory.CreateProject Method

Creates a new project.

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

int CreateProject (
	[InAttribute] String^ pszFilename, 
	[InAttribute] String^ pszLocation, 
	[InAttribute] String^ pszName, 
	[InAttribute] unsigned int grfCreateFlags, 
	[InAttribute] Guid% iidProject, 
	[OutAttribute] IntPtr% ppvProject, 
	[OutAttribute] int% pfCanceled
int CreateProject (
	/** @attribute InAttribute() */ String pszFilename, 
	/** @attribute InAttribute() */ String pszLocation, 
	/** @attribute InAttribute() */ String pszName, 
	/** @attribute InAttribute() */ UInt32 grfCreateFlags, 
	/** @attribute InAttribute() */ /** @ref */ Guid iidProject, 
	/** @attribute OutAttribute() */ /** @ref */ IntPtr ppvProject, 
	/** @attribute OutAttribute() */ /** @ref */ int pfCanceled
JScript does not support passing value-type arguments by reference.



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


[in] Location where the project will be created.


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


[in] Set of flag values taken from the __VSCREATEPROJFLAGS enumeration.


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


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


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

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

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 Sample and Basic Project Sample samples for examples. The environment uses the file extension to determine the VSPackage on which to call this method.

© 2015 Microsoft