gpt4 book ai didi

vb.net - UnauthorizedAccess 对 Visual Studio 后期构建

转载 作者:行者123 更新时间:2023-12-04 00:55:20 26 4
gpt4 key购买 nike

我正在尝试在 Windows 笔记本电脑上工作,并在 VB.NET 中常规构建 Visual Studio 之后设置 post_build.ps1

当我在 powershell 命令上运行脚本时,它没有任何错误。但是当我通过 Visual Studio 中的 Build 完成它时,我有这个:

powershell ./_POST_BUILD.ps1 以代码 1 退出

如果我启用诊断输出,我可以通过输出看到:

1>  AuthorizationManager check failed. (TaskId:39)
1> + CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException (TaskId:39)
1> + FullyQualifiedErrorId : UnauthorizedAccess (TaskId:39)

我尝试过的:

  1. 使用 Set-ExecutionPolicy Unrestricted -scope LocalMachineSet-ExecutionPolicy Unrestricted -scope CurrentUser 将策略设置为不受限制
  2. 将 Visual Studio 中的生成后事件更改为 Powershell.exe -ExecutionPolicy Unrestricted -file "$(SolutionDir)bin\debug\_POST_BUILD.ps1"
  3. 右键单击取消阻止文件 -> 属性 -> 取消阻止
  4. 始终以管理员身份运行 Visual Studio

最佳答案

我不喜欢回答我自己的问题,但我设法解决了它。

出于某种原因,通过右键单击 -> 属性 -> 取消阻止 -> 应用取消阻止文件。我必须在 Powershell 上运行以下命令:

unblock-file --path ./_POST_BUILD.ps1

关于vb.net - UnauthorizedAccess 对 Visual Studio 后期构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45510236/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com