![](/img/trans.png)
[英]PowerShell Publish-Module is already used for a different item on the specified repository
[英]Publishing Powershell Modules to VSTS Package Management using Publish-Module
我正在尝试将我的Powershell模块发布到VSTS包管理源。 到目前为止,我有:
$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 ‘’ 。 在C:\\ Program Files \\ WindowsPowerShell \\ Modules \\ PowerShellGet \\ 1.1.2.0 \\ PSModule.psm1:1227 char:17 + Publish-PSArtifactUtility -PSModuleInfo $ moduleInfo` + ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation :( :) [Write-Error ],WriteErrorException + FullyQualifiedErrorId:FailedToPublishTheModule,Publish-PSArtifactUtility
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
有关个人访问令牌的文章: 使用个人访问令牌验证对Team Services和TFS的访问权限
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.