我正在尝试将Powershell模块发布到VSTS软件包管理feed。到目前为止,我有:
$securePass = ConvertTo-SecureString -String $RepositoryPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($RepositoryUsername, $securePass)
Write-Debug "Adding the Repository $RepositoryName"
Register-PSRepository -Name $RepositoryName -SourceLocation $RepositorySourceUri `
-PublishLocation $RepositoryPublishUri -Credential $cred `
-PackageManagementProvider Nuget -InstallationPolicy Trusted
$PublishParams = @{
Path = $ModuleFolderPath
ProjectUri = $ProjectUri
Tags = $ModuleTags
Repository = $RepositoryName
NugetApiKey = $NugetApiKey
}
Publish-Module @PublishParams -Force -Verbose
但是,出现以下错误:
PSRepository通过https://xxx.pkgs.visualstudio.com/_packaging/PowershellModules/nuget/v2作为源进行传递,并在创建Uris时将其发布。关于我要去哪里的任何指示?
最佳答案
调用此命令以使用NuGet.exe工具添加软件包源:
命令:
.\nuget.exe sources add -name [sourcename, such as myPSModuleFeed] -source https://[account].pkgs.visualstudio.com/_packaging/[feedname]/nuget/v2 -username test -password [PAT] -storePasswordInClearText
关于个人访问 token 的文章:Authenticate access with personal access tokens for Team Services and TFS
关于powershell - 使用发布模块将Powershell模块发布到VSTS软件包管理,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44975744/