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
Per-RuntimeIdentifier packaging doesn't allow overriding build output path in nupkg #217
Comments
My final version of workaround: <PropertyGroup>
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);PatchPackagePath</GenerateNuspecDependsOn>
</PropertyGroup>
<Target Name="PatchPackagePath">
<ItemGroup>
<_PackageFilesToPatch Include="@(_PackageFiles->WithMetadataValue('BuildAction', 'None')->WithMetadataValue('Pack', 'true')->HasMetadata('TargetFramework')->HasMetadata('Rid'))" />
<_PackageFilesToPatch Remove="@(_PackageFilesToPatch)" Condition="'%(TargetFramework)' == '' or '%(Rid)' == ''" />
<_PackageFiles Remove="@(_PackageFilesToPatch)" />
<_PackageFilesToPatch Update="@(_PackageFilesToPatch)" PackagePath="tools/%(TargetFramework)/%(Rid)" />
<_PackageFiles Include="@(_PackageFilesToPatch)" />
<_PackageFilesToPatch Remove="@(_PackageFilesToPatch)" />
</ItemGroup>
</Target> For anyone reading this and willing to understand the motivation behind these lines: I love MSBuild. place for an "unlimited power" Palpatine |
Is there a PR you'd suggest to make this generic/flexible? |
@clairernovotny I'll try to think of the most flexible approach to this and make a PR. Can't guarantee I'll do it, though. I'm already on the 5th level of the dependency chain (Project->Framework->Bindings->SharpGen->MSBuild SDK), the dev cycle gets more difficult by the minute. |
After #218 this can still be improved: modify |
MSBuildSdkExtras/Source/MSBuild.Sdk.Extras/Build/RIDs.targets
Lines 165 to 167 in 4958e22
This feels too restrictive.
I'm not sure I can override this without overriding the whole target (and that requires droppingnevermind, found a simple workaround, see the first comment below.Sdk
property from<Project />
and doing<Import Sdk="..." />
manually), or patching another target inGenerateNuspecDependsOn
with<None Update="" />
.Proposal: extract path template to a property and allow simpler override.
Additional notes
The original issue title was
Per-RuntimeIdentifier packaging doesn't respect BuildOutputTargetFolder
, but then the whole property value is different from a traditional path under/lib
or/tools
...It'd be great to have such things (
ItemGroup
s) under some condition (like'$(ExtrasIncludeDefaultProjectBuildOutputInPack)' != 'false'
), so that when such issues arise it would bepossiblesimpler tohackaroundfix it locally by setting property (in my example tofalse
) and adding items manually.Stumbled upon this while working on SharpGen, it provides its own MSBuild tasks, so they should be in
tools
directory for them to be dev-only deps. refThe text was updated successfully, but these errors were encountered: