Skip to content

Commit e66b803

Browse files
committed
Fix the VS2019 build.
xamarin-android Windows PR builds can't build, because of: error CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.0\analyzers\dotnet\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [C:\a\_work\1\s\external\Java.Interop\build-tools\jnienv-gen\jnienv-gen.csproj] Ignore the CS8032 warning/error, so that xamarin-android Windows PR builds can *build*.
1 parent 20d6bcb commit e66b803

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Directory.Build.props

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@
9191
<_RunJNIEnvGen Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">$(Runtime) "$(_JNIEnvGenPath)"</_RunJNIEnvGen>
9292
</PropertyGroup>
9393

94+
<!--
95+
When building on a bot w/ VS2019:
96+
97+
warning CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from
98+
99+
however, with `$(TreatWarningsAsErrors)`=True, this becomes an error,
100+
meaning we can't build on VS2019.
101+
102+
Ignore CS8032 so that we can build on VS2019.
103+
-->
104+
<PropertyGroup>
105+
<NoWarn>$(NoWarn);CS8032</NoWarn>
106+
</PropertyGroup>
107+
94108
<!-- The net6.0 versions of these are stricter and require overloads not available in .NET Framework, so start with just .NET Framework -->
95109
<PropertyGroup Condition=" '$(JIBuildingForNetCoreApp)' != 'True' ">
96110
<AnalysisMode>AllEnabledByDefault</AnalysisMode>

src/Java.Interop/Java.Interop-MonoAndroid.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<RootNamespace>Java.Interop</RootNamespace>
1212
<AssemblyName>Java.Interop</AssemblyName>
1313
<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' ">v4.5</TargetFrameworkVersion>
14-
<NoWarn>1591</NoWarn>
14+
<NoWarn>$(NoWarn);1591</NoWarn>
1515
<SignAssembly>true</SignAssembly>
1616
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
1717
<LangVersion>8.0</LangVersion>

src/Java.Interop/Java.Interop.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
1818
</PropertyGroup>
1919
<PropertyGroup>
20-
<NoWarn>1591</NoWarn>
20+
<NoWarn>$(NoWarn);1591</NoWarn>
2121
<SignAssembly>true</SignAssembly>
2222
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
2323
<DefineConstants>INTEROP;FEATURE_JNIENVIRONMENT_JI_PINVOKES;FEATURE_JNIOBJECTREFERENCE_INTPTRS;INTERNAL_NULLABLE_ATTRIBUTES;$(JavaInteropDefineConstants)</DefineConstants>

0 commit comments

Comments
 (0)