diff --git a/src/ThisAssembly.Vsix/ThisAssembly.Vsix.csproj b/src/ThisAssembly.Vsix/ThisAssembly.Vsix.csproj index 8bc5ee27..2e42d564 100644 --- a/src/ThisAssembly.Vsix/ThisAssembly.Vsix.csproj +++ b/src/ThisAssembly.Vsix/ThisAssembly.Vsix.csproj @@ -10,8 +10,8 @@ ThisAssembly.Vsix - This package generates a static `ThisAssembly.Vsix` class with public -constants exposing key VSIX manifest properties. For example: + Allows consuming VSIX manifest properties from code, as well as +MSBuild project properties from the VSIX manifest. For example: partial class ThisAssembly { @@ -20,6 +20,17 @@ constants exposing key VSIX manifest properties. For example: public const string Id = "MyVsix"; } } + +or + + <PackageManifest Version="2.0.0" ...> + <Metadata> + <Identity Id="|%CurrentProject%;VsixId|" Version="|%CurrentProject%;VsixVersion|" Language="|%CurrentProject%;VsixLanguage|" Publisher="|%CurrentProject%;VsixPublisher|" /> + <DisplayName>|%CurrentProject%;VsixDisplayName|</DisplayName> + <Description>|%CurrentProject%;VsixDescription|</Description> + </Metadata> + ... + </PackageManifest> diff --git a/src/ThisAssembly.Vsix/readme.md b/src/ThisAssembly.Vsix/readme.md index af17eb53..f6f6ffc1 100644 --- a/src/ThisAssembly.Vsix/readme.md +++ b/src/ThisAssembly.Vsix/readme.md @@ -1,29 +1,11 @@ -This package generates a static `ThisAssembly.Vsix` class with public -constants exposing key VSIX manifest properties. +Allows consuming VSIX manifest properties from code, as well as +MSBuild project properties from the VSIX manifest. For example: ![](https://raw.githubusercontent.com/devlooped/ThisAssembly/main/img/ThisAssembly.Vsix.png) -For example: - -```csharp - partial class ThisAssembly - { - public static partial class Vsix - { - public const string Id = "MyVsix"; - } - } -``` - -In addition to making the [VSIX manifest metadata](https://learn.microsoft.com/en-us/visualstudio/extensibility/vsix-extension-schema-2-0-reference?view=vs-2022#metadata-element) -properties available as constants, the package also provides targets for those properties -with sensible defaults from project properties so that the manifest can leverage -[placeolder syntax](https://learn.microsoft.com/en-us/visualstudio/extensibility/vsix-extension-schema-2-0-reference?view=vs-2022#metadata-element) -and avoid duplication. - -For example, the following `source.extension.vsixmanifest` uses values from MSBuild exclusively: +And in the `source.extension.vsixmanifest`: ```xml ``` +As shown above, in addition to making the [VSIX manifest metadata](https://learn.microsoft.com/en-us/visualstudio/extensibility/vsix-extension-schema-2-0-reference?view=vs-2022#metadata-element) +properties available as constants, the package also provides targets for those properties +with sensible defaults from project properties so that the manifest can leverage +[placeolder syntax](https://learn.microsoft.com/en-us/visualstudio/extensibility/vsix-extension-schema-2-0-reference?view=vs-2022#metadata-element) +and avoid duplication. + The available properties and their default values are: | Name | Default Value | @@ -51,7 +39,7 @@ The available properties and their default values are: | VsixLanguage | `$(NeutralLanguage)` or 'en-US' | | VsixDescription | `$(Description)` | -As shown in the example above, the syntax for using these properties from the `.vsxmanifest` is +As shown in the example above, the syntax for using these properties from the `source.extension.vsixmanifest` is `|%CurrentProject%;[PROPERTY]|`. This is because the package defines a corresponding target to retrieve each of the above properties. You can provide a different value for each property via MSBuild as usual, of course.