SOLVED

Nuget runtime references not copied to output in Desktop Bridge

%3CLINGO-SUB%20id%3D%22lingo-sub-2480002%22%20slang%3D%22en-US%22%3ENuget%20runtime%20references%20not%20copied%20to%20output%20in%20Desktop%20Bridge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2480002%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20desktop%20bridge%20app%2C%20and%20I'm%20publish%20a%20self-contained%20project.%3C%2FP%3E%3CP%3EThe%20build%20target%20for%20the%20wapproject%20(Desktop%20Bridge)%20modifies%20the%20%60RuntimeIdentifier%60%20of%20all%20references%20to%20the%20legacy%20%60win-x64%60%20or%20%60win-x86%60%20RIDs%2C%20instead%20of%20%60win10-x64%60%20or%20%60win10-x86%60.%20As%20a%20result%2C%20Nuget%20packages%20with%20native%20dlls%20are%20not%20copied%20to%20the%20output%20directory.%3C%2FP%3E%3CP%3EI%20have%20hacked%20my%20way%20around%20this%20by%20modifying%20the%20build%20metadata%2C%20but%20this%20could%20easily%20break%20in%20the%20future%3A%3CBR%20%2F%3E%60%60%60xml%3CBR%20%2F%3E%3CTARGET%20name%3D%22%26quot%3BPropsBeforeBuild%26quot%3B%22%20beforetargets%3D%22%26quot%3B_BuildDependentProjects%26quot%3B%22%20aftertargets%3D%22%26quot%3BSetProjectReferenceProperties%26quot%3B%22%3E%3CBR%20%2F%3E%3CPROPERTYGROUP%3E%3CBR%20%2F%3E%3CORIGINALPUBLISHPROPS%3E%25(ProjectReferenceWithPublishProps.AdditionalProperties)%3C%2FORIGINALPUBLISHPROPS%3E%3CBR%20%2F%3E%3C%2FPROPERTYGROUP%3E%3CBR%20%2F%3E%3CITEMGROUP%3E%3CBR%20%2F%3E%3CPROJECTREFERENCEWITHPUBLISHPROPS%3E%3CBR%20%2F%3E%3CSETCONFIGURATION%3E%25(ProjectReferenceWithPublishProps.SetConfiguration)%3BRuntimeIdentifier%3Dwin10-x64%3C%2FSETCONFIGURATION%3E%3CBR%20%2F%3E%3CADDITIONALPROPERTIES%3E%24(OriginalPublishProps.Replace(%22win-x64%22%2C%20%22win10-x64%22))%3C%2FADDITIONALPROPERTIES%3E%3CBR%20%2F%3E%3C%2FPROJECTREFERENCEWITHPUBLISHPROPS%3E%3CBR%20%2F%3E%3C%2FITEMGROUP%3E%3CBR%20%2F%3E%3CMESSAGE%20text%3D%22%26quot%3B%25(ProjectReferenceWithPublishProps.SetConfiguration)%3B%26quot%3B%22%3E%3C%2FMESSAGE%3E%3CBR%20%2F%3E%3CMESSAGE%20text%3D%22%26quot%3B%25(ProjectReferenceWithPublishProps.AdditionalProperties)%3B%26quot%3B%22%3E%3C%2FMESSAGE%3E%3CBR%20%2F%3E%3CPROPERTYGROUP%3E%3CBR%20%2F%3E%3CRUNTIMEIDENTIFIER%20condition%3D%22%26quot%3B'%24(RuntimeIdentifier)'%22%3Ewin10-x64%3C%2FRUNTIMEIDENTIFIER%3E%3CBR%20%2F%3E%3C%2FPROPERTYGROUP%3E%3CBR%20%2F%3E%3C%2FTARGET%3E%3CBR%20%2F%3E%60%60%60%3CBR%20%2F%3EThis%20works%2C%20but%20since%20the%20DesktopBridge%20target%20adds%20the%20modified%20reference%20(with%20the%20legacy%20RIDs)%20to%20%60_MSBuildProjectReferenceExistent%60%2C%20I%20get%20%60MSB3243%3A%20No%20way%20to%20resolve%20conflict%20between%20....%60%20in%20the%20build%20output.%20At%20this%20point%2C%20I'm%20better%20off%20ditching%20the%20desktop%20bridge%20build%20targets%20entirely.%3C%2FP%3E%3CP%3EIs%20there%20something%20I%20can%20do%20to%20resolve%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2480002%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Edesktop-bridge%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emsbuild%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMSIX%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Enuget%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2521180%22%20slang%3D%22en-US%22%3ERe%3A%20Nuget%20runtime%20references%20not%20copied%20to%20output%20in%20Desktop%20Bridge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2521180%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1085380%22%20target%3D%22_blank%22%3E%40trymflogard%3C%2FA%3E%26nbsp%3BJust%20to%20clarify%2C%20are%20you%20using%26nbsp%3B%3CSPAN%3EVisual%20Studio%20Windows%20Application%20Packaging%20Project%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2542100%22%20slang%3D%22en-US%22%3ERe%3A%20Nuget%20runtime%20references%20not%20copied%20to%20output%20in%20Desktop%20Bridge%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2542100%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1087317%22%20target%3D%22_blank%22%3E%40anarvekar%3C%2FA%3E%2C%20Yes%2C%20that%20is%20correct.%20Both%20VS%20and%20my%20CI%2FCD%20pipeline%20fails.%3C%2FLINGO-BODY%3E
New 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 (New 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.