2020 </Target >
2121
2222 <Target Name =" Pack" DependsOnTargets =" Clean;Restore;Test" >
23+ <PropertyGroup >
24+ <!-- Normalize 2-segment versions (e.g., "0.85") to 3-segment (e.g., "0.85.0").
25+ NuGet normalizes versions internally when generating nuspec filenames, so
26+ passing "0.85" causes Paket to look for "*.0.85.nuspec" while NuGet writes
27+ "*.0.85.0.nuspec", resulting in a pack failure. Using 3 segments prevents this.
28+ The regex ^\d+\.\d+$ only matches plain X.Y versions; pre-release versions
29+ such as "0.85-beta" are intentionally left unchanged. -->
30+ <PackVersion Condition =" $([System.Text.RegularExpressions.Regex]::IsMatch('$(Version)', '^\d+\.\d+$')) " >$(Version).0</PackVersion >
31+ <PackVersion Condition =" '$(PackVersion)' == '' " >$(Version)</PackVersion >
32+ </PropertyGroup >
2333 <!-- Create the output directory first so it exists as a local NuGet source -->
2434 <MakeDir Directories =" $(NupkgsDir)" />
2535 <!-- Pack the main sln first so the Myriad tool nupkg is available locally -->
26- <Exec Command =' dotnet pack src/Myriad.sln -c Release -o "$(NupkgsDir)" /p:Version=$(Version )' />
36+ <Exec Command =' dotnet pack src/Myriad.sln -c Release -o "$(NupkgsDir)" /p:Version=$(PackVersion )' />
2737 <!-- Restore Myriad.Sdk pointing at the local nupkg directory so the just-built
2838 Myriad package is resolved without requiring it to be published on nuget.org -->
29- <Exec Command =' dotnet restore src/Myriad.Sdk/Myriad.Sdk.proj /p:Version=$(Version ) --source "$(NupkgsDir)" --source "https://api.nuget.org/v3/index.json"' />
39+ <Exec Command =' dotnet restore src/Myriad.Sdk/Myriad.Sdk.proj /p:Version=$(PackVersion ) --source "$(NupkgsDir)" --source "https://api.nuget.org/v3/index.json"' />
3040 <!-- Pack Myriad.Sdk using the restore done above (skip redundant restore) -->
31- <Exec Command =' dotnet pack src/Myriad.Sdk/Myriad.Sdk.proj -c Release -o "$(NupkgsDir)" /p:Version=$(Version ) --no-restore' />
41+ <Exec Command =' dotnet pack src/Myriad.Sdk/Myriad.Sdk.proj -c Release -o "$(NupkgsDir)" /p:Version=$(PackVersion ) --no-restore' />
3242 </Target >
3343
3444</Project >
0 commit comments