-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[build] Target net7.0
.
#988
Conversation
Waiting for the latest results for dotnet/android#7028, but I think this should be good to go. |
tools/class-parse/class-parse.csproj
Outdated
<TargetFrameworks>net472;net6.0</TargetFrameworks> | ||
<TargetFrameworks>net472;$(DotNetStableTargetFramework)</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a thing like $(DotNetStableTargetFramework)
in xamarin-android for console apps that are used during our build. Should utilities we ship like class-parse
actually build against 7? It is invoked from MSBuild in customer projects, but they should have a .NET 7 SDK.
We can also wait and update these later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured $(DotNetStableTargetFramework)
would also be useful in JI for certain projects, but using it more widely was a bit of a hassle. Keeping the tools that XA ships on a stable .NET version gives us the flexibility to not require a system wide .NET 7 install in XA for now. If we bump these to net7.0 XA will require a global net7.0 install, or we'll need to update our build tasks to run the tool with our local dotnet install. I don't mind bumping these to net7.0 now but I didn't see a strong need to do so, but maybe I am not considering something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with whatever is easiest for now, but we should endeavor to get everything we ship running on .NET 7 previews since that is how our customers will eventually receive it. We need to find any issues caused by .NET 7 before they do. 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look too closely, but I think the AndroidDotnetToolTask that runs tools like generator and class parse only uses the dotnet
that is found in path? In our XA build case where we test out of a "sandboxed" location I think we end running these tools with the latest version installed system wide. We may want to update that task to try to detect and use the dotnet
path that the project is being built from, assuming this is the case. I can investigate this further outside of this PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there must be some logic when you Process.Start("dotnet")
from inside a dotnet
process, for example dotnet run
just does this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure, previous XA PR builds testing these changes had issues running class-parse and other tools because the XA test environments no longer have NET 7 installed system wide. That blob also mentions an old unresolved issue that seems related. I put up dotnet/android#7038 for now, we can discuss this further over there.
I'm going to revert the $(DotNetStableTargetFramework)
changes in this PR.
tools/generator/generator.csproj
Outdated
<TargetFrameworks>net472;net6.0</TargetFrameworks> | ||
<TargetFrameworks>net472;$(DotNetStableTargetFramework)</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this one, should it build for 7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK to leave some of the projects in here on 6, the only problem would be if we wanted to use a feature of .NET 7? I don't know if the fast, source generator Regex
feature, for example, might be useful in generator
or class-parse
.
@@ -1,7 +1,7 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
|
|||
<PropertyGroup> | |||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks> | |||
<TargetFrameworks>netstandard2.0;$(DotNetTargetFramework)</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "confuses" me, and I'm not sure what's going on. $(DotNetTargetFramework)
is net7.0
, thus I would expect bin/Debug-net7.0/Xamarin.Android.Tools.Bytecode.dll
to be a file that exists after a build.
However, it doesn't exist; instead, I have bin/Debug-net6.0/Xamarin.Android.Tools.Bytecode.dll
, which is a copy of the .NET Standard 2.0 build, which is weird.
Meaning, as a consequence of this change, e.g. the net6.0 class-parse.dll
now references the .NET Standard 2.0 build of Xamarin.Android.Tools.Bytecode.dll
(v0.2.0.11), whereas before this change it referenced the net6.0 build, 7.0.0.7.
In this case that likely doesn't matter, as there's no #if NET
in Xamarin.Android.Tools.Bytecode.dll
, but if that ever changed…
I suspect what we actually want/need is to instead add a 3rd $(TargetFramework)
value in many of these places, instead of replacing net6.0
with net7.0
, a'la:
<TargetFrameworks>netstandard2.0;$(DotNetStableTargetFramework);$(DotNetTargetFramework)</TargetFrameworks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or this is a good reason to make everything target net7.0
instead of some things still targeting net6.0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved everything back to target net7.0.
Context: dotnet/java-interop#988 A recent attempt to update Java.Interop to target net7.0 produced some test failures on the Xamarin.Android side: Using "ClassParse" task from assembly "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Build.Tasks.dll". Task "ClassParse" (TaskId:139) Task Parameter:ToolPath=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools (TaskId:139) Task Parameter:OutputFile=obj/Debug/api.xml.class-parse (TaskId:139) Task Parameter:SourceJars=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar (TaskId:139) Using: dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll (TaskId:139) [class-parse] response file: obj/Debug/class-parse.rsp (TaskId:139) --o="obj/Debug/api.xml.class-parse" (TaskId:139) "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar" (TaskId:139) /Users/runner/.dotnet/dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll "@obj/Debug/class-parse.rsp" (TaskId:139) It was not possible to find any compatible framework version (TaskId:139) The framework 'Microsoft.NETCore.App', version '7.0.0-preview.5.22271.4' (x64) was not found. (TaskId:139) - The following frameworks were found: (TaskId:139) 3.1.1 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.3 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.6 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.25 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.2 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.8 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.17 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 6.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) (TaskId:139) You can resolve the problem by installing the specified framework and/or SDK. (TaskId:139) (TaskId:139) The specified framework can be found at: (TaskId:139) - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0-preview.5.22271.4&arch=x64&rid=osx.12-x64 (TaskId:139) 1:7>/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 150. [/Users/runner/work/1/a/TestRelease/05-25_01.03.40/temp/BuildWithExternalJavaLibrary/BuildWithExternalJavaLibraryBinding/BuildWithExternalJavaLibraryBinding.csproj] Commit ff7f467 removed the need to have a global .NET 7 preview install to build and test Xamarin.Android. This appears to expose an issue in `AndroidDotnetToolTask`, which uses the latest `dotnet` in $PATH to run some of our tools. After upgrading some of these tools (class-parse, generator) to net7.0, we are no longer able to run them as there is no net7.0 runtime installed globally. Improve the `AndroidDotnetToolTask` to better handle "sandboxed" .NET installations by using a full path to `dotnet` if one is found.
Context: dotnet/java-interop#988 A recent attempt to update Java.Interop to target net7.0 produced some test failures on the Xamarin.Android side: Using "ClassParse" task from assembly "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Build.Tasks.dll". Task "ClassParse" (TaskId:139) Task Parameter:ToolPath=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools (TaskId:139) Task Parameter:OutputFile=obj/Debug/api.xml.class-parse (TaskId:139) Task Parameter:SourceJars=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar (TaskId:139) Using: dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll (TaskId:139) [class-parse] response file: obj/Debug/class-parse.rsp (TaskId:139) --o="obj/Debug/api.xml.class-parse" (TaskId:139) "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar" (TaskId:139) /Users/runner/.dotnet/dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll "@obj/Debug/class-parse.rsp" (TaskId:139) It was not possible to find any compatible framework version (TaskId:139) The framework 'Microsoft.NETCore.App', version '7.0.0-preview.5.22271.4' (x64) was not found. (TaskId:139) - The following frameworks were found: (TaskId:139) 3.1.1 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.3 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.6 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.25 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.2 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.8 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.17 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 6.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) (TaskId:139) You can resolve the problem by installing the specified framework and/or SDK. (TaskId:139) (TaskId:139) The specified framework can be found at: (TaskId:139) - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0-preview.5.22271.4&arch=x64&rid=osx.12-x64 (TaskId:139) 1:7>/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 150. [/Users/runner/work/1/a/TestRelease/05-25_01.03.40/temp/BuildWithExternalJavaLibrary/BuildWithExternalJavaLibraryBinding/BuildWithExternalJavaLibraryBinding.csproj] Commit ff7f467 removed the need to have a global .NET 7 preview install to build and test Xamarin.Android. This appears to expose an issue in `AndroidDotnetToolTask`, which uses the latest `dotnet` in $PATH to run some of our tools. After upgrading some of these tools (class-parse, generator) to net7.0, we are no longer able to run them as there is no net7.0 runtime installed globally. Improve the `AndroidDotnetToolTask` to better handle "sandboxed" .NET installations by using a full path to `dotnet` if one is found.
Context: dotnet/java-interop#988 A recent attempt to update Java.Interop to target net7.0 produced some test failures on the Xamarin.Android side: Using "ClassParse" task from assembly "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Build.Tasks.dll". Task "ClassParse" (TaskId:139) Task Parameter:ToolPath=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools (TaskId:139) Task Parameter:OutputFile=obj/Debug/api.xml.class-parse (TaskId:139) Task Parameter:SourceJars=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar (TaskId:139) Using: dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll (TaskId:139) [class-parse] response file: obj/Debug/class-parse.rsp (TaskId:139) --o="obj/Debug/api.xml.class-parse" (TaskId:139) "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar" (TaskId:139) /Users/runner/.dotnet/dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll "@obj/Debug/class-parse.rsp" (TaskId:139) It was not possible to find any compatible framework version (TaskId:139) The framework 'Microsoft.NETCore.App', version '7.0.0-preview.5.22271.4' (x64) was not found. (TaskId:139) - The following frameworks were found: (TaskId:139) 3.1.1 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.3 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.6 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.25 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.2 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.8 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.17 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 6.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) (TaskId:139) You can resolve the problem by installing the specified framework and/or SDK. (TaskId:139) (TaskId:139) The specified framework can be found at: (TaskId:139) - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0-preview.5.22271.4&arch=x64&rid=osx.12-x64 (TaskId:139) 1:7>/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 150. [/Users/runner/work/1/a/TestRelease/05-25_01.03.40/temp/BuildWithExternalJavaLibrary/BuildWithExternalJavaLibraryBinding/BuildWithExternalJavaLibraryBinding.csproj] Commit ff7f467 removed the need to have a global .NET 7 preview install to build and test Xamarin.Android. This appears to expose an issue in `AndroidDotnetToolTask`, which uses the latest `dotnet` in $PATH to run some of our tools. After upgrading some of these tools (class-parse, generator) to net7.0, we are no longer able to run them as there is no net7.0 runtime installed globally. Improve the `AndroidDotnetToolTask` to better handle "sandboxed" .NET installations by using a full path to `dotnet` if one is found.
Context: https://github.com/xamarin/xamarin-android/pull/6598
Update `$(TargetFrameworks)` across the various `.csproj` files to
use `$(DotNetTargetFramework)`, as xamarin/xamarin-android does.
Additionally, set `$(DotNetTargetFramework)`=net7.0 (.NET 7).
Similar to commit e7bacc37, Mono cannot be used to build against
.NET 7 reference assemblies:
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5):
error MSB3971: The reference assemblies for ".NETFramework,Version=v7.0" were not found.
You might be using an older .NET SDK to target .NET 5.0 or higher.
Update Visual Studio and/or your .NET SDK.
Fix this by updating the **Mac - Mono** CI job to *build* with .NET 7,
while Mono-focused unit tests are still run with Mono.
Co-authored-by: Peter Collins <[email protected]> |
Context: dotnet/java-interop#988 A recent attempt to update Java.Interop to target net7.0 produced some test failures on the Xamarin.Android side: Using "ClassParse" task from assembly "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Build.Tasks.dll". Task "ClassParse" (TaskId:139) Task Parameter:ToolPath=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools (TaskId:139) Task Parameter:OutputFile=obj/Debug/api.xml.class-parse (TaskId:139) Task Parameter:SourceJars=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar (TaskId:139) Using: dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll (TaskId:139) [class-parse] response file: obj/Debug/class-parse.rsp (TaskId:139) --o="obj/Debug/api.xml.class-parse" (TaskId:139) "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar" (TaskId:139) /Users/runner/.dotnet/dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll "@obj/Debug/class-parse.rsp" (TaskId:139) It was not possible to find any compatible framework version (TaskId:139) The framework 'Microsoft.NETCore.App', version '7.0.0-preview.5.22271.4' (x64) was not found. (TaskId:139) - The following frameworks were found: (TaskId:139) 3.1.1 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.3 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.6 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.25 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.2 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.8 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.17 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 6.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) (TaskId:139) You can resolve the problem by installing the specified framework and/or SDK. (TaskId:139) (TaskId:139) The specified framework can be found at: (TaskId:139) - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0-preview.5.22271.4&arch=x64&rid=osx.12-x64 (TaskId:139) 1:7>/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 150. [/Users/runner/work/1/a/TestRelease/05-25_01.03.40/temp/BuildWithExternalJavaLibrary/BuildWithExternalJavaLibraryBinding/BuildWithExternalJavaLibraryBinding.csproj] Commit ff7f467 removed the need to have a global .NET 7 preview install to build and test Xamarin.Android. This appears to expose an issue in `AndroidDotnetToolTask`, which uses the latest `dotnet` in $PATH to run some of our tools. After upgrading some of these tools (class-parse, generator) to net7.0, we are no longer able to run them as there is no net7.0 runtime installed globally. Improve the `AndroidDotnetToolTask` to better handle "sandboxed" .NET installations by using a full path to `dotnet` if one is found.
Context: dotnet/java-interop#988 A recent attempt to update Java.Interop to target net7.0 produced some test failures on the Xamarin.Android side: Using "ClassParse" task from assembly "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Build.Tasks.dll". Task "ClassParse" (TaskId:139) Task Parameter:ToolPath=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools (TaskId:139) Task Parameter:OutputFile=obj/Debug/api.xml.class-parse (TaskId:139) Task Parameter:SourceJars=/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar (TaskId:139) Using: dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll (TaskId:139) [class-parse] response file: obj/Debug/class-parse.rsp (TaskId:139) --o="obj/Debug/api.xml.class-parse" (TaskId:139) "/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/android-support-multidex.jar" (TaskId:139) /Users/runner/.dotnet/dotnet /Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/class-parse.dll "@obj/Debug/class-parse.rsp" (TaskId:139) It was not possible to find any compatible framework version (TaskId:139) The framework 'Microsoft.NETCore.App', version '7.0.0-preview.5.22271.4' (x64) was not found. (TaskId:139) - The following frameworks were found: (TaskId:139) 3.1.1 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.3 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.6 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 3.1.25 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.2 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.8 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 5.0.17 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) 6.0.5 at [/Users/runner/.dotnet/shared/Microsoft.NETCore.App] (TaskId:139) (TaskId:139) You can resolve the problem by installing the specified framework and/or SDK. (TaskId:139) (TaskId:139) The specified framework can be found at: (TaskId:139) - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0-preview.5.22271.4&arch=x64&rid=osx.12-x64 (TaskId:139) 1:7>/Users/runner/work/1/s/xamarin-android/bin/Release/dotnet/packs/Microsoft.Android.Sdk.Darwin/33.0.0-ci.pr.gh7028.23/tools/Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "dotnet" exited with code 150. [/Users/runner/work/1/a/TestRelease/05-25_01.03.40/temp/BuildWithExternalJavaLibrary/BuildWithExternalJavaLibraryBinding/BuildWithExternalJavaLibraryBinding.csproj] Commit ff7f467 removed the need to have a global .NET 7 preview install to build and test Xamarin.Android. This appears to expose an issue in `AndroidDotnetToolTask`, which uses the latest `dotnet` in $PATH to run some of our tools. After upgrading some of these tools (class-parse, generator) to net7.0, we are no longer able to run them as there is no net7.0 runtime installed globally. Improve the `AndroidDotnetToolTask` to better handle "sandboxed" .NET installations by using a full path to `dotnet` if one is found.
Context: dotnet/android#6598
Update
Java.Interop
<TargetFrameworks>
to use$(DotNetTargetFramework)
like XA does. Additionally, bump this value tonet7.0
.Much like the previous #986, Mono cannot build with the .NET 7 reference assemblies:
In order to fix this, the
Mac - Mono
lane now builds with .NET 7, however the tests are still run with Mono.Command line utilities will continue to be built with stable net6.0.
Test XA PR to ensure it works with XA: dotnet/android#7028.