You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## How to declare project capabilities in your project
31
+
## Filtering MEF parts via capabilities
32
+
33
+
Classes exported via MEF can declare the project capabilities under which they apply. See [MEF](mef.md) for more information.
34
+
35
+
## Defining capabilities via MSBuild
30
36
31
37
Project capabilities can be declared in several ways, the easiest of which
32
-
being to add this MSBuild item to your .targets file:
38
+
being to add this MSBuild item to your `.targets` file:
33
39
34
40
```xml
35
-
<ProjectCapabilityInclude="MyOwnCapability" />
41
+
<ItemGroup>
42
+
<ProjectCapabilityInclude="MyOwnCapability" />
43
+
</ItemGroup>
44
+
```
45
+
46
+
## Defining fixed capabilities for a project type
47
+
48
+
Some capabilities are static/fixed for a given project type. These capabilities should be defined directly on the project type registration.
49
+
50
+
For example:
51
+
52
+
```csharp
53
+
[assembly: ProjectTypeRegistration(
54
+
projectTypeGuid:MyProjectType.Guid,
55
+
displayName:"#1",
56
+
displayProjectFileExtensions:"#2",
57
+
defaultProjectExtension:"myproj",
58
+
language:"MyLang",
59
+
resourcePackageGuid:MyPackage.PackageGuid,
60
+
Capabilities="MyProject; AnotherCapability")] // Define capabilities here
36
61
```
37
62
63
+
Capabilities defined via the `ProjectTypeRegistrationAttribute.Capabilities` property are available on all projects loaded for that project type. Multiple values are separated by semicolon (`;`).
64
+
65
+
Sometimes you'll need capabilities to be defined very early in a project's lifecycle. These fixed capabilities are available from
66
+
67
+
## Viewing a project's capabilities
68
+
69
+
To see the capabilities a CPS project defines, add the `DiagnoseCapabilities` project capability to turn on a tree in the VS Solution Explorer that lists all capabilities of the project:
0 commit comments