提出问题提出问题
 

已答复Partially Custom Project System

  • 2008年6月18日 6:08Dave Sexton 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Hi, 

    I've created a package in 2008 to convert my existing project templates into a custom project system, but the problem that I'm having is that I don't want to have a completely custom system.  I just can't figure out how to simply extend the existing project types.

    In other words, I've added the ProjectBase files, created a project factory, a project node and also added ProvideProjectFactoryAttribute to my package, but it's creating much more functionality than what I want.

    Currently my tool provides four zipped templates (non-VS Package): C# Class Library, VB Class Library, C# Web App, VB Web App.  What I'd like to do is create my own custom project system on top of these base project types so that the two C# templates use the same file extension (.csdoc) and the two VB templates use the same file extension (.vbdoc).  I want the C# templates to appear under Visual C# > DocProject in the New Project dialog instead of having DocProject as a root node - and similar for the VB templates.  Also, if I add four different ProvideProjectFactoryAttributes to the package for each template then I have to provide four different file extensions, which is what I don't want.

    Can anyone give me some pointers?

    Thanks,
    Dave
    http://davesexton.com/blog

答案

  • 2008年6月20日 8:46Feng Chen版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复
    I also would like information on how to support custom project sub types (I think that's what I need).
    Yes, you're completely right about this, the Project sub types should be your start point,  And I'd like to provide the following references about this issue:
    Project Subtypes Design
    VS 2005 Project Subtypes

    Project Subtype Sample - A sample of Project Subtype created based on MPF.

    Hope this helps!

    Thanks!




    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

全部回复

  • 2008年6月19日 8:25Dave Sexton 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Hi,

    So basically there's lots of samples on how to create a custom project system, but what I want to do is extend the C# and VB.NET project systems by simply providing a new project file that adds some additional MSBuild information, which is what I'm currently doing, but also with the ability to create folders with special semantics in the hierarchy, like the Properties folder for example.  Will the ProjectBase code help or must I roll my own solution?

    I also would like information on how to support custom project sub types (I think that's what I need).  For example, the .csproj extension is associated with both the C# Class Library and the C# Web Application templates.  My tool provides two templates that build on the functionality of class libraries and web applications, so my custom extension (.csdoc) must also use the same project system with support for these sub types.  Will the ProjectBase code help or must I roll my own solution?

    It's not clear to me how I can use the ProvideProjectFactoryAttribute, or some other mechanism, so that my project templates appear under a sub node of the Visual C# node instead of in a custom root node.  Some pointers on this would be great as well.  Currently it's just a matter of copying my zipped templates to the appropriate folder during installation, but I'd like to know if MPF supports this for my new project system.

    Thanks,
    Dave
    http://davesexton.com/blog
  • 2008年6月20日 8:46Feng Chen版主用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     已答复
    I also would like information on how to support custom project sub types (I think that's what I need).
    Yes, you're completely right about this, the Project sub types should be your start point,  And I'd like to provide the following references about this issue:
    Project Subtypes Design
    VS 2005 Project Subtypes

    Project Subtype Sample - A sample of Project Subtype created based on MPF.

    Hope this helps!

    Thanks!




    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • 2008年6月20日 9:22Dave Sexton 用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    Thanks for the links, I think they're exactly what I needed.

    - Dave
    http://davesexton.com/blog
  • 2008年10月3日 19:40John HollidayMVP用户奖牌用户奖牌用户奖牌用户奖牌用户奖牌
     
    How does this work in VS2008?  Looking through the MPF source (mpfproj-22415.zip), there is no FlavoredProjectBase.  However, this class does exist in the Microsoft.VisualStudio.Shell.9.0 assembly.  Is this the same as the VS2005 SDK version?  

    The documentation links you provided are the standard VS2005 docs, and they are very difficult to understand.  Is there a document that explains the precise relationships that must exist in order for a project subtype to work correctly?  I'm not talking about the low-level COM relationships.  I'm talking about the process for building a managed code project subtype using the MPF.

    NOTE: Since the project subtype sample only exists in the VS2005 SDK (not in the VS2008 SDK), it is necessary to download and install it just to get the sample code.  Installing the VS2005 and VS2008 SDKs on the same machine can cause problems, so the safe way is to do this in a separate VM.

    Looking through the ProjectSubType sample does not help much to explain the required steps for building a flavored project using VS2008.  I'm making an assumption here that in order to setup a project subtype that extends a C# project, you have to add a <ProjectTypeGuids/> entry to the .csproj file and then include your custom project guid, followed by the C# project guid.  Is that right?  Is there any documentation that explains this key step and any other required steps?

    Also, the ProjectSubType project file contains an entry for <ProjectType>Local</ProjectType>.  What does this do?  Is it required for a flavored project?

    Finally, although not used by the ProjectSubtype sample, the project file includes a <ProjectExtensions> section that presumably provides the project-specific configuration settings.  Is there any documentation for how to access these in an MPF project? It seems to have something to do with a custom XML fragment implementation, but the explanation is unclear.



    John Holliday, MVP Office SharePoint Server