Skip to content

Commit

Permalink
Depend on NuGet package instead of assembly from SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
bash committed Jan 29, 2025
1 parent 57787b8 commit c045740
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.0.1597"/>
</ItemGroup>
<PropertyGroup>
<_FunckyNuGetVersioningVersion>6.12.1</_FunckyNuGetVersioningVersion>
</PropertyGroup>
</Project>
12 changes: 4 additions & 8 deletions SemanticVersioning.targets
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<!-- We are loaded *before* NuGet.Build.Tasks.Pack.targets, so we can't use the $(NuGetPackTaskAssemblyFile) and $(NuGetBuildTasksPackTargets) properties.
Thus we re-define some of the things here based on $(MSBuildToolsPath). Let's hope it doesn't break. -->
<_NuGetVersioningAssemblyFile Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildToolsPath)/Sdks/NuGet.Build.Tasks.Pack/CoreCLR/NuGet.Versioning.dll</_NuGetVersioningAssemblyFile>
<_NuGetVersioningAssemblyFile Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildToolsPath)/Sdks/NuGet.Build.Tasks.Pack/Desktop/NuGet.Versioning.dll</_NuGetVersioningAssemblyFile>
<_NuGetVersioningAssemblyFile Condition="!$([System.IO.Path]::Exists('$(_NuGetVersioningAssemblyFile)'))">$(MSBuildToolsPath)/NuGet.Versioning.dll</_NuGetVersioningAssemblyFile>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="NuGet.Versioning" Version="[$(_FunckyNuGetVersioningVersion)]" />
</ItemGroup>
<UsingTask TaskName="GenerateSemanticVersionRanges" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<ProjectReferencesWithVersions ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<ProjectReferencesWithExactVersions ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="$(_NuGetVersioningAssemblyFile)" />
<Reference Include="$(NuGetPackageRoot)nuget.versioning/$(_FunckyNuGetVersioningVersion)/lib/netstandard2.0/NuGet.Versioning.dll" />
<Using Namespace="NuGet.Versioning" />
<!-- language=C# -->
<Code Type="Fragment" Language="cs"><![CDATA[
Expand Down

0 comments on commit c045740

Please sign in to comment.