我正在尝试将我的Powershell模块发布到VSTS Package Management 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
但是,我收到以下错误:
Publish-PSArtifactUtility:发布模块失败 ' Framework.Logging':'发布到********包管理 饲料 ' https://xxx.pkgs.visualstudio.com/_packaging/PowershellModules/nuget/v2' 要求将其注册为NuGet包源。之后重试 添加此来源
' https://xxx.pkgs.visualstudio.com/_packaging/PowershellModules/nuget/v2' 按照指定的指令作为NuGet包源 ' https://go.microsoft.com/fwlink/?LinkID=698608'&#39 ;.在C:\ Program 文件\ WindowsPowerShell \模块\ PowerShellGet \ 1.1.2.0 \ PSModule.psm1:1227 char:17 + Publish-PSArtifactUtility -PSModuleInfo $ moduleInfo` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo :InvalidOperation :( :) [Write-Error],WriteErrorException + FullyQualifiedErrorId: FailedToPublishTheModule,发布 - PSArtifactUtility
PSRepository在创建时作为源和发布Uris传递https://xxx.pkgs.visualstudio.com/_packaging/PowershellModules/nuget/v2。关于我哪里出错的指示?
答案 0 :(得分:3)
调用此命令以使用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
有关个人访问令牌的文章:Authenticate access with personal access tokens for Team Services and TFS