asp.net-mvc - 由于vs2015中invokepowershell失败,无法发布mvc6应用程序

标签 asp.net-mvc visual-studio-2015 asp.net-core-mvc powershell-3.0

由于 powershell 文件阻塞,我在尝试发布我的 mvc6 应用程序时遇到了一些严重的痛苦。我以管理员身份运行powershell并调整了执行策略。但在vs2015中似乎对发布过程没有任何影响。除此之外,我什至徒劳地尝试在 NPM 中运行 Unblock-File cmdlet。

有人对我如何让它发挥作用有任何想法吗?完整的错误如下:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error MSB4018: The "InvokePowerShell" task failed unexpectedly.
System.Management.Automation.PSSecurityException: AuthorizationManager check failed. ---> System.Management.Automation.Host.HostException: A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run G:\_PIPELINE_MANAGEMENT\_SOURCE\_MANAGEMENT\_2016\ProjMgr\src\ProjMgr\Properties\PublishProfiles\ProjMgr-publish.ps1?
   at System.Management.Automation.Internal.Host.InternalHostUserInterface.ThrowPromptNotInteractive(String promptMessage)
   at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
   at Microsoft.PowerShell.PSAuthorizationManager.RemoteFilePrompt(String path, PSHost host)
   at Microsoft.PowerShell.PSAuthorizationManager.CheckPolicy(ExternalScriptInfo script, PSHost host, Exception& reason)
   at Microsoft.PowerShell.PSAuthorizationManager.ShouldRun(CommandInfo commandInfo, CommandOrigin origin, PSHost host, Exception& reason)
   at System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo commandInfo, CommandOrigin origin, PSHost host)
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
   at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
   at Microsoft.Web.Publishing.Tasks.InvokePowerShell.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
                Done executing task "InvokePowerShell" -- FAILED.
                Done building target "PowerShellPublish" in project "ProjMgr.xproj" -- FAILED.
        Done building project "ProjMgr.xproj" -- FAILED.
        Done executing task "MSBuild" -- FAILED.
        Done building target "FileSystemPublish" in project "ProjMgr.xproj" -- FAILED.
Done building project "ProjMgr.xproj" -- FAILED.

2>Publish failed due to build errors. Check the error list for more details.

最佳答案

创建另一个发布配置文件并重试。 对我来说这有效。

关于asp.net-mvc - 由于vs2015中invokepowershell失败,无法发布mvc6应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36174633/

相关文章:

asp.net-core - ASP.NET 5 ,希望将 Entity Framework 与 Web 项目分开

asp.net-mvc - 在 aspx 页面中的 webgrid 中从一页导航到另一页时丢失 Web 控件数据

c# - 跟踪 C# Controller 和 View 中的两个变量

installation - 需要更新 Visual Studio,已安装 SDK

c++ - 如何将配置文件嵌入 C++ VS2015 控制台应用程序而不是硬编码为常量数据?

c# - Asp.Net Core API 禁用启动完成消息

c# - 如何检查 MVC Core 配置文件中的某个部分是否存在?

c# - 模型与非顺序索引的 JSON 数组/对象绑定(bind)

sql-server - Entity Framework 查询结果重复

c++ - Lambda 适用于最新的 Visual Studio,但在其他地方不起作用