Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 由于vs2015中的invokepowershell失败,无法发布mvc6应用程序_Asp.net Mvc_Visual Studio 2015_Asp.net Core Mvc_Powershell 3.0 - Fatal编程技术网

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

Asp.net mvc 由于vs2015中的invokepowershell失败,无法发布mvc6应用程序,asp.net-mvc,visual-studio-2015,asp.net-core-mvc,powershell-3.0,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.ta

由于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.
C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5):错误MSB4018:“InvokePowerShell”任务意外失败。
System.Management.Automation.PSSecurity异常:授权管理器检查失败。-->System.Management.Automation.Host.HostException:提示用户失败的命令,因为主机程序或命令类型不支持用户交互。主机试图通过以下消息请求确认:仅运行您信任的脚本。虽然来自internet的脚本可能很有用,但此脚本可能会危害您的计算机。如果信任此脚本,请使用Unblock File cmdlet允许脚本在没有此警告消息的情况下运行。是否要运行G:\\管道\管理\源\管理\ 2016\ProjMgr\src\ProjMgr\Properties\PublishProfiles\ProjMgr-publish.ps1?
位于System.Management.Automation.Internal.Host.InternalHostUserInterface.ThrowPromptNotInteractive(字符串promptMessage)
位于System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(字符串标题、字符串消息、集合`1选项、Int32默认选项)
位于Microsoft.PowerShell.PSAuthorizationManager.RemoteFilePrompt(字符串路径,PSHost主机)
位于Microsoft.PowerShell.PSAuthorizationManager.CheckPolicy(ExternalScriptInfo脚本、PSHost主机、异常和原因)
在Microsoft.PowerShell.PSAuthorizationManager.ShouldRun(CommandInfo CommandInfo、CommandOrigin origin、PSHost主机、异常和原因)
在System.Management.Automation.AuthorizationManager.ShouldRunInternal(CommandInfo CommandInfo、CommandOrigin origin、PSHost主机)
---内部异常堆栈跟踪的结束---
在System.Management.Automation.Runspaces.AsyncResult.EndInvoke()中
位于System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
在Microsoft.Web.Publishing.Tasks.InvokePowerShell.Execute()中
位于Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ItaskeExecutionHost.Execute()
在Microsoft.Build.BackEnd.TaskBuilder.d_uu26.MoveNext()中
已完成执行任务“InvokePowerShell”--失败。
已完成在项目“ProjMgr.xproj”中生成目标“PowerShellPublish”--失败。
已完成构建项目“ProjMgr.xproj”--失败。
已完成执行任务“MSBuild”--失败。
已完成在项目“ProjMgr.xproj”中构建目标“FileSystemPublish”——失败。
已完成构建项目“ProjMgr.xproj”--失败。
2> 由于生成错误,发布失败。有关详细信息,请查看错误列表。

通过将整个项目文件夹复制到本地文件夹的根目录,我成功地将其发布。必须是某个地方的文件夹权限问题…

请创建另一个发布配置文件,然后重试。
对我来说,这很有效。

尝试以管理员身份运行VS。很抱歉,我应该提到这是我也尝试过的第一件事