YAML管道错误-找不到Git自动与子文件夹组合的文件夹
我有一个通过Azure DevOps使用的Git存储库,我将文件夹和文件的层次结构复制到该存储库中。其中一些文件夹仅包含另一个文件夹。例如: 内容YAML管道错误-找不到Git自动与子文件夹组合的文件夹,git,powershell,azure-devops,nuget-package,Git,Powershell,Azure Devops,Nuget Package,我有一个通过Azure DevOps使用的Git存储库,我将文件夹和文件的层次结构复制到该存储库中。其中一些文件夹仅包含另一个文件夹。例如: 内容 epm bin(其中包含文件) xin(包含文件) edc bin(其中包含文件) Git自动执行的是将edc和bin文件夹合并到文件树中的edc\bin。我甚至尝试手动创建带有占位符文件的edc文件夹,然后在该文件夹下创建带有占位符文件的bin文件夹,然后删除edc下的占位符文件。。。我一这样做,它就把edc和bin组合成edc\b
- epm
- bin(其中包含文件)
- xin(包含文件)
- edc
- bin(其中包含文件)
edc
和bin
文件夹合并到文件树中的edc\bin
。我甚至尝试手动创建带有占位符文件的edc
文件夹,然后在该文件夹下创建带有占位符文件的bin
文件夹,然后删除edc
下的占位符文件。。。我一这样做,它就把edc
和bin
组合成edc\bin
问题是,当通过YAML管道将其构建到NuGet包中时,这似乎是一个问题。我使用powershell脚本生成.nuspec
文件并添加要包含的内容。这很好,它指定了每个单独的文件夹以及这些文件夹中的每个文件。因此,它添加的条目之一是…content\edc
。但是在打包.nuspec
的NuGet Pack步骤中,它失败了,错误是找不到…content\edc
。只是因为在回购协议的文件树中,没有…content\edc
——只有…content\edc\bin
有没有办法停止自动合并只包含一个这样的文件夹的文件夹?如果没有,我可以在哪里提交问题/更改请求
我不想尝试更改文件夹结构或添加额外的内容,因为这些文件已经在我们的各个项目中使用,为了更好地管理,我正在将其转换为Git repo和NuGet包,不想破坏现有的功能。它没有合并文件夹,它只是直观地告诉您,“edc”中没有直接的文件。这完全是微软的审美选择(顺便说一句,Github也这么做)。您可以使用任何Git客户端来检查文件系统,这将是正常的
看起来没有任何方法可以禁用此功能。它不是组合文件夹,只是直观地告诉您“edc”中没有直接的文件。这完全是微软的审美选择(顺便说一句,Github也这么做)。您可以使用任何Git客户端来检查文件系统,这将是正常的
看起来没有任何方法可以禁用此功能。显然,我的问题是.nuspec文件不应该在“文件”部分包含文件夹。我添加了检查文件扩展名的功能,如果文件扩展名为空,请不要将其添加到列表中 我设法将“target”设置添加到与repo相同的文件结构中。以下是用于创建.nuspec文件的powershell脚本,其中包括执行这两项操作,以防其他人发现此操作很有用:
Param(
[string]$pkgName,
[string]$pkgVersion,
[string]$basePath,
[string]$branchForPackageName,
[string]$contentFolder
)
if($pkgVersion -match '([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\.{0,1}([0-9]{0,})$'){
$matchedVersion = $Matches[0]
$version=$matchedVersion
$a=$version.Split(".")
$version="{0:00}" -f ([int]$a[0]) + "." + "{0:00}" -f ([int]$a[1]) + "." + "{0:00}" -f ([int]$a[2]) + "." + "{0:00}" -f ([int]$a[3])
$files=Get-ChildItem -Path $basePath\$contentFolder -Recurse
Write-Host $files.Count " items in " $basePath\$contentFolder
$baseName=$pkgName+".nuspec"
$nuspecFile = Join-Path $basePath $baseName
if((Test-Path $nuspecFile)){
Remove-Item $nuspecFile
}
$title = $pkgName+"."+$branchForPackageName
$description = (Get-Content -Path $basePath\$contentFolder\README.md)[1]
if($description -eq ""){
$description = $title+" Support DLL"
}
Add-Content $nuspecFile "<?xml version='1.0'?>"
Add-Content $nuspecFile "<package >"
Add-Content $nuspecFile " <metadata>"
Add-Content $nuspecFile " <id>$title</id>"
Add-Content $nuspecFile " <version>$version</version>"
Add-Content $nuspecFile " <title>$title</title>"
Add-Content $nuspecFile " <authors>me</authors>"
Add-Content $nuspecFile " <owners>me</owners>"
Add-Content $nuspecFile " <requireLicenseAcceptance>false</requireLicenseAcceptance>"
Add-Content $nuspecFile " <description>$description</description>"
Add-Content $nuspecFile " <releaseNotes></releaseNotes>"
Add-Content $nuspecFile " <copyright>Copyright 2021</copyright>"
Add-Content $nuspecFile " <tags>$pkgName</tags>"
Add-Content $nuspecFile " </metadata>"
Add-Content $nuspecFile " <files>"
for($n=0; $n -lt $files.Count; $n++){
$fileName = $files[$n].FullName
if(([IO.Path]::GetExtension($fileName) -ne "")){
$fileName -match "\\$contentFolder\\(?<remainder>.*)"
$targetFile = $matches['remainder']
Add-Content $nuspecFile " <file src=""$fileName"" target=""content\$pkgName\$targetFile"" />"
}
}
Add-Content $nuspecFile " </files>"
Add-Content $nuspecFile "</package>"
}
Param(
[字符串]$pkgName,
[字符串]$pkgVersion,
[字符串]$basePath,
[字符串]$branchForPackageName,
[string]$contentFolder
)
if($pkgVersion-match'([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\.{0,1}([0-9]{0,})$){
$matchedVersion=$Matches[0]
$version=$matchedVersion
$a=$version.Split(“.”)
$version=“{0:00}”-f([int]$a[0])+”“+”{0:00}”-f([int]$a[1])+”+“+”{0:00}”-f([int]$a[2])+“+”{0:00}”-f([int]$a[3])
$files=Get ChildItem-Path$basePath\$contentFolder-Recurse
写入主机$files.Count“$basePath\$contentFolder”中的“项目”
$baseName=$pkgName+“.nuspec”
$nuspecFile=连接路径$basePath$baseName
if((测试路径$nuspecFile)){
删除项目$nuspecFile
}
$title=$pkgName+“+$branchForPackageName
$description=(获取内容-路径$basePath\$contentFolder\README.md)[1]
如果($description-eq“”){
$description=$title+“支持DLL”
}
添加内容$nuspecFile“”
添加内容$nuspecFile“”
添加内容$nuspecFile“”
添加内容$nuspecFile“$title”
添加内容$nuspecFile“$version”
添加内容$nuspecFile“$title”
添加内容$NUSPEC文件“我”
添加内容$NUSPEC文件“我”
添加内容$nuspecFile“false”
添加内容$nuspecFile“$description”
添加内容$nuspecFile“”
添加内容$NUSPEC文件“版权所有2021”
添加内容$nuspecFile“$pkgName”
添加内容$nuspecFile“”
添加内容$nuspecFile“”
对于($n=0;$n-lt$files.Count;$n++){
$fileName=$files[$n].FullName
if(([IO.Path]::GetExtension($fileName)-ne“”){
$fileName-匹配“\\$contentFolder\\(?.*)”
$targetFile=$matches['rements']
添加内容$nuspecFile“”
}
}
添加内容$nuspecFile“”
添加内容$nuspecFile“”
}
显然,我的问题是.nuspec文件不应该在“文件”部分包含文件夹。我添加了检查文件扩展名的功能,如果文件扩展名为空,请不要将其添加到列表中
我设法将“target”设置添加到与repo相同的文件结构中。以下是用于创建.nuspec文件的powershell脚本,其中包括执行这两项操作,以防其他人发现此操作很有用:
Param(
[string]$pkgName,
[string]$pkgVersion,
[string]$basePath,
[string]$branchForPackageName,
[string]$contentFolder
)
if($pkgVersion -match '([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\.{0,1}([0-9]{0,})$'){
$matchedVersion = $Matches[0]
$version=$matchedVersion
$a=$version.Split(".")
$version="{0:00}" -f ([int]$a[0]) + "." + "{0:00}" -f ([int]$a[1]) + "." + "{0:00}" -f ([int]$a[2]) + "." + "{0:00}" -f ([int]$a[3])
$files=Get-ChildItem -Path $basePath\$contentFolder -Recurse
Write-Host $files.Count " items in " $basePath\$contentFolder
$baseName=$pkgName+".nuspec"
$nuspecFile = Join-Path $basePath $baseName
if((Test-Path $nuspecFile)){
Remove-Item $nuspecFile
}
$title = $pkgName+"."+$branchForPackageName
$description = (Get-Content -Path $basePath\$contentFolder\README.md)[1]
if($description -eq ""){
$description = $title+" Support DLL"
}
Add-Content $nuspecFile "<?xml version='1.0'?>"
Add-Content $nuspecFile "<package >"
Add-Content $nuspecFile " <metadata>"
Add-Content $nuspecFile " <id>$title</id>"
Add-Content $nuspecFile " <version>$version</version>"
Add-Content $nuspecFile " <title>$title</title>"
Add-Content $nuspecFile " <authors>me</authors>"
Add-Content $nuspecFile " <owners>me</owners>"
Add-Content $nuspecFile " <requireLicenseAcceptance>false</requireLicenseAcceptance>"
Add-Content $nuspecFile " <description>$description</description>"
Add-Content $nuspecFile " <releaseNotes></releaseNotes>"
Add-Content $nuspecFile " <copyright>Copyright 2021</copyright>"
Add-Content $nuspecFile " <tags>$pkgName</tags>"
Add-Content $nuspecFile " </metadata>"
Add-Content $nuspecFile " <files>"
for($n=0; $n -lt $files.Count; $n++){
$fileName = $files[$n].FullName
if(([IO.Path]::GetExtension($fileName) -ne "")){
$fileName -match "\\$contentFolder\\(?<remainder>.*)"
$targetFile = $matches['remainder']
Add-Content $nuspecFile " <file src=""$fileName"" target=""content\$pkgName\$targetFile"" />"
}
}
Add-Content $nuspecFile " </files>"
Add-Content $nuspecFile "</package>"
}
Param(
[字符串]$pkgName,
[字符串]$pkgVersion,
[字符串]$basePath,
[字符串]$branchForPackageName,
[string]$contentFolder
)
if($pkgVersion-match'([0-9]{1,})\.([0-9]{1,})\.([0-9]{1,})\.{0,1}([0-9]{0,})$){
$matchedVersion=$Matches[0]
$version=$matchedVersion
$a=$version.Split(“.”)
$version=“{0:00}”-f([int]$a[0])+”“+”{0:00}”-f([int]$a[1])+”+“+”{0:00}”-f([int]$a[2])+“+”{0:00}”-f([int]$a[3])
$files=Get ChildItem-Path$basePath\$contentFolder-Recurse
写入主机$files.Count“$basePath\$contentFolder”中的“项目”