我正在处理一个我们延迟签署程序集的项目。我需要在构建过程中使用强名称工具几次,关闭强名称验证,然后在打包程序集之前对其进行完全签名。我尝试使用 powershell 步骤关闭验证,但它返回此错误:
脚本:
$testprojs = gci Project.*.dll -r
$testprojs | % {
sn -Vr $_
write-output $("Turned off sn verification for " + $_.Name)
}
错误:
Failed to open registry key -- Administrator permissions are needed to use
the selected options. Use an administrator command prompt to complete these tasks.
所以我创建了一个脚本来运行第一个脚本,但添加了 -elevated 参数。这没什么区别。
我还尝试使用命令提示符步骤而不是 powershell。这也返回了同样的错误。
For /r %g in ("Project.*.dll") DO sn -Vr %g
当我尝试对构建代理机器本身运行相同的脚本 rdp 时,它按预期工作。只有当它作为构建中的一个步骤运行时才不起作用。
有什么想法吗?
最佳答案
根据你的描述:
When I tried running this same script rdp'd to the build agent machine itself, it works as intended.
我假设您正在使用自己的构建代理进行构建。那么这可能是由于构建代理没有使用管理员帐户运行造成的。请更新您的构建代理以使用管理员帐户运行,然后重试。
Run the agent Run as a service
If you deployed the agent to run as a Windows service, then the agent running status can be controlled from the Services snap-in. Run services.msc and look for "VSO Agent ()". If you need to change the logon account, don't do it from the services snap-in. Instead, From an elevated Command Prompt, run:
C:\Agent\Agent\VsoAgent.exe /ChangeWindowsServiceAccount Run
interactivelyOtherwise if you installed the agent to run interactively, the agent can be started by launching Agent\VsoAgent.exe.
详情请引用此链接:Run the agent
关于build - 在 Visual Studio Team Services 构建期间以管理员身份运行 Powershell 或命令提示符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36550343/