westtech.dev something to know

Hedgehog TDS - Package Version

Originally published on michaellwest.blogspot.com

I wanted to create TDS packages using the version from the project assembly version.
Here’s a piece of code that I finally figured out how to accomplish dynamically. Place at the bottom of your .scproj file.

  <Import Project="$(MSBuildExtensionsPath)\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets" />
  <ItemGroup>
    <AssembliesPath Include="..\SomethingAwesome.Web\bin\SomethingAwesome.Web.dll" />
  </ItemGroup>
  <Target Name="BeforeSitecoreBuild">
    <GetAssemblyIdentity AssemblyFiles="@(AssembliesPath)">
      <Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
    </GetAssemblyIdentity>
    <CreateProperty Value="%(AssemblyVersion.Version)">
      <Output TaskParameter="Value" PropertyName="PackageVersion" />
    </CreateProperty>
  </Target>

View on GitHub Gist