unoplatform / uno.extensions

Libraries to ease common developer tasks associated with building multi-platform mobile, desktop and web applications using Uno Platform or WinAppSDK.
https://platform.uno/
Other
73 stars 47 forks source link

[Hosting][Navigation] Missing Files from Uno.Extensions.Navigation.UI and Uno.Extensions.Hosting.UWP Packages in UWP project #1606

Closed dim-37 closed 3 months ago

dim-37 commented 1 year ago

Current behavior

I have a UWP project that includes the Uno.Extensions.Navigation.UI and Uno.Extensions.Hosting.UWP packages. However, when attempting to build the project, I encountered the following errors:

Error: Could not copy the file C:\Users\otwel.nuget\packages\uno.extensions.hosting.uwp\2.4.2\lib\uap10.0.18362\Uno.Extensions.Hosting.UWP\buildTransitive\Uno.Extensions.Hosting.UWP.props because it was not found. UnoAppErrorReplication.Uwp

Error: Could not copy the file C:\Users\otwel.nuget\packages\uno.extensions.navigation.ui\2.4.2\lib\uap10.0.18362\Uno.Extensions.Hosting.UWP\buildTransitive\Uno.Extensions.Hosting.UWP.props because it was not found. UnoAppErrorReplication.Uwp

Error: Could not copy the file C:\Users\otwel.nuget\packages\uno.extensions.navigation.ui\2.4.2\lib\uap10.0.18362\Uno.Extensions.Navigation.UI\Uno.Extensions.Navigation.UI.xr.xml because it was not found. UnoAppErrorReplication.Uwp

Expected behavior

Build should be successful.

How to reproduce it (as minimally and precisely as possible)

MINIMAL REPRO PROJECT

Environment

Nuget Package:

Package Version(s):

Uno.Extensions.Navigation : 2.4.2 Uno.Extensions.Navigation.UI : 2.4.2 Uno.Extensions.Hosting : 2.4.2 Uno.Extensions.Hosting.UWP : 2.4.2

Affected platform(s):

Visual Studio:

Relevant plugins:

nickrandolph commented 1 year ago

This is an issue we've seen a few times and have a workaround that's used within the extensions libraries themselves. Add the following in the csproj

    <Target Name="AdjustGetPackagingOutput1" AfterTargets="GetMrtPackagingOutputs">
        <Message Importance="high" Text="Applying NuGet packaging workaround for dependent PRI files exclusion" />
        <ItemGroup>
            <_OtherPriFiles Include="@(PackagingOutputs)" Condition="'%(Extension)' == '.pri' and ('%(PackagingOutputs.ReferenceSourceTarget)' == 'ProjectReference' or '%(PackagingOutputs.NugetSourceType)'=='Package')" />
            <PackagingOutputs Remove="@(_OtherPriFiles)" />
        </ItemGroup>
    </Target>

    <Target Name="AdjustGetPackagingOutput2" BeforeTargets="AddPriPayloadFilesToCopyToOutputDirectoryItems">
        <Message Importance="high" Text="Applying NuGet packaging workaround for dependent PRI files exclusion" />
        <ItemGroup>
            <_OtherPriFiles1 Include="@(_ReferenceRelatedPaths)" Condition="'%(Extension)' == '.pri' and ('%(_ReferenceRelatedPaths.ReferenceSourceTarget)' == 'ProjectReference' or '%(_ReferenceRelatedPaths.NugetSourceType)'=='Package')" />
            <_ReferenceRelatedPaths Remove="@(_OtherPriFiles1)" />

            <_OtherPriFiles2 Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)' == '.pri' and ('%(ReferenceCopyLocalPaths.ReferenceSourceTarget)' == 'ProjectReference' or '%(ReferenceCopyLocalPaths.NugetSourceType)'=='Package')" />
            <ReferenceCopyLocalPaths Remove="@(_OtherPriFiles2)" />
        </ItemGroup>
    </Target>
nickrandolph commented 1 year ago

cc @lukeblevins can we add this to the list of common errors (ie https://platform.uno/docs/articles/get-started-wizard.html?tabs=windows)

Welcome to Uno Platform!
nickrandolph commented 1 year ago

Related issue on Uno: https://github.com/unoplatform/uno/issues/13483 Hold off adjusting docs to see the resolve on this issue

nickrandolph commented 5 months ago

@dansiegel can you confirm that the sdk now addresses this issue?

dansiegel commented 5 months ago

yes it is provided by default for projects using the Uno.Sdk https://github.com/unoplatform/uno/blob/56f15f541bc03bdc6b07e8e8be3baf2406f51aff/src/Uno.Sdk/targets/winappsdk-workaround.targets