-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Build of MAUI app fails if NuGet package contains references #11364
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Can you share the Also an MSBuild diagnostic log would help us look into the error message. Thanks! |
Hi @AntonKosenkoDX. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Hello @jonathanpeppers! Thanks for fast response. Hope it helps. |
I've just tried to up target version to android33 and the error still appears( |
@AntonKosenkoDX your <group targetFramework="net7.0-android31.0"/> There are also manual file paths like: <file src=".\..\MyLib\bin\Debug\net7.0-android\MyLib.dll" target="ref\net7.0-android31.0"/>
<file src=".\..\MyLib\bin\Debug\net7.0-android\MyLib.dll" target="lib\net7.0-android31.0"/>
<file src=".\..\MyUtilities\bin\Debug\net7.0-android\MyUtilities.dll" target="lib\net7.0-android31.0"/>
<file src=".\..\MyLib\bin\Debug\net7.0-android\MyLib.aar" target="lib\net7.0-android31.0"/>
<file src=".\..\MyUtilities\bin\Debug\net7.0-android\MyUtilities.aar" target="lib\net7.0-android31.0"/> If you change these all to 33, does it solve the issue? |
Hi @AntonKosenkoDX. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@jonathanpeppers As I said before I updated android version to 33 in my |
I can try it again on Monday, it looks like you updated the repo above. |
Ok, thanks! |
So it's been a little while since I've used a See: AntonKosenkoDX/nuget-refs#1 Notes:
I suspect some of these details would have gone away with |
@jonathanpeppers thanks for your PR. |
Can you mark the types I don't think it works for the console app either... If you We're basically seeing the same behavior on Android, except an MSBuild task fails. With the console app it would crash at runtime in a self-contained app. |
Fixes: dotnet/maui#10154 If you have a solution setup with: * `ApplicationA` project reference -> * `LibraryB` reference -> * `LibraryC` The app will crash at runtime, due to a missing `LibraryC.dll`. You can solve the problem by changing `@(Reference)` to a `@(ProjectReference)`. However, it appears the same situation works in a .NET 7 self-contained console app: dotnet publish --self-contained -r win-x64 ... ls -n .\bin\Debug\net7.0\win-x64\publish\LibraryC.dll LibraryC.dll The underlying issue appears to be: https://github.com/dotnet/msbuild/blob/a2490dd3f78cce4abc8f9e6f1b5268437332818f/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2322 In the console app, `$(BuildingProject)` is `true` and `$(_FindDependencies)` is empty. In the android app, `$(BuildingProject)` is `false` and `$(_FindDependencies)` is `false`. It appears the `BuildOnlySettings` target *should* be running in Android apps when we do an "inner" build per `$(RuntimeIdentifier)`. Simply adding a dependency for the `_ComputeFilesToPublishForRuntimeIdentifiers` MSBuild target solves this issue. This likely might fix other issues, such as: dotnet/maui#11364 I added a test for this scenario.
There might be an underlying issue here, such as: @AntonKosenkoDX if you put this in your main app <PropertyGroup>
<_ResolveReferenceDependencies>true</_ResolveReferenceDependencies>
</PropertyGroup> |
) Fixes: dotnet/maui#10154 Context? dotnet/maui#11364 If you have a solution setup with: * `ApplicationA.csproj` has a `@(ProjectReference)` to `LibraryB.csproj`. * `LibraryB.csproj` which has a `@(Reference)` to `LibraryC.dll`, built by- * `LibraryC.csproj` The app will crash at runtime, due to a missing `LibraryC.dll`. The workaround is for `LibraryB.csproj` to use `@(ProjectReference)` to `LibraryC.csproj` instead of `@(Reference)` to `LibraryC.dll`. However, it appears the same situation works in a .NET 7 self-contained console app: % dotnet publish --self-contained -r win-x64 … % ls -1 .\bin\Debug\net7.0\win-x64\publish\LibraryC.dll LibraryC.dll The underlying issue appears to be due to [`$(_FindDependencies)`][0]: <_FindDependencies Condition="'$(BuildingProject)' != 'true' and '$(_ResolveReferenceDependencies)' != 'true'">false</_FindDependencies> In the console app, `$(BuildingProject)`=true and `$(_FindDependencies)` is empty. In the Android app, `$(BuildingProject)`=false and `$(_FindDependencies)` is `false`. It appears that the `BuildOnlySettings` target *should* be running in Android apps when we do an "inner" build per `$(RuntimeIdentifier)`. Simply updating `_ComputeFilesToPublishForRuntimeIdentifiers` so that the `BuildOnlySettings` target is in `DependsOnTargets` fixes this. However, this also causes satellite assemblies to now be automatically found by the .NET SDK. Update `@(_AndroidResolvedSatellitePaths)` so that `@(ReferenceSatellitePaths)` is only included on Classic builds, preventing duplicate entries. [0]: https://github.com/dotnet/msbuild/blob/a2490dd3f78cce4abc8f9e6f1b5268437332818f/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2322
…tnet#7642) Fixes: dotnet/maui#10154 Context? dotnet/maui#11364 If you have a solution setup with: * `ApplicationA.csproj` has a `@(ProjectReference)` to `LibraryB.csproj`. * `LibraryB.csproj` which has a `@(Reference)` to `LibraryC.dll`, built by- * `LibraryC.csproj` The app will crash at runtime, due to a missing `LibraryC.dll`. The workaround is for `LibraryB.csproj` to use `@(ProjectReference)` to `LibraryC.csproj` instead of `@(Reference)` to `LibraryC.dll`. However, it appears the same situation works in a .NET 7 self-contained console app: % dotnet publish --self-contained -r win-x64 … % ls -1 .\bin\Debug\net7.0\win-x64\publish\LibraryC.dll LibraryC.dll The underlying issue appears to be due to [`$(_FindDependencies)`][0]: <_FindDependencies Condition="'$(BuildingProject)' != 'true' and '$(_ResolveReferenceDependencies)' != 'true'">false</_FindDependencies> In the console app, `$(BuildingProject)`=true and `$(_FindDependencies)` is empty. In the Android app, `$(BuildingProject)`=false and `$(_FindDependencies)` is `false`. It appears that the `BuildOnlySettings` target *should* be running in Android apps when we do an "inner" build per `$(RuntimeIdentifier)`. Simply updating `_ComputeFilesToPublishForRuntimeIdentifiers` so that the `BuildOnlySettings` target is in `DependsOnTargets` fixes this. However, this also causes satellite assemblies to now be automatically found by the .NET SDK. Update `@(_AndroidResolvedSatellitePaths)` so that `@(ReferenceSatellitePaths)` is only included on Classic builds, preventing duplicate entries. [0]: https://github.com/dotnet/msbuild/blob/a2490dd3f78cce4abc8f9e6f1b5268437332818f/src/Tasks/Microsoft.Common.CurrentVersion.targets#L2322
Description
We want to hide our private libraries from IntelliSense for our customers. We followed the instructions from the following guide: Multiple assemblies in one package. This solution works in pure net7.0 apps, but leads to build errors on MAUI apps.
Steps to Reproduce
I prepared a sample repo to demonstrate this issue: https://github.com/AntonKosenkoDX/nuget-refs.
To build this project, please run the
build
script or execute the following commands:You will see that the pure NET7 project is built without errors and it's IntelliSense shows only members from MyLib. Members from MyUtilities are not shown. This behavior is expected.
However, an attempt to build MyApp (MAUI application) results with the following error:
Link to public reproduction project repository
https://github.com/AntonKosenkoDX/nuget-refs
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
All
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: