1

A hello world C# x64 application created in Visual Studio 2017 is executed successfully via Package Manager Console (PMC) everywhere else except %windir%\system32 location. The strange thing is that it is executed in Windows PowerShell (not as admin) but not from PMC in Visual Studio 2017. I thought it was an issue of the execution policy, but it was not.

I changed the execution policy in PMC to match the windows PowerShell execution policy, but it didn't make any difference.

I also executed the command Set-Location $env:windir\system32 and then Get-Location to confirm it, but it had no effect. Any ideas?

System: win7x64
Visual Studio 2017 15.6.0

maclaud
  • 182
  • 10
  • Is it 32-bit? The 32-on-64 directory aliasing might mean you're using the wrong folder. – Dave S Mar 11 '18 at 05:01
  • No it is `64-bit` (in build options i deselect `prefer 32-bit`). I also confirmed it from task manager (it is not marked as `*32`). Anyway, if you try to run `32-bit` `exe` located in `%windir%\system32`, via `cmd` or `PowerShell`, it will fail. – maclaud Mar 11 '18 at 05:13

1 Answers1

1

I figured it out.

Actually i had to do exactly the opposite. Visual Studio is 32-bit and therefore prefer 32-bit option must be selected in the executable build options in C#. Then the executable must be stored in %windir%\syswow64 and everything works fine.

maclaud
  • 182
  • 10