Whitebrim / VSCode-PlaydateTemplate

This template will help you with autocompletion and running your code in simulator. Windows & Linux.
202 stars 25 forks source link

.ps1 doesn't have an unblock option and the powershell code won't do anything #12

Open kosmosterrl opened 1 year ago

kosmosterrl commented 1 year ago

I don't know if this is a windows 11 problem or something but the .ps1 properties doesn't have an unblock option and whenever I put in the powershell code it does nothing. Screenshot 2023-08-23 142342 Screenshot 2023-08-23 142456

z80andrew commented 11 months ago

I had the same problem on Win10. Rather than set an execution policy, I unblocked the specific file.

In Visual Studio Code: Terminal -> New Terminal (Opens a PowerShell prompt at the current project location)

Run Unblock-File '.\Build and Run (Simulator).ps1'

Panegyr commented 8 months ago

I had the same problem on Win10. Rather than set an execution policy, I unblocked the specific file.

In Visual Studio Code: Terminal -> New Terminal (Opens a PowerShell prompt at the current project location)

Run Unblock-File '.\Build and Run (Simulator).ps1'

This should be the recommended method in the readme for allowing vscode to execute the script, changing the entire execution policy for one script is quite excessive and could lead to being exploited by malware

Whitebrim commented 8 months ago

I had the same problem on Win10. Rather than set an execution policy, I unblocked the specific file.

In Visual Studio Code: Terminal -> New Terminal (Opens a PowerShell prompt at the current project location)

Run Unblock-File '.\Build and Run (Simulator).ps1'

This should be the recommended method in the readme for allowing vscode to execute the script, changing the entire execution policy for one script is quite excessive and could lead to being exploited by malware

As far as I know unblocking .ps1 file is not the same as running it with admin rights. Both should be done to run it successfully. In the readme there is a code that lets this script be executed without need to launch VS Code as admin (recommend via pull request). There's a nasty bug in VS Code if it's launched with admin rights: https://github.com/microsoft/vscode/issues/91613

Panegyr commented 8 months ago

I had the same problem on Win10. Rather than set an execution policy, I unblocked the specific file. In Visual Studio Code: Terminal -> New Terminal (Opens a PowerShell prompt at the current project location) Run Unblock-File '.\Build and Run (Simulator).ps1'

This should be the recommended method in the readme for allowing vscode to execute the script, changing the entire execution policy for one script is quite excessive and could lead to being exploited by malware

As far as I know unblocking .ps1 file is not the same as running it with admin rights. Both should be done to run it successfully. In the readme there is a code that lets this script be executed without need to launch VS Code as admin (recommend via pull request). There's a nasty bug in VS Code if it's launched with admin rights: microsoft/vscode#91613

Yes this is correct actually, I spoke too soon, RemoteSigned should be safe enough as it's the default setting for Windows Server Installations

Panegyr commented 8 months ago

As for OP, the greyed out Read Only / Hidden / System properties is very odd.

Upon further inspection it looks like they're examining the file as it exists in the ZIP archive, and it hasn't been extracted, indicated by the Method and CRC32 values, it looks like they may have simply confused the default icon for a zip file in windows with that of an actual folder and tried to run the shell script inside of it, which wouldn't work at all afaik