FlavoredProjectFactoryBase Class

 

Base class for flavored project factories.

Namespace:   Microsoft.VisualStudio.Shell.Flavor
Assembly:  Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)

System.Object
  Microsoft.VisualStudio.Shell.Flavor.FlavoredProjectFactoryBase

public abstract class FlavoredProjectFactoryBase : IVsAggregatableProjectFactoryCorrected, 
	IVsProjectFactory

NameDescription
System_CAPS_pubmethodFlavoredProjectFactoryBase()

Initializes a new instance of FlavoredProjectFactoryBase.

NameDescription
System_CAPS_protpropertyserviceProvider

Gets the project's service provider.

NameDescription
System_CAPS_protmethodCanCreateProject(String, UInt32)

Determines whether or not the project can be created with the supplied parameters.

System_CAPS_protmethodCreateProject(String, String, String, UInt32, Guid, IntPtr, Int32)

Creates a project.

System_CAPS_protmethodDispose(Boolean)

Disposes the service provider.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodInitialize()

Initializes the project factory.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_protmethodPreCreateForOuter(IntPtr)

Creates an instance of the project.

System_CAPS_protmethodProjectTypeGuids(String)

Gets the set of project type GUIDs from the project file.

System_CAPS_pubmethodToString()

(Inherited from Object.)

An implementation of a flavored project factory is defined by FlavoredProjectFactory. Override the PreCreateForOuter method to return a new FlavoredProjectBase derived class. The derived class GetGuidProperty method can redirect the templates search to find new project templates for this flavor.

namespace Microsoft.Samples.VisualStudio.IronPythonProject.WPFProviders
{
    [ComVisible(true)]
    [ClassInterface(ClassInterfaceType.None)]
    [Guid("FEBF49B8-D18C-4745-ADE0-35BF632E0533")]
    public class PythonWPFFlavor : FlavoredProjectBase
    {
        public PythonWPFFlavor(IServiceProvider site)
        {
            this.serviceProvider = site;
        }

        protected override Guid GetGuidProperty(uint itemId, int propId)
        {
            if (propId == 
                (int)__VSHPROPID2.VSHPROPID_AddItemTemplatesGuid)
            {
                return typeof(PythonWPFProjectFactory).GUID;
            }
            return base.GetGuidProperty(itemId, propId);
        }

        protected override int GetProperty(uint itemId, int propId, out object property)
        {
            return base.GetProperty(itemId, propId, out property);
        }
    }
    [Guid(PythonWPFProjectFactory.PythonWPFProjectFactoryGuid)]
    public class PythonWPFProjectFactory : FlavoredProjectFactoryBase
    {
        public const string PythonWPFProjectFactoryGuid = "229B3E77-97E9-4f6d-9151-E6D103EA4D4A";

        private IServiceProvider site;
        public PythonWPFProjectFactory(IServiceProvider site) : base()
        {
            this.site = site;
        }

        protected override object PreCreateForOuter(IntPtr outerProjectIUnknown)
        {
            return new PythonWPFFlavor(site);
        }
    }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: