我正在尝试将构建管道中已弃用的 FileTransform@1 任务升级到 FileTransform@2:
- task: FileTransform@2
displayName: 'Replace test app settings'
inputs:
folderPath: 'Dss.Test.Integration'
jsonTargetFiles : 'appsettings.json'
当我运行任务时,我得到以下输出:
##[debug]check path : D:\a\_tasks\FileTransform_8ce97e91-56cc-4743-bfab-9a9315be5f27\2.244.1\node_modules\azure-pipelines-tasks-webdeployment-common\module.json
##[debug]adding resource file: D:\a\_tasks\FileTransform_8ce97e91-56cc-4743-bfab-9a9315be5f27\2.244.1\node_modules\azure-pipelines-tasks-webdeployment-common\module.json
##[debug]system.culture=en-US
##[debug]folderPath=D:\a\1\s\Dss.Test.Integration
##[debug]Finding files matching input: D:\a\1\s\Dss.Test.Integration
##[debug]xmlTransformationRules=-transform **\*.Release.config -xml **\*.config
##[debug]xmlTargetFiles=undefined
##[debug]jsonTargetFiles=appsettings.json
##[debug]defaultRoot: 'D:\a\1\s\Dss.Test.Integration'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'false'
##[debug]findOptions.followSymbolicLinks: 'false'
##[debug]findOptions.skipMissingFiles: 'undefined'
##[debug]matchOptions.debug: 'false'
##[debug]matchOptions.nobrace: 'true'
##[debug]matchOptions.noglobstar: 'false'
##[debug]matchOptions.dot: 'true'
##[debug]matchOptions.noext: 'false'
##[debug]matchOptions.nocase: 'true'
##[debug]matchOptions.nonull: 'false'
##[debug]matchOptions.matchBase: 'false'
##[debug]matchOptions.nocomment: 'false'
##[debug]matchOptions.nonegate: 'false'
##[debug]matchOptions.flipNegate: 'false'
##[debug]pattern: '**\*.config'
##[debug]findPath: 'D:\a\1\s\Dss.Test.Integration'
##[debug]statOnly: 'false'
##[debug]findPath: 'D:\a\1\s\Dss.Test.Integration'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'false'
##[debug]findOptions.followSymbolicLinks: 'false'
##[debug]findOptions.skipMissingFiles: 'undefined'
##[debug] D:\a\1\s\Dss.Test.Integration (directory)
##[debug] D:\a\1\s\Dss.Test.Integration\appsettings.json (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Dss.Test.Integration.csproj (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure (directory)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\MerchantApi (directory)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\MerchantApi\MerchantApiTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence (directory)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence\Repositories (directory)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence\Repositories\AccountMappingRepositoryTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence\Repositories\BankPaymentRepositoryTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence\Repositories\FundingFileRepositoryTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence\Repositories\OnlinePaymentRepositoryTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence\Repositories\PayoutRepositoryTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Infrastructure\Persistence\Repositories\ReceivableRepositoryTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\PersistenceTest.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\RunnableInDebugOnly.cs (file)
##[debug] D:\a\1\s\Dss.Test.Integration\Services (directory)
##[debug] D:\a\1\s\Dss.Test.Integration\Services\PaymentJournalTest.cs (file)
##[debug]18 results
##[debug]found 18 paths
##[debug]applying include pattern
##[debug]adjustedPattern: 'D:\a\1\s\Dss.Test.Integration\**\*.config'
##[debug]0 matches
##[debug]0 final results
##[error]Unable to apply transformation for the given package - Changes are already present in the package.
我希望路径
D:\a\1\s\Dss.Test.Integration\appsettings.json
在这里匹配,但看起来 jsonTargetFiles
参数被替换为奇怪的 '**\*.config'
模式(我没有指定)?
好的,看起来
xmlTransformationRules
参数有一个默认值 **\*.Release.config -xml **\*.config
,这就是模式的来源。
将
xmlTransformationRules
设置为空白可以解决问题:
- task: FileTransform@2
displayName: 'Replace test app settings'
inputs:
folderPath: 'Dss.Test.Integration/'
xmlTransformationRules:
jsonTargetFiles : '**/appsettings.json'