Skip to content

Commit 080d693

Browse files
committed
Improve Kiota generator error messages & implicitly include packages
1 parent 1bb878e commit 080d693

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/features/Riverside.CompilerPlatform.Features.Kiota/Kiota.props

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<Kiota_MinLangVersion>7.3</Kiota_MinLangVersion>
55
<Kiota_AuthPackageVersion>1.21.2</Kiota_AuthPackageVersion>
66
<Kiota_BundlePackageVersion>1.21.2</Kiota_BundlePackageVersion>
7+
8+
<Kiota_LangVersionError>The Advanced Compiler Services for .NET library requires C# $(Kiota_MinLangVersion) or later.</Kiota_LangVersionError>
9+
<Kiota_TargetFrameworkError>The Advanced Compiler Services for .NET library supports only netstandard2.0, netstandard2.1, net462, and net8.0 or later.</Kiota_TargetFrameworkError>
710
</PropertyGroup>
811

912
<!--<Target Name="Kiota_EnsureDependencies" BeforeTargets="CollectPackageReferences">
@@ -30,7 +33,7 @@
3033
<Error
3134
Condition="'$(LangVersion)' == ''"
3235
Code="KG1001"
33-
Text="Riverside Kiota requires C# LangVersion 7.3 or later. Set &lt;LangVersion&gt;7.3&lt;/LangVersion&gt; or newer." />
36+
Text="$(Kiota_LangVersionError) Set &lt;LangVersion&gt;7.3&lt;/LangVersion&gt; or newer." />
3437

3538
<Error
3639
Condition="
@@ -41,7 +44,7 @@
4144
and $([System.Text.RegularExpressions.Regex]::IsMatch('$(LangVersion)', '^[0-9]+(\.[0-9]+)?$'))
4245
and !$([MSBuild]::VersionGreaterThanOrEquals('$(LangVersion)', '$(Kiota_MinLangVersion)'))"
4346
Code="KG1002"
44-
Text="The Advanced Compiler Services for .NET library requires C# 7.3 or later. The current language version is '$(LangVersion)'." />
47+
Text="$(Kiota_LangVersionError) The current language version is '$(LangVersion)'." />
4548

4649
<Error
4750
Condition="
@@ -51,12 +54,12 @@
5154
and !($([System.String]::Copy('$(LangVersion)').Equals('preview', System.StringComparison.OrdinalIgnoreCase)))
5255
and !$([System.Text.RegularExpressions.Regex]::IsMatch('$(LangVersion)', '^[0-9]+(\.[0-9]+)?$'))"
5356
Code="KG1003"
54-
Text="The Advanced Compiler Services for .NET library requires C# 7.3 or later. Unsupported LangVersion value '$(LangVersion)'." />
57+
Text="$(Kiota_LangVersionError) Unsupported LangVersion value '$(LangVersion)'." />
5558

5659
<Error
5760
Condition="'@(_Kiota_InvalidFramework)' != ''"
5861
Code="KG1004"
59-
Text="The Advanced Compiler Services for .NET library supports only netstandard2.0, netstandard2.1, net462, and net8.0 or later. Invalid target framework(s): @(_Kiota_InvalidFramework, ', ')." />
62+
Text="$(Kiota_TargetFrameworkError) Invalid target framework(s): @(_Kiota_InvalidFramework, ', ')." />
6063

6164
<Warning
6265
Condition="'$(Nullable)' == '' or $([System.String]::Copy('$(Nullable)').Equals('disable', System.StringComparison.OrdinalIgnoreCase))"

src/features/Riverside.CompilerPlatform.Features.Kiota/Riverside.CompilerPlatform.Features.Kiota.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
</PackageReference>
2525
<PackageReference Include="Microsoft.Kiota.Authentication.Azure" Version="1.21.2" />
2626
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.21.2" />
27+
<PackageReference Include="System.Net.Http.Json" Version="10.0.4" />
28+
<PackageReference Include="System.Text.Json" Version="10.0.4" />
2729
</ItemGroup>
2830

2931
<Target Name="PackKiotaAnalyzer" BeforeTargets="_GetPackageFiles">

0 commit comments

Comments
 (0)