Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+Mᐁ includes #413

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,55 @@ The following MSBuild properties can be used to customize the generated code:
[![Downloads](https://img.shields.io/nuget/dt/ThisAssembly.Vsix.svg?color=green)](https://www.nuget.org/packages/ThisAssembly.Vsix)

<!-- include src/ThisAssembly.Vsix/readme.md#vsix -->
<!-- #vsix -->
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)

And in the `source.extension.vsixmanifest`:
```xml
<PackageManifest Version="2.0.0" ...>
<Metadata>
<!-- You can use the |ProjectName;TargetName| syntax throughout this manifest, BTW -->
<Identity Id="|%CurrentProject%;VsixId|" Version="|%CurrentProject%;VsixVersion|" Language="|%CurrentProject%;VsixLanguage|" Publisher="|%CurrentProject%;VsixPublisher|" />
<DisplayName>|%CurrentProject%;VsixDisplayName|</DisplayName>
<Description>|%CurrentProject%;VsixDescription|</Description>
</Metadata>
...
</PackageManifest>
```

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 |
|-------------------|-------------------------------------|
| VsixID | `$(PackageId)` or `$(AssemblyName)` |
| VsixVersion | `$(Version)` |
| VsixDisplayName | `$(Title)` |
| VsixDescription | `$(Description)` |
| VsixProduct | `$(Product)` |
| VsixPublisher | `$(Company)` |
| VsixLanguage | `$(NeutralLanguage)` or 'en-US' |
| VsixDescription | `$(Description)` |

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.

Since the `$(PackageId)` property can be used as the VSIX ID, the `Pack` target is redefined to
mean `CreateVsixManifest`, so "packing" the VSIX is just a matter of right-clicking the VSIX
project and selecting "Pack".

<!-- #vsix -->
<!-- src/ThisAssembly.Vsix/readme.md#vsix -->

<!-- include src/visibility.md -->
## Customizing the generated code
Expand Down