Skip to content

Commit 7e6ba70

Browse files
committed
Friendly error when non-matching SDK is used
Since we are building with latest&greatest .NET to get the extension class syntax, consumers need to use a matching SDK in order for that to work. Provide a compile-time error instead of the inscrutable alternative (unsupported language feature or what-not). This will turn off itself when we ship with a stable SDK.
1 parent f36ff9f commit 7e6ba70

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/AI/AI.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@
3131
<None Include="..\..\osmfeula.txt" Link="osmfeula.txt" PackagePath="OSMFEULA.txt" />
3232
</ItemGroup>
3333

34+
<Target Name="UpdateSdkPreviewVersion" BeforeTargets="GetPackageContents">
35+
<!-- Update packaging version targets -->
36+
<XmlPoke XmlInputPath="$(MSBuildProjectDirectory)\Devlooped.Extensions.AI.targets"
37+
Query="/Project/PropertyGroup/BuiltWithSdkPreview"
38+
Value="$(_NETCoreSdkIsPreview)"/>
39+
<XmlPoke XmlInputPath="$(MSBuildProjectDirectory)\Devlooped.Extensions.AI.targets"
40+
Query="/Project/PropertyGroup/BuiltSdkPreviewVersion"
41+
Value="$(NETCoreSdkVersion)"/>
42+
</Target>
43+
3444
</Project>
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
<Project>
2-
1+
<Project>
2+
<PropertyGroup>
3+
<BuiltWithSdkPreview>true</BuiltWithSdkPreview>
4+
<BuiltSdkPreviewVersion>10.0.100-preview.7.25380.108</BuiltSdkPreviewVersion>
5+
</PropertyGroup>
6+
<Target Name="EnsureSamePreviewSdkVersion" BeforeTargets="Build" Condition="'$(BuiltWithSdkPreview)' == 'true'">
7+
<Error Condition="'$(_NETCoreSdkIsPreview)' == 'false' or '$(NETCoreSdkVersion)' != '$(BuiltSdkPreviewVersion)'" Text="This version was built with a preview SDK and requires a matching one. Please install SDK version $(BuiltSdkPreviewVersion) or update to a newer package version." />
8+
</Target>
39
</Project>

0 commit comments

Comments
 (0)