alexdresko / HSPI

HomeSeer plugin helper framework
MIT License
11 stars 11 forks source link

Problem calling powershell after build #82

Closed alexdresko closed 7 years ago

alexdresko commented 7 years ago

Summary

For the gitter chat:

skavan @skavan Sep 07 19:08 now, my impassable error is: Severity Code Description Project File Line Suppression State Error The command "powershell -file "G:\OneDrive\Development\dragonfly management\HSPIPluginA1_test1\HSPIPluginA1_test1\fix-output.ps1" -configuration Debug -executionpolicy Unrestricted -NonInteractive" exited with code 1. HSPIPluginA1_test1 G:\OneDrive\Development\dragonfly management\HSPIPluginA1_test1\HSPIPluginA1_test1\HSPIPluginA1_test1.csproj 77

Alex Dresko @alexdresko Sep 07 19:14 Open a command prompt and run 'powershell -file "G:\OneDrive\Development\dragonfly management\HSPIPluginA1_test1\HSPIPluginA1_test1\fix-output.ps1" -configuration Debug -executionpolicy Unrestricted -NonInteractive' and tell me what happens.

Odd Erik Midthaug @oesolberg Sep 20 02:48 I have the same problem as @skavan. Everything builds, but the powershell script for placing dlls in correct directory fails. If I run the script from powershell everything works as expected. I changed my csproj to the following

where "%WINDIR%\SysNative\WindowsPowerShell\v1.0\powershell.exe" replaces powershell in Exec Command="powershell ......

Odd Erik Midthaug @oesolberg Sep 20 03:06 Found the solution on stack overflow - https://stackoverflow.com/questions/7947840/powershell-script-from-visual-studio-post-build-event-failing

Expected Behavior

The build should just always work

Current Behavior

Some users get an error when executing the powershell script. I don't know if that's because of their powershell version, or something in their operating system. The information provided by @oesolberg should help, but it won't work on my machine (I don't have Powershell v1 on my machine).

Possible Solution

@oesolberg, can you try making sure you have the latest version of powershell and revert your csproj to be the way it was before your changes. If you open up a powershell console and type `host, you should see something like the following (from my machine):

C:\Windows\system32> host

Name : ConsoleHost Version : 5.1.15063.608 InstanceId : 8c85f609-b865-479b-808a-45de93f6dae7 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : en-US CurrentUICulture : en-US PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace

I'd recommend that you at least have PowerShell version 5.1.

Steps to Reproduce (for bugs)

Can't reproduce on my machine

Screenshots (if appropriate)

Context

New devs just trying to use the plugin.

Your Environment

oesolberg commented 7 years ago

I will not be able to test this until the 10th of October. I have the latest version of Powershell (I think), but I guess the version 1.0 folder is due to backwards compatibility.

alexdresko commented 7 years ago

So strange. %WINDIR%\SysNative\WindowsPowerShell\v1.0 isn't even a directory on my computer, so %WINDIR%\SysNative\WindowsPowerShell\v1.0\powershell.exe isn't even a file... But it certainly works in Visual Studio in the csproj files. This is an incredible find you made. Mega thanks. I'm working to push a the fix to the VS templates now.

alexdresko commented 7 years ago

Pushed to the marketplace as v1.3.135