Tech Community Live: Windows edition
Jun 05 2024, 07:30 AM - 11:30 AM (PDT)
Microsoft Tech Community
SOLVED

Nuget runtime references not copied to output in Desktop Bridge

Copper Contributor

I have a desktop bridge app, and I'm publish a self-contained project.

The build target for the wapproject (Desktop Bridge) modifies the `RuntimeIdentifier` of all references to the legacy `win-x64` or `win-x86` RIDs, instead of `win10-x64` or `win10-x86`. As a result, Nuget packages with native dlls are not copied to the output directory.

I have hacked my way around this by modifying the build metadata, but this could easily break in the future:
```xml
<Target Name="PropsBeforeBuild" BeforeTargets="_BuildDependentProjects" AfterTargets="SetProjectReferenceProperties">
<PropertyGroup>
<OriginalPublishProps>%(ProjectReferenceWithPublishProps.AdditionalProperties)</OriginalPublishProps>
</PropertyGroup>
<ItemGroup>
<ProjectReferenceWithPublishProps>
<SetConfiguration>%(ProjectReferenceWithPublishProps.SetConfiguration);RuntimeIdentifier=win10-x64</SetConfiguration>
<AdditionalProperties>$(OriginalPublishProps.Replace("win-x64", "win10-x64"))</AdditionalProperties>
</ProjectReferenceWithPublishProps>
</ItemGroup>
<Message Text="%(ProjectReferenceWithPublishProps.SetConfiguration);" />
<Message Text="%(ProjectReferenceWithPublishProps.AdditionalProperties);" />
<PropertyGroup>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == 'win-x64' OR '$(RuntimeIdentifier)' == ''">win10-x64</RuntimeIdentifier>
</PropertyGroup>
</Target>
```
This works, but since the DesktopBridge target adds the modified reference (with the legacy RIDs) to `_MSBuildProjectReferenceExistent`, I get `MSB3243: No way to resolve conflict between ....` in the build output. At this point, I'm better off ditching the desktop bridge build targets entirely.

Is there something I can do to resolve this?

4 Replies

@trymflogard Just to clarify, are you using Visual Studio Windows Application Packaging Project

@Aditi_Narvekar, Yes, that is correct. Both VS and my CI/CD pipeline fails.
best response confirmed by trymflogard (Copper Contributor)
Solution

@trymflogard The best way to get help for this issue is to submit feedback through Visual Studio's "Help/Send Feedback/Report a Problem" menu

Okay, I'll file a bug report.
1 best response

Accepted Solutions
best response confirmed by trymflogard (Copper Contributor)
Solution

@trymflogard The best way to get help for this issue is to submit feedback through Visual Studio's "Help/Send Feedback/Report a Problem" menu

View solution in original post