Paket pack fails when building/creating packages for Windows on Linux (docker), even using --build-platform flag
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 2.1k
- Forks
- 528
- Avg merge
- 1d 12m
- Merged PRs (30d)
- 54
Description
Description
I've noticed this issue when moving to Gitlab CI/CD, which uses dockerized runners for builds (before, we had dedicated build servers on Windows). Our target machines for our APIs and services are all Windows-based, so this required directing the build process (using the Dotnet CLI) to build for Windows specifically (using the -r win-x64 directive on most commands).
However, paket pack fails to take into account the different build environment, even when instructed to do so.
Repro steps
- Build the code in a linux container, for windows. Something like this
dotnet tool restore --configfile nuget.config
dotnet paket restore
dotnet restore -r win-x64 --configfile nuget.config
dotnet build --no-restore -c "Release" -p:MyRuntimeIdentifier=win-x64
This will output the build result to /bin/build-config/build-platform, like this:
Cart.Client -> /builds/dotnet/microservices/dotnet-common-client/src/Cart.Client/bin/Release/netstandard2.1/win-x64/Cart.Client.dll
(note: the runtime identifier is to force the dotnet CLI to build for win-x64 at solution level. See here for more info.
2. Run paket pack at solution level, indicating the desired build-config and build-platform
dotnet paket pack --version $VERSION --build-config Release --build-platform win-x64 $PACKAGE_DIR --minimum-from-lock-file
Expected behavior
Paket pack runs and builds .nupkgs for all the paket.template files within the solution, and puts them in the output directory. It uses the build artifacts from step 1 in the right build-platform directory.
Actual behavior
File not found exception, as paket doesn't look in the correct subdirectory for the build platform:
Paket failed with
-> FileNotFoundException: Could not find file '/builds/dotnet/microservices/dotnet-common-client/src/Cart.Client/bin/Release/netstandard2.1/Cart.Client.dll'.
Known workarounds
None that work, as far as I know. I figured I could try to redirect the output of the dotnet build command, but that's a unilateral redirect (i.e., all projects will push to the same output directory, as detailed here ). There's also no way to force paket pack to check certain directories for the build artifacts, so I can't run something like a for script manually on all the template files.
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 reproducing the reported Linux-container build and dotnet paket pack commands with --build-platform win-x64, then trace how Paket resolves build artifacts for the paket.template files. Done means packaging succeeds, finds artifacts under the runtime-specific directory, and writes the expected .nupkg files to the output directory.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100