Closed skha83 closed 11 months ago
OK, I can reproduce, and I'll try to fix this next week.
@rolfbjarne I see you fixed this. Is it possible to install this updated build task on top of the latest VS 17.8.0 Preview 3 so that I can continue development?
@philipag I haven't tested this, but there may be a workaround you can apply locally:
Xamarin.Shared.targets
- it's probably something like C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.8968-net8-rc2\tools\msbuild\iOS\Xamarin.Shared.targets
- and open it in a text editor._ExpandNativeReferences
target (around line 140):<Target Name="_ExpandNativeReferences" Condition="'$(DesignTimeBuild)' != 'true'" DependsOnTargets="_DetectSdkLocations;_ComputeTargetArchitectures;_GenerateBundleName">
<ItemGroup>
<_XCFrameworkNativeReference Include="@(NativeReference -> '%(Identity)/.')" Condition="'%(Extension)' == '.xcframework'" />
<_FrameworkNativeReference Include="@(NativeReference -> '%(Identity)/%(Filename)')" Condition="'%(Extension)' == '.framework'" />
<_FileNativeReference Include="@(NativeReference)" Condition="'%(Extension)' != '.framework' And '%(Extension)' != '.xcframework'" />
</ItemGroup>
<ResolveNativeReferences
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And '$(IsBindingProject)' != 'true'"
Architectures="$(TargetArchitectures)"
FrameworksDirectory="$(_AppFrameworksRelativePath)"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
NativeReferences="@(_XCFrameworkNativeReference);@(_FrameworkNativeReference)"
References="@(ReferencePath)"
SdkIsSimulator="$(_SdkIsSimulator)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
<Output TaskParameter="NativeFrameworks" ItemName="_ResolvedNativeReference" />
</ResolveNativeReferences>
<ItemGroup>
<_FrameworkNativeReference Include="@(_ResolvedNativeReference)" Condition="'%(Kind)' == 'Framework'" />
<_FileNativeReference Include="@(_ResolvedNativeReference)" Condition="'%(Kind)' == 'Static' Or '%(Kind)' == 'Dynamic'" />
</ItemGroup>
</Target>
SessionId="$(BuildSessionId)"
line, so that it reads:<Target Name="_ExpandNativeReferences" Condition="'$(DesignTimeBuild)' != 'true'" DependsOnTargets="_DetectSdkLocations;_ComputeTargetArchitectures;_GenerateBundleName">
<ItemGroup>
<_XCFrameworkNativeReference Include="@(NativeReference -> '%(Identity)/.')" Condition="'%(Extension)' == '.xcframework'" />
<_FrameworkNativeReference Include="@(NativeReference -> '%(Identity)/%(Filename)')" Condition="'%(Extension)' == '.framework'" />
<_FileNativeReference Include="@(NativeReference)" Condition="'%(Extension)' != '.framework' And '%(Extension)' != '.xcframework'" />
</ItemGroup>
<ResolveNativeReferences
Condition="'$(IsMacEnabled)' == 'true' And '$(IsBindingProject)' != 'true'"
Architectures="$(TargetArchitectures)"
FrameworksDirectory="$(_AppFrameworksRelativePath)"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
NativeReferences="@(_XCFrameworkNativeReference);@(_FrameworkNativeReference)"
References="@(ReferencePath)"
SdkIsSimulator="$(_SdkIsSimulator)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
<Output TaskParameter="NativeFrameworks" ItemName="_ResolvedNativeReference" />
</ResolveNativeReferences>
<ItemGroup>
<_FrameworkNativeReference Include="@(_ResolvedNativeReference)" Condition="'%(Kind)' == 'Framework'" />
<_FileNativeReference Include="@(_ResolvedNativeReference)" Condition="'%(Kind)' == 'Static' Or '%(Kind)' == 'Dynamic'" />
</ItemGroup>
</Target>
With this temporary fix I'm able to build my app targeting iOS again π thx a lot
Got this error when trying the temp fix unfortunately:
Error MSB4018 The "ResolveNativeReferences" task failed unexpectedly.
@rolfbjarne Hello. When I try your fix it seems like it works but when I try to open the app on the phone after build is done it just opens quickly and then closes again.
@rolfbjarne this happens because MobileAds.SharedInstance is null with in the AppDelegate.cs FinishedLaunching method. This work around only allows you to build locally, but when you connect to mac you receive a totally different error. Have anyone found a fix where you can actually build using remote device, while paired to a mac?
@rolfbjarne this happens because MobileAds.SharedInstance is null with in the AppDelegate.cs FinishedLaunching method. This work around only allows you to build locally, but when you connect to mac you receive a totally different error. Have anyone found a fix where you can actually build using remote device, while paired to a mac?
This should be fixed once we release .NET 8.
Might be something similar to #19152 or at least the second comment in that issue.
Steps to Reproduce
Expected Behavior
App builds and deploys to device without problems
Actual Behavior
The build fails. This Nuget package and build worked on previous preview versions and RC1 of .NET 8.0. I have tried with both Xcode 14.3 and Xcode 15 on the remote Mac.
The build fails with the following warning and errors. The first warning is probably what generate the last error as it can't find symbol references because of the warning. I have checked that the file is located in the given folder. Warning in the start of the build:
Error in the end of the build:
Environment
Version information
``` Microsoft Visual Studio Professional 2022 Version 17.8.0 Preview 3.0 VisualStudio.17.Preview/17.8.0-pre.3.0+34205.153 Microsoft .NET Framework Version 4.8.04084 Installed Version: Professional ASP.NET and Web Tools 17.8.339.8044 ASP.NET and Web Tools Azure App Service Tools v3.0.0 17.8.339.8044 Azure App Service Tools v3.0.0 C# Tools 4.8.0-3.23504.4+81d9274600db701a8b08ed8af3fd6b00a775cc33 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Extensibility Message Bus 1.4.39 (main@e8108eb) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Mono Debugging for Visual Studio 17.8.17 (957fbed) Support for debugging Mono processes with Visual Studio. NuGet Package Manager 6.8.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ Razor (ASP.NET Core) 17.8.3.2350401+8de09384414b0f850b29991342b4c40c423a8b40 Provides languages services for ASP.NET Core Razor. StylerPackage Extension 1.0 StylerPackage Visual Stuido Extension Detailed Info TypeScript Tools 17.0.20920.2001 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 4.8.0-3.23504.4+81d9274600db701a8b08ed8af3fd6b00a775cc33 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual F# Tools 17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50 Microsoft Visual F# Tools Visual Studio Extension for SpecFlow 1.0 Visual Studio extension for working with SpecFlow projects and Gherkin feature files. Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio. VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio VSPackage Extension 1.0 VSPackage Visual Studio Extension Detailed Info Xamarin 17.8.0.147 (d17-8@592be68) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 17.8.3.6 (remotes/origin/d17-8@eccf46a291) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 17.8.16 (830b56a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14) Xamarin.Android Reference Assemblies and MSBuild support. Mono: d9a6e87 Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d Xamarin.iOS and Xamarin.Mac SDK 16.4.0.18 (9d266025e) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```Build Logs
Output-Build.txt https://github.com/skha83/MauiIosError/blob/main/Output-Build.txt
Example Project (If Possible)
https://github.com/skha83/MauiIosError