Skip to content

Publish-PSResource flatten folder and file structure #837

@MVKozlov

Description

@MVKozlov

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Publish-PSResource -Credential $Cred -Repository $Repo -Path $Path
$Path contains file tree but publish flatten it in nupkg

The problem triangled in #704
PowerShell/PowerShellGet@270d57e#diff-56bf43952db65da3734ae9fabbe720248ec3a4d18d87ee94ec8ce2b91bce4af1
line 354-359 vs 400-402

- var fileName = fileNamePath.Substring(_path.Length).Trim(_PathSeparators);
- var newFilePath = System.IO.Path.Combine(outputDir, fileName);
+ FileInfo fileInfo = new FileInfo(fileNamePath);
+ var newFilePath = System.IO.Path.Combine(outputDir, fileInfo.Name);

new one does not respect relative file path, only file name

Expected behavior

folder/file structure preserved
module.psd1
file1.ps1
public/
  file2.ps1
private/
  file3.ps1

Actual behavior

public/
private/
module.psd1
file1.ps1
file2.ps1
file3.ps1

Error details

No response

Environment data

Version    Name
-------    ----
3.0.17     PowerShellGet

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions