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

时间:2016-03-23 09:45:30

标签: asp.net-mvc visual-studio-2015 asp.net-core-mvc powershell-v3.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.

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

我设法通过将整个项目文件夹复制到本地的根目录来进行发布。必须是某处的文件夹权限问题...