Skip to content

Commit e070ce3

Browse files
authored
[build] Remove <Imports/> now covered by Directory.Build.props (#607)
In commit 95f698b, we renamed `Configuration.props` to `Directory.Build.props`. `Directory.Build.props` is special in that MSBuild will [automatically import the file][0] if it's in the "current" directory or any parent directory: > When MSBuild runs, *Microsoft.Common.props* searches your directory > structure for the *Directory.Build.props* file (and > *Microsoft.Common.targets* looks for *Directory.Build.targets*). Unfortunately, commit 95f698b introduced some build warnings because of this change, as some projects were still manually importing file which were now being imported by `Directory.Build.props`, resulting in warnings such as: tests\Java.Interop-Tests\Java.Interop-Tests.csproj(33,3): Warning MSB4011: "d:\a\1\s\bin\BuildRelease\JdkInfo.props" cannot be imported again. It was already imported at "d:\a\1\s\Directory.Build.props (13,3)". This is most likely a build authoring error. This subsequent import will be ignored. Remove unnecessary `<Import/>`s from the project files, to reduce the number of MSB4011 warnings reported. Note that this does not fix *all* MSB4011 warnings. In particular `build-tools/jnienv-gen/jnienv-gen.csproj` still reports warnings, as it hasn't been migrated to be a Short-Form project yet. [0]: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019#directorybuildprops-and-directorybuildtargets
1 parent e7c5f54 commit e070ce3

File tree

4 files changed

+0
-8
lines changed

4 files changed

+0
-8
lines changed

src/java-interop/java-interop.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
<DefineSymbols>JI_DLL_EXPORT MONODEVELOP MONO_DLL_EXPORT</DefineSymbols>
2828
<SourceDirectory>.</SourceDirectory>
2929
</PropertyGroup>
30-
<Import Project="$(JNIEnvGenPath)\JdkInfo.props" Condition="Exists('$(JNIEnvGenPath)\JdkInfo.props')" />
31-
<Import Project="$(JNIEnvGenPath)\MonoInfo.props" Condition="Exists('$(JNIEnvGenPath)\MonoInfo.props')" />
3230
<ItemGroup>
3331
<ClInclude Include="java-interop.h" />
3432
<ClInclude Include="java-interop-gc-bridge.h" />

tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
<ProjectReference Include="..\TestJVM\TestJVM.csproj" />
2626
</ItemGroup>
2727

28-
<Import Condition="Exists('$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props')" Project="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props" />
29-
3028
<ItemGroup>
3129
<JavaPerformanceTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\performance\JavaTiming.java" />
3230
</ItemGroup>

tests/Java.Interop-Tests/Java.Interop-Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
<ProjectReference Include="..\TestJVM\TestJVM.csproj" />
3131
</ItemGroup>
3232

33-
<Import Condition="Exists('$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props')" Project="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props" />
34-
3533
<ItemGroup>
3634
<JavaInteropTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\CrossReferenceBridge.java" />
3735
<JavaInteropTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\CallNonvirtualBase.java" />

tests/Java.Interop.Export-Tests/Java.Interop.Export-Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
<ProjectReference Include="..\..\src\Java.Runtime.Environment\Java.Runtime.Environment.csproj" />
2626
<ProjectReference Include="..\TestJVM\TestJVM.csproj" />
2727
</ItemGroup>
28-
29-
<Import Condition="Exists('$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props')" Project="$(MSBuildThisFileDirectory)..\..\bin\Build$(Configuration)\JdkInfo.props" />
3028

3129
<ItemGroup>
3230
<JavaExportTestJar Include="$(MSBuildThisFileDirectory)java\com\xamarin\interop\export\ExportType.java" />

0 commit comments

Comments
 (0)