سؤال

I use VS2010 and Sharepoint 2010 projects. I have an VS 2010 Addin, and I need detect type project programmatically.

I edit my csproj (for Sharepoint Project), and I have seen this ProjectTypeGuids:

{BB1F664B-9266-4fd6-B973-E1E44974B511};{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

Any FULL list of known project type Guids, included Sharepoint projects?

How can I get ProjectTypeGuids programmatically for my EnvDTE.Project in C# ?

References:

List of known project type Guids
http://www.mztools.com/articles/2008/mz2008017.aspx

What is the significance of ProjectTypeGuids tag in the visual studio project file
http://social.msdn.microsoft.com/Forums/en/vsx/thread/d9d05cdc-96a1-4044-95d8-a4f8885a660a

What is the significance of ProjectTypeGuids tag in the visual studio project file

http://www.mztools.com/articles/2007/MZ2007016.aspx

هل كانت مفيدة؟

المحلول

Carlos J.Quintero:

See:

HOWTO: Get the project flavor (subtype) of a Visual Studio project from an add-in

http://www.mztools.com/Articles/2007/MZ2007016.aspx

There is no full list since everyone can create new project types, that's the reason GUIDs are used.

You can create SharePoint 2010 projects and get the Guids, that's how I got that list.

Mathias Herbaux:

If you can get IVsSolution instance, you can have all GUID that compose your project:

  public bool IsTypedProject(IVsSolution solution, EnvDTE.Project project)
        {
            IVsHierarchy hierarchy;
            solution.GetProjectOfUniqueName(project.UniqueName, out hierarchy);
            IVsAggregatableProjectCorrected AP;
            AP = hierarchy as IVsAggregatableProjectCorrected;
            string projTypeGuids = string.Empty;
            if (AP != null)
            {
                AP.GetAggregateProjectTypeGuids(out projTypeGuids);
                if (projTypeGuids.ToUpper().Contains("YOUR_GUID".ToUpper()))
                {
                    return true;
                }
            }

            return false;
        }

Maybe you can can request service like this :

(IVsSolution)ServiceProvider.GetService(typeof(SVsSolution))

References:
http://social.msdn.microsoft.com/Forums/da-DK/vsx/thread/bf18037e-479a-4ca8-ae64-81ee39652d73

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top