Skip to content

Instantly share code, notes, and snippets.

@cturano
cturano / gist:9b81308e6f300aba6ea57a7514fc6333
Created Mar 25, 2020
Sitecore has released some NuGet packages with a list of Assemblies and Versions distributed as part of the Sitecore release. This MSBuild gist shows you how to use the contents of the SitecoreAssemblies package during your build to generate an error if you reference incorrect assemblies in your project.
View gist:9b81308e6f300aba6ea57a7514fc6333
<!-- This Using task gets the file version of the assembly passed in "AssemblyPath" and returns the "Version" -->
<UsingTask TaskName="GetFileVersion" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<AssemblyPath ParameterType="System.String" Required="true" />
<Version ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Using Namespace="System.Diagnostics" />
<Code Type="Fragment" Language="cs">