-
Notifications
You must be signed in to change notification settings - Fork 548
Description
Apple platform
iOS
Framework version
net9.0-*
Affected platform version
NET 9.0.304
Description
Hi, we created a .NuGet package using the NuGetCommand@2 on Azure. The .NuGet package contains .NET Maui views and libraries. We then have a .NET Maui project that consumes that .NuGet package to display the views. This works fine in .NET 8.
After updating to .NET 9, the original project (that the .NuGet package is built from) runs fine on iOS. But the project consuming the package gets the following errors when building on iOS:
The type 'EventHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
The type 'TimeSpan' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
Builds fine when targeting Android or Windows, hence I am raising this question in the Xamarin.iOS project. Both projects are on .NET Maui 9.0.90 and .NET version 9.0.304 (9.0.8 runtime). I have tried :
- Clearing nuget cache
- Restarting Visual Studio
- Reinstalling Maui & .NET
- Disable trimming on iOS
- Add
SkipStaticValidation = true
on my .csproj - Made sure both projects target 'net9.0-ios'.
None of these options worked. It seems weird to me that Windows & Android could run when missing System.Private.Corelib
. Could someone help me find the cause of this issue ?
Steps to Reproduce
- Create .NET Maui project which includes a view / viewmodel that is declared public.
- Package the project into a .NuGet package via DotNet Publish and NuGetCommand@2
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 6.x'
inputs:
versionSpec: 6.x
- task: DotNetCoreCLI@2
displayName: 'Build for net9.0 target'
inputs:
command: 'build'
publishWebProjects: false
projects: 'Mobile/VertiGIS.Mobile.csproj'
arguments: '-f net9.0 -c Release /nowarn:NU1903;NU1904;XC0025;XC0103 -p:RunAnalyzers=false'
zipAfterPublish: false
modifyOutputPath: false
- task: NuGetCommand@2
displayName: "Create Mobile NuGet Package"
inputs:
command: "pack"
packagesToPack: "_NuGet/VertiGIS.Mobile.nuspec"
configuration: "release"
packDestination: "$(ArtifactDirectory)/Packages"
versioningScheme: "byEnvVar"
versionEnvVar: "Build.NugetVersion"
- Add the nuget package as a dependency to a .NET Maui project. Consume the public views from the nuget package.
- Try to build on iOS.
Did you find any workaround?
No response
Build logs
1>Including assemblies for Hot Reload support
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(12,24,12,34): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(19,13,19,21): warning CS0618: 'Application.MainPage.set' is obsolete: 'This property is deprecated. Initialize your application by overriding Application.CreateWindow rather than setting MainPage. To modify the root page in an active application, use Windows[0].Page for applications with a single window. For applications with multiple windows, use Application.Windows to identify and update the root page on the correct window. Additionally, each element features a Window property, accessible when it's part of the current window.'
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(62,32,62,45): error CS0012: The type 'EventHandler<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(66,24,66,37): error CS0012: The type 'EventHandler<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(73,39,73,54): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(73,19,73,54): error CS0012: The type 'Task' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(75,66,75,78): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(75,33,75,78): error CS0012: The type 'Task<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(76,52,76,67): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(76,19,76,67): error CS0012: The type 'Task' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(82,33,82,47): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\App.xaml.cs(94,37,94,48): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(43,20,43,24): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(43,42,43,71): error CS0012: The type 'TimeSpan' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(43,13,43,24): error CS0012: The type 'FormattableString' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(47,33,47,41): error CS0012: The type 'EventHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(49,17,49,53): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(51,28,51,54): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(56,13,56,29): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
1>C:\Users\eliu\source\repos\vertigis-mobile-quickstart\App1\Platforms\iOS\AppDelegate.cs(58,33,58,41): error CS0012: The type 'EventHandler' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.