diff --git a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets
index b4e6527110c6..2f661758b336 100644
--- a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets
+++ b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets
@@ -11,13 +11,17 @@
$(EnableDefaultItems)
$(EnableDefaultItems)
-
- false
-
true
false
+
+
+
+
+
+
+
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/ApiDefinition.cs b/tests/dotnet/BindingWithDefaultCompileInclude/ApiDefinition.cs
new file mode 100644
index 000000000000..57b6c66be50f
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/ApiDefinition.cs
@@ -0,0 +1,7 @@
+using Foundation;
+
+namespace MyApiDefinition {
+ [BaseType (typeof (NSObject))]
+ interface MyNativeClass {
+ }
+}
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/ApiDefinition.cs b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/ApiDefinition.cs
new file mode 120000
index 000000000000..f0f219820ed4
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/ApiDefinition.cs
@@ -0,0 +1 @@
+../ApiDefinition.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/BindingWithDefaultCompileInclude.csproj b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/BindingWithDefaultCompileInclude.csproj
new file mode 100644
index 000000000000..1a4c8207fc96
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/BindingWithDefaultCompileInclude.csproj
@@ -0,0 +1,8 @@
+
+
+
+ net6.0-maccatalyst
+
+
+
+
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/Makefile b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/Makefile
new file mode 100644
index 000000000000..110d078f4577
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/Makefile
@@ -0,0 +1 @@
+include ../shared.mk
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/MyClass.cs b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/MyClass.cs
new file mode 120000
index 000000000000..a8c5f5dd7287
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/MyClass.cs
@@ -0,0 +1 @@
+../MyClass.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/StructsAndEnums.cs b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/StructsAndEnums.cs
new file mode 120000
index 000000000000..082d90ff1d72
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/MacCatalyst/StructsAndEnums.cs
@@ -0,0 +1 @@
+../StructsAndEnums.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/MyClass.cs b/tests/dotnet/BindingWithDefaultCompileInclude/MyClass.cs
new file mode 100644
index 000000000000..89ef0fec5fc9
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/MyClass.cs
@@ -0,0 +1,8 @@
+using System;
+namespace MyClassLibrary {
+ public class MyClass {
+ public MyClass ()
+ {
+ }
+ }
+}
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/StructsAndEnums.cs b/tests/dotnet/BindingWithDefaultCompileInclude/StructsAndEnums.cs
new file mode 100644
index 000000000000..6e8191ddb814
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/StructsAndEnums.cs
@@ -0,0 +1,6 @@
+namespace MyClassLibrary {
+ public struct MyStruct {
+ public int A;
+ public int B;
+ }
+}
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/iOS/ApiDefinition.cs b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/ApiDefinition.cs
new file mode 120000
index 000000000000..f0f219820ed4
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/ApiDefinition.cs
@@ -0,0 +1 @@
+../ApiDefinition.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/iOS/BindingWithDefaultCompileInclude.csproj b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/BindingWithDefaultCompileInclude.csproj
new file mode 100644
index 000000000000..53d9b77e6e5e
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/BindingWithDefaultCompileInclude.csproj
@@ -0,0 +1,8 @@
+
+
+
+ net6.0-ios
+
+
+
+
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/iOS/Makefile b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/Makefile
new file mode 100644
index 000000000000..110d078f4577
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/Makefile
@@ -0,0 +1 @@
+include ../shared.mk
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/iOS/MyClass.cs b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/MyClass.cs
new file mode 120000
index 000000000000..a8c5f5dd7287
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/MyClass.cs
@@ -0,0 +1 @@
+../MyClass.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/iOS/StructsAndEnums.cs b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/StructsAndEnums.cs
new file mode 120000
index 000000000000..082d90ff1d72
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/iOS/StructsAndEnums.cs
@@ -0,0 +1 @@
+../StructsAndEnums.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/macOS/ApiDefinition.cs b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/ApiDefinition.cs
new file mode 120000
index 000000000000..f0f219820ed4
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/ApiDefinition.cs
@@ -0,0 +1 @@
+../ApiDefinition.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/macOS/BindingWithDefaultCompileInclude.csproj b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/BindingWithDefaultCompileInclude.csproj
new file mode 100644
index 000000000000..83a074896a6a
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/BindingWithDefaultCompileInclude.csproj
@@ -0,0 +1,8 @@
+
+
+
+ net6.0-macos
+
+
+
+
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/macOS/Makefile b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/Makefile
new file mode 100644
index 000000000000..110d078f4577
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/Makefile
@@ -0,0 +1 @@
+include ../shared.mk
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/macOS/MyClass.cs b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/MyClass.cs
new file mode 120000
index 000000000000..a8c5f5dd7287
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/MyClass.cs
@@ -0,0 +1 @@
+../MyClass.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/macOS/StructsAndEnums.cs b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/StructsAndEnums.cs
new file mode 120000
index 000000000000..082d90ff1d72
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/macOS/StructsAndEnums.cs
@@ -0,0 +1 @@
+../StructsAndEnums.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/shared.csproj b/tests/dotnet/BindingWithDefaultCompileInclude/shared.csproj
new file mode 100644
index 000000000000..7fe687540b0f
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/shared.csproj
@@ -0,0 +1,13 @@
+
+
+
+ true
+
+
+
+
+
+
+
+
+
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/shared.mk b/tests/dotnet/BindingWithDefaultCompileInclude/shared.mk
new file mode 100644
index 000000000000..465aa6288e0e
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/shared.mk
@@ -0,0 +1,27 @@
+TOP=../../../..
+include $(TOP)/Make.config
+
+prepare:
+ $(Q) $(MAKE) -C $(TOP)/tests/dotnet copy-dotnet-config
+
+reload:
+ $(Q) $(MAKE) -C $(TOP) -j8 all
+ $(Q) $(MAKE) -C $(TOP) -j8 install
+ $(Q) git clean -xfdq
+
+reload-and-build:
+ $(Q) $(MAKE) reload
+ $(Q) $(MAKE) build
+
+reload-and-run:
+ $(Q) $(MAKE) reload
+ $(Q) $(MAKE) run
+
+build: prepare
+ $(Q) $(DOTNET6) build /bl *.csproj $(MSBUILD_VERBOSITY) $(BUILD_ARGUMENTS)
+
+run: prepare
+ $(Q) $(DOTNET6) build /bl *.csproj $(MSBUILD_VERBOSITY) $(BUILD_ARGUMENTS) -t:Run
+
+diag: prepare
+ $(Q) $(DOTNET6) build /v:diag msbuild.binlog
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/ApiDefinition.cs b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/ApiDefinition.cs
new file mode 120000
index 000000000000..f0f219820ed4
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/ApiDefinition.cs
@@ -0,0 +1 @@
+../ApiDefinition.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/BindingWithDefaultCompileInclude.csproj b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/BindingWithDefaultCompileInclude.csproj
new file mode 100644
index 000000000000..7d0ef2338fb4
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/BindingWithDefaultCompileInclude.csproj
@@ -0,0 +1,8 @@
+
+
+
+ net6.0-tvos
+
+
+
+
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/Makefile b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/Makefile
new file mode 100644
index 000000000000..110d078f4577
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/Makefile
@@ -0,0 +1 @@
+include ../shared.mk
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/MyClass.cs b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/MyClass.cs
new file mode 120000
index 000000000000..a8c5f5dd7287
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/MyClass.cs
@@ -0,0 +1 @@
+../MyClass.cs
\ No newline at end of file
diff --git a/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/StructsAndEnums.cs b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/StructsAndEnums.cs
new file mode 120000
index 000000000000..082d90ff1d72
--- /dev/null
+++ b/tests/dotnet/BindingWithDefaultCompileInclude/tvOS/StructsAndEnums.cs
@@ -0,0 +1 @@
+../StructsAndEnums.cs
\ No newline at end of file
diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs
index 8ac57baa9ffc..f93c3dc20a39 100644
--- a/tests/dotnet/UnitTests/ProjectTest.cs
+++ b/tests/dotnet/UnitTests/ProjectTest.cs
@@ -617,6 +617,34 @@ public void SimpleAppWithOldReferences (ApplePlatform platform, string runtimeId
}
[Test]
+ [TestCase (ApplePlatform.iOS)]
+ [TestCase (ApplePlatform.TVOS)]
+ [TestCase (ApplePlatform.MacCatalyst)]
+ [TestCase (ApplePlatform.MacOSX)]
+ public void BindingWithDefaultCompileInclude (ApplePlatform platform)
+ {
+ var project = "BindingWithDefaultCompileInclude";
+ Configuration.IgnoreIfIgnoredPlatform (platform);
+
+ var project_path = GetProjectPath (project, platform: platform);
+ Clean (project_path);
+
+ var rv = DotNet.AssertBuild (project_path, GetDefaultProperties ());
+
+ var dllPath = Path.Combine (Path.GetDirectoryName (project_path), "bin", "Debug", platform.ToFramework (), $"{project}.dll");
+ Assert.That (dllPath, Does.Exist, "Binding assembly");
+
+ // Verify that the MyNativeClass class exists in the assembly, and that it's actually a class.
+ var ad = AssemblyDefinition.ReadAssembly (dllPath, new ReaderParameters { ReadingMode = ReadingMode.Deferred });
+ var myNativeClass = ad.MainModule.Types.FirstOrDefault (v => v.FullName == "MyApiDefinition.MyNativeClass");
+ Assert.IsFalse (myNativeClass.IsInterface, "IsInterface");
+ var myStruct = ad.MainModule.Types.FirstOrDefault (v => v.FullName == "MyClassLibrary.MyStruct");
+ Assert.IsTrue (myStruct.IsValueType, "MyStruct");
+
+ var warnings = BinLog.GetBuildLogWarnings (rv.BinLogPath).Select (v => v.Message);
+ Assert.That (warnings, Is.Empty, $"Build warnings:\n\t{string.Join ("\n\t", warnings)}");
+ }
+
[TestCase (ApplePlatform.iOS, "iossimulator-x64")]
[TestCase (ApplePlatform.TVOS, "tvossimulator-x64")]
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")]
diff --git a/tests/dotnet/UnitTests/TestBaseClass.cs b/tests/dotnet/UnitTests/TestBaseClass.cs
index 8787ac790cb0..2e65fd07906a 100644
--- a/tests/dotnet/UnitTests/TestBaseClass.cs
+++ b/tests/dotnet/UnitTests/TestBaseClass.cs
@@ -20,7 +20,7 @@ public abstract class TestBaseClass {
{ "_BundlerVerbosity", "1" },
};
- protected Dictionary GetDefaultProperties (string? runtimeIdentifiers)
+ protected Dictionary GetDefaultProperties (string? runtimeIdentifiers = null)
{
var rv = new Dictionary (verbosity);
if (!string.IsNullOrEmpty (runtimeIdentifiers))