Paket icon indicating copy to clipboard operation
Paket copied to clipboard

Paket pack cannot ignore framework subdirectory

Open legrab opened this issue 3 years ago • 4 comments

Description

Running paket pack on an SDK style project that builds without the TargetFramework subdirectory will not find the assembly.

Using AppendTargetFrameworkToOutputPath set to false or specifying OutDir instead of OutputPath results in building the assemblies into the top ${OutputPath}\ instead of the framework subdirectory as ${OutputPath}\${TargetFramework}\.

Either setting is ignored by paket and it tries looking up the assembly in the ${OutputPath}\${TargetFramework}\ folder where it is not.

Repro steps

  1. Create a project with any of the two csproj properties (set AppendTargetFrameworkToOutputPath to false or specify the OutDir).

  2. Try running paket pack on the project.

Expected behavior

Paket finds the assembly in the directory as per where it is configured to build.

Actual behavior

Paked looks for the assembly in the directory the assemlby would be if neither of the two property would be configured.

Known workarounds

Dotnet pack can be used instead on the project but that leads to a lot of extra effort and new issues when other projects are packed with paket in the same solution.

Duplication

Please note that a narrower range of this issue (mentioning only the AppendTargetFrameworkToOutputPath property) has been raised 2 years ago on issue #3971.

legrab avatar Jun 15 '22 14:06 legrab

@forki could you take a look on this, thats really a showstopper for Paket and net 6.0 for us, since our CI pipeline requires to put all output assemblies into the same out folder.

Flohack74 avatar Jun 20 '22 07:06 Flohack74

could you please prepare the repro so that I just have to run that paket pack call? Sorry I'm very low on time at the moment, but I would then try to look at it this evening

forki avatar Jun 20 '22 07:06 forki

this should do it: https://github.com/legrab/paket_4157

Referred method: https://github.com/fsprojects/Paket/blob/80d1c2cd598d6e891a958801533ae7fc6a3a6309/src/Paket.Core/PaketConfigFiles/ProjectFile.fs#L1638-#L1659

#L1642 handles 'AppendTargetFrameworkToOutputPath' property, but that works with the hard-coded 'bin' pre-directory, so that clearly is not the generic case.

'framework' sub-dir is added to the path disregarding the property on #L1659.

legrab avatar Jun 20 '22 08:06 legrab

@Koala06 looks like you are very close. - care to send a PR?

forki avatar Jun 21 '22 12:06 forki

The suggested Pull Requests have been merged and released in 7.2.0, so I am closing this issue

legrab avatar Nov 26 '22 15:11 legrab