Last active
February 15, 2022 07:22
-
-
Save cezarypiatek/42553a6364fb2ccc8a81dcea570fdde1 to your computer and use it in GitHub Desktop.
Setting version for VisualStudio extensions based on the Version msbuild parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project> | |
<Target Name="GenerateAssemblyInfo" BeforeTargets="BeforeBuild"> | |
<PropertyGroup> | |
<AssemblyInfoFileLines><![CDATA[ | |
[assembly: System.Reflection.AssemblyFileVersionAttribute("$(Version)")] | |
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("$(Version)")] | |
[assembly: System.Reflection.AssemblyVersionAttribute("$(Version)")] | |
]]></AssemblyInfoFileLines> | |
</PropertyGroup> | |
<WriteLinesToFile Lines="$(AssemblyInfoFileLines)" File="$(IntermediateOutputPath)\AssemblyInfo.g.cs" Overwrite="true" /> | |
<Message Text="Generate assembly info" Importance="high" /> | |
</Target> | |
<Target Name="IncludeAssemblyInfo" BeforeTargets="BeforeBuild" AfterTargets="GenerateAssemblyInfo"> | |
<ItemGroup> | |
<Compile Include="$(IntermediateOutputPath)\AssemblyInfo.g.cs" /> | |
</ItemGroup> | |
<Message Text="Include assembly info" Importance="high" /> | |
</Target> | |
<Target Name="SetVersionForVsixManifest" BeforeTargets="BeforeBuild"> | |
<PropertyGroup> | |
<Namespace> | |
<Namespace Prefix="d" Uri="http://schemas.microsoft.com/developer/vsx-schema/2011" /> | |
</Namespace> | |
</PropertyGroup > | |
<XmlPoke | |
XmlInputPath="source.extension.vsixmanifest" | |
Value="$(Version)" | |
Query="/d:PackageManifest/d:Metadata/d:Identity/@Version" | |
Namespaces="$(Namespace)" | |
/> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment