Cannot configure content handling (build action) with sdk projects
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 2.1k
- Forks
- 528
- Avg merge
- 1d 12m
- Merged PRs (30d)
- 54
Description
Description
I need to create a nupkg with Paket, and am using a paket.template file for this. The source project is using Paket. I need to build some content files (actually, several .exe and .dll files) into the package, and when the package is being installed in an SDK-style project, the files need to be copied to output directory. Currently, however, they are added as compile, without any way to modify this.
Repro steps
- Create a paket.template file with the following contents:
type file
id MyPackage
version $VERSION$
files
Some.exe ==> contentFiles/any/any/Some
(not sure if additional attributes are needed, but this is a minimalistic example)
- Build the package with Paket.
- Install the package into an SDK-style project using vanilla NuGet.
Expected behavior
The executables are added to the project as content. This will work fine when manually creating a NuSpec file as follows:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MyPackage</id>
... snip ...
<contentFiles>
<files include="any\any\Some\*" buildAction="Content" copyToOutput="true" />
</contentFiles>
</metadata>
<files>
<file src="Some.exe" target="contentFiles\any\any\Some"/>
</files>
</package>
Note: When building the package with NuGet, the files element is removed, but the metadata/contentFiles element stays there.
Actual behavior
The executables are added to the project as compile, resulting in a compiler error.
Known workarounds
It seems there is no way to add the metadata/contentFiles attribute by modifying the paket.template file, or at least there is nothing in the documentation. There seems to be no way to change the target behaviour. The only way I found is to use NuGet.exe rather than Paket to generate the package, which would be annoying, since the source project is Paket-only, or to modify the .nuspec file in the generated package, which would also be annoying.
I found several issues related to this, but none of them seem to actually provide any means to modify the build action of content files, one of them was #3269. But my problem is not about installing or not installing content files, and not about automatically determining the build action: It is about how to specify the build action in the paket.template file or, more precisely, how to create the mentioned contentFiles element in the resulting .nuspec.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how paket.template file entries become the generated .nuspec, focusing on the contentFiles metadata shown in the issue. Compare that output with the working NuGet example, then verify the SDK-style installation behavior. Done means the template can express the build action and copy-to-output settings, and the resulting .nuspec preserves them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100