-
Notifications
You must be signed in to change notification settings - Fork 533
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
[.NET6] msbuild node reuse causes error MSB4044: The "Aapt2Link" task was not given a value for the required parameter "ApplicationName" #5749
Comments
Thats odd cos our Aapt2* based classes don't have an @jonathanpeppers does that sound about right? |
I think what is happening is a newer It doesn't look like the right assembly is loaded. |
The issue can be both ways, |
So you could probably have 16.10 and 16.9 open at the same time and hit the same issue? Or is this only a problem when the same VS version is open? |
I only use one version of 16.9, but multiple instances, but it looks like msbuild nodes are reused across. |
This is becoming a bigger issue in .NET 6 Preview 6. Right now you'd have to install the same build from our release branch:
Otherwise you'll run into various errors where the assemblies don't match. |
The fix for this issue will involve strong-naming See also: |
Context: http://github.com/xamarin/xamarin-android/commit/2d81740cc1c708cd0474c9eac8936cd7abfc72e3 Context: dotnet/android#5749 In order to better support building solutions which reference both .NET 6 and legacy projects within Visual Studio, we have begun strong-naming all the MSBuild-related assemblies; see also 87acd6b. This allows loading two different version of the "same" assembly, e.g. `Microsoft.Android.Build.BaseTasks.dll`, from two different locations within the same AppDomain/AssemblyLoadContext. However, strong-naming is only part of the solution. The other part is that, for sanity and reliability, the "two different versions of the 'same' assembly" should *also* have different assembly *versions*. If they have the same assembly version, are they truly different? Update the build system by adding a `Directory.Build.targets` and `GitInfo.txt` file so that the the [`GitInfo`][0] [NuGet Package][1] will be used to "fully" set the `$(Version)` MSBuild property, consisting of the major and minor version numbers contained within `GitInfo.txt`, along with a "computed" `$(GitSemVerPatch)` value based on the "patch version" in `GitInfo.txt`, if present, added to the number of commits which have occurred since `GitInfo.txt` changed. Additionally, set the `$(InformationalVersion)` MSBuild property so that it mirrors the behavior in [`Mono.Android.dll`][2]: [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.1; git-rev-head:4c2e36c; git-branch: main") [0]: https://github.com/devlooped/GitInfo [1]: https://www.nuget.org/packages/GitInfo/2.1.2 [2]: dotnet/android@b620689
Context: http://github.com/xamarin/xamarin-android/commit/2d81740cc1c708cd0474c9eac8936cd7abfc72e3 Context: dotnet/android#5749 In order to better support building solutions which reference both .NET 6 and legacy projects within Visual Studio, we have begun strong-naming all the MSBuild-related assemblies; see also 87acd6b. This allows loading two different version of the "same" assembly, e.g. `Microsoft.Android.Build.BaseTasks.dll`, from two different locations within the same AppDomain/AssemblyLoadContext. However, strong-naming is only part of the solution. The other part is that, for sanity and reliability, the "two different versions of the 'same' assembly" should *also* have different assembly *versions*. If they have the same assembly version, are they truly different? Update the build system by adding a `Directory.Build.targets` and `GitInfo.txt` file so that the the [`GitInfo`][0] [NuGet Package][1] will be used to "fully" set the `$(Version)` MSBuild property, consisting of the major and minor version numbers contained within `GitInfo.txt`, along with a "computed" `$(GitSemVerPatch)` value based on the "patch version" in `GitInfo.txt`, if present, added to the number of commits which have occurred since `GitInfo.txt` changed. Additionally, set the `$(InformationalVersion)` MSBuild property so that it mirrors the behavior in [`Mono.Android.dll`][2]: [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.1; git-rev-head:4c2e36c; git-branch:main") [0]: https://github.com/devlooped/GitInfo [1]: https://www.nuget.org/packages/GitInfo/2.1.2 [2]: dotnet/android@b620689
[build] Use GitInfo to generate $(Version) (#865) Context: http://github.com/xamarin/xamarin-android/commit/2d81740cc1c708cd0474c9eac8936cd7abfc72e3 Context: dotnet/android#5749 In order to better support building solutions which reference both .NET 6 and legacy projects within Visual Studio, we have begun strong-naming all the MSBuild-related assemblies; see also ff27142. This allows loading two different version of the "same" assembly, e.g. `Java.Interop.Tools.Diagnostics.dll`, from two different filesystem locations in the same AppDomain/AssemblyLoadContext. However, strong-naming is only part of the solution. The other part is that, for sanity and reliability, the "two different versions of the 'same' assembly" should *also* have different assembly *versions*. If they have the same assembly version, are they truly different? Update the build system by adding a `Directory.Build.targets` and `GitInfo.txt` file so that the the [`GitInfo`][0] [NuGet Package][1] will be used to "fully" set the `$(Version)` MSBuild property, consisting of the major and minor version numbers contained within `GitInfo.txt`, along with a "computed" `$(GitSemVerPatch)` value based on the "patch version" in `GitInfo.txt`, if present, added to the number of commits which have occurred since `GitInfo.txt` changed. Additionally, set the `$(InformationalVersion)` MSBuild property so that it mirrors the behavior in [`Mono.Android.dll`][2]: [assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.1.1; git-rev-head:2eb9ff2; git-branch:main") Setting the `$(Version)` and `$(InformationalVersion)` MSBuild properties also requires setting `$(GenerateAssemblyInfo)`=True. Update `src/Java.Interop/Properties/AssemblyInfo.cs` to remove the attributes that `$(GenerateAssemblyInfo)` will generate. Other: * Centralize the `$(Company)` and `$(Copyright)` values. * Various whitespace changes due to `.editorconfig`. [0]: https://github.com/devlooped/GitInfo [1]: https://www.nuget.org/packages/GitInfo/2.1.2 [2]: dotnet/android@b620689
This appears to be fixed when using Visual Studio 2022 and .NET 6 RC1 builds. I can at least build .NET 6 and "legacy" Xamarin.Android project templates in the same solution, and see different assemblies being used now. "legacy":
.NET 6:
.NET 6 RC 2 should get us to an even better place, as we also added assembly versioning for all MSBuild assemblies. |
Context: #5749 Changes: xamarin/monodroid@5676b84...0156d4e * xamarin/monodroid@0156d4e51: Bump to xamarin/androidtools@ae1f8fbe (#1225) * xamarin/monodroid@33a26e453: Bump to xamarin/android-sdk-installer@98fa41ba (#1224)
Fixes: #6271 Context: 2d81740 Context: #5749 Context: dotnet/java-interop@d16b1e5 Changes: dotnet/java-interop@f359e73...8f7ddcd * dotnet/java-interop@8f7ddcdd: [build] Fix 'BuildVersionInfo_g_cs' build target. (#881) * dotnet/java-interop@7068f4b2: [build] Enable string operations globalization code analyzers. (#879) * dotnet/java-interop@3e6a6232: [build] Use GitInfo to Generate Version information. (#875) In order to better support building solutions which reference both .NET 6 and legacy projects within Visual Studio, we have begun strong-naming all the MSBuild-related assemblies; see also 2d81740. This allows loading two different version of the "same" assembly, e.g. `Java.Interop.Tools.Diagnostics.dll`, from two different filesystem locations in the same AppDomain/AssemblyLoadContext. However, strong-naming is only part of the solution. The other part is that, for sanity and reliability, the "two different versions of the 'same' assembly" should *also* have different assembly *versions*. If they have the same assembly version, are they truly different? Multiple sub-modules have been updated to use the [`GitInfo`][0] [NuGet Package][1] so that assembly versions are unique per-commit: * `external/xamarin-android-tools`: 25c5cb5 * `.external` & `monodroid`: 2d81740 Update the `external/Java.Interop` submodule to follow suit. This in turn requires updates to `xaprepare` and the CI YAML files to ensure that `GitInfo` is configured correctly within Java.Interop. [0]: https://github.com/devlooped/GitInfo [1]: https://www.nuget.org/packages/GitInfo/2.1.2
[build] Use GitInfo to generate $(Version) (#865) Context: http://github.com/xamarin/xamarin-android/commit/2d81740cc1c708cd0474c9eac8936cd7abfc72e3 Context: dotnet/android#5749 In order to better support building solutions which reference both .NET 6 and legacy projects within Visual Studio, we have begun strong-naming all the MSBuild-related assemblies; see also ff27142. This allows loading two different version of the "same" assembly, e.g. `Java.Interop.Tools.Diagnostics.dll`, from two different filesystem locations in the same AppDomain/AssemblyLoadContext. However, strong-naming is only part of the solution. The other part is that, for sanity and reliability, the "two different versions of the 'same' assembly" should *also* have different assembly *versions*. If they have the same assembly version, are they truly different? Update the build system by adding a `Directory.Build.targets` and `GitInfo.txt` file so that the the [`GitInfo`][0] [NuGet Package][1] will be used to "fully" set the `$(Version)` MSBuild property, consisting of the major and minor version numbers contained within `GitInfo.txt`, along with a "computed" `$(GitSemVerPatch)` value based on the "patch version" in `GitInfo.txt`, if present, added to the number of commits which have occurred since `GitInfo.txt` changed. Additionally, set the `$(InformationalVersion)` MSBuild property so that it mirrors the behavior in [`Mono.Android.dll`][2]: [assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.1.1; git-rev-head:2eb9ff2; git-branch:main") Setting the `$(Version)` and `$(InformationalVersion)` MSBuild properties also requires setting `$(GenerateAssemblyInfo)`=True. Update `src/Java.Interop/Properties/AssemblyInfo.cs` to remove the attributes that `$(GenerateAssemblyInfo)` will generate. Other: * Centralize the `$(Company)` and `$(Copyright)` values. * Various whitespace changes due to `.editorconfig`. [0]: https://github.com/devlooped/GitInfo [1]: https://www.nuget.org/packages/GitInfo/2.1.2 [2]: dotnet/android@b620689
Steps to Reproduce
net6.0-android
in a visual studio instanceExpected Behavior
No build error.
Actual Behavior
The build randomly fails with:
Version Information
.NET 6 preview 2
Log File
The text was updated successfully, but these errors were encountered: