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
[One .NET] fixes for System.* PackageReference #6043
Merged
jonathanpeppers
merged 1 commit into
xamarin:main
from
jonathanpeppers:dotnet-system-packagereference
Jun 24, 2021
Merged
[One .NET] fixes for System.* PackageReference #6043
jonathanpeppers
merged 1 commit into
xamarin:main
from
jonathanpeppers:dotnet-system-packagereference
Jun 24, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context: dotnet/maui#1309 (comment) dotnet/maui projects are failing to build after adding new ASP.NET assemblies for BlazorWebView: error XABLD7024: System.IO.IOException: The process cannot access the file 'D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\obj\Release\net6.0-android\android\lz4\System.Runtime.CompilerServices.Unsafe.dll.lz4' because it is being used by another process. [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.AssemblyCompression.Compress(AssemblyData data, String outputDirectory) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.<AddAssemblies>g__CompressAssembly|142_1(ITaskItem assembly, <>c__DisplayClass142_0& ) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.AddAssemblies(ZipArchiveEx apk, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi(String[] supportedAbis, String apkInputPath, String apkOutputPath, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.RunTask() [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] Which appears to be due to a duplicate assembly: Task GenerateCompressedAssembliesNativeSourceFiles ... Skipping duplicate assembly: obj\Release\net6.0-android\android-x86\linked\System.Runtime.CompilerServices.Unsafe.dll If you go earlier in the log: Task ProcessAssemblies ... Android ABI not found for: obj\Release\net6.0-android\android-arm64\linked\System.Runtime.CompilerServices.Unsafe.dll Android ABI not found for: obj\Release\net6.0-android\android-x86\linked\System.Runtime.CompilerServices.Unsafe.dll This is happening because `%(RuntimeIdentifier)` is blank? I could reproduce this in a test, but only after adding a complicated set of `@(PackageReference)` to an app project. I believe what is happening is: * We have a `@(PackageReference)` to a System.* assembly that is also in the Mono runtime packs: `Microsoft.NETCore.App.Runtime.*` * If the `@(PackageReference)` version is *newer* than `Microsoft.NETCore.App.Runtime.*`, then it will be preferred over the other. In this case, `%(RuntimeIdentifier)` is blank on the `@(PackageReference)`. It appears to only be set by runtime packs. Solution: * Set `@(ResolvedFileToPublish.RuntimeIdentifier)` to `$(RuntimeIdentifier)` if it is blank. This solved all my warning messages and my test case now compiles.
18 tasks
dellis1972
approved these changes
Jun 24, 2021
jonathanpeppers
added a commit
that referenced
this pull request
Jun 24, 2021
Context: dotnet/maui#1309 (comment) dotnet/maui projects are failing to build after adding new ASP.NET assemblies for BlazorWebView: error XABLD7024: System.IO.IOException: The process cannot access the file 'D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\obj\Release\net6.0-android\android\lz4\System.Runtime.CompilerServices.Unsafe.dll.lz4' because it is being used by another process. [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.AssemblyCompression.Compress(AssemblyData data, String outputDirectory) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.<AddAssemblies>g__CompressAssembly|142_1(ITaskItem assembly, <>c__DisplayClass142_0& ) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.AddAssemblies(ZipArchiveEx apk, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi(String[] supportedAbis, String apkInputPath, String apkOutputPath, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo) [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Xamarin.Android.Tasks.BuildApk.RunTask() [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] error XABLD7024: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 [D:\a\1\s\src\Controls\samples\Controls.Sample.SingleProject\Maui.Controls.Sample.SingleProject.csproj] Which appears to be due to a duplicate assembly: Task GenerateCompressedAssembliesNativeSourceFiles ... Skipping duplicate assembly: obj\Release\net6.0-android\android-x86\linked\System.Runtime.CompilerServices.Unsafe.dll If you go earlier in the log: Task ProcessAssemblies ... Android ABI not found for: obj\Release\net6.0-android\android-arm64\linked\System.Runtime.CompilerServices.Unsafe.dll Android ABI not found for: obj\Release\net6.0-android\android-x86\linked\System.Runtime.CompilerServices.Unsafe.dll This is happening because `%(RuntimeIdentifier)` is blank? I could reproduce this in a test, but only after adding a complicated set of `@(PackageReference)` to an app project. I believe what is happening is: * We have a `@(PackageReference)` to a System.* assembly that is also in the Mono runtime packs: `Microsoft.NETCore.App.Runtime.*` * If the `@(PackageReference)` version is *newer* than `Microsoft.NETCore.App.Runtime.*`, then it will be preferred over the other. In this case, `%(RuntimeIdentifier)` is blank on the `@(PackageReference)`. It appears to only be set by runtime packs. Solution: * Set `%(ResolvedFileToPublish.RuntimeIdentifier)` to `$(RuntimeIdentifier)` if it is blank. This solved all my warning messages and my test case now compiles.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: dotnet/maui#1309 (comment)
dotnet/maui projects are failing to build after adding new ASP.NET
assemblies for BlazorWebView:
Which appears to be due to a duplicate assembly:
If you go earlier in the log:
This is happening because
%(RuntimeIdentifier)
is blank?I could reproduce this in a test, but only after adding a complicated
set of
@(PackageReference)
to an app project.I believe what is happening is:
@(PackageReference)
to a System.* assembly that is alsoin the Mono runtime packs:
Microsoft.NETCore.App.Runtime.*
@(PackageReference)
version is newer thanMicrosoft.NETCore.App.Runtime.*
, then it will be preferred overthe other.
In this case,
%(RuntimeIdentifier)
is blank on the@(PackageReference)
. It appears to only be set by runtime packs.Solution:
@(ResolvedFileToPublish.RuntimeIdentifier)
to$(RuntimeIdentifier)
if it is blank.This solved all my warning messages and my test case now compiles.