SqlParser LoadWithPartialName fails when called from VSC but works otherwise


Powershell 5.1.x, Windows 10 Pro.

When running the following command in the default PowerShell console:


it runs OK and I can use the SqlParser classes and methods subsequently.

However, the same command executed in Visual Studio Code debug session results in:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlS …
Exception calling "LoadWithPartialName" with "1" argument(s): "Could not load file or assembly
'Microsoft.SqlServer.Management.SqlParser, Culture=neutral, PublicKeyToken=null'. Operation is not supported. (0x80131515)"

VSC runs with the same privileges as the standard PS console. What am I doing wrong? How to successfully load the assembly in VSC?

Update: the following code works fine in VSC:


so I am not blocked anymore. Still, the question remains: why does the ::LoadWithPartialName method work in one place but not the other?

asked on Stack Overflow Jan 30, 2020 by Piotr L • edited Jan 31, 2020 by Bill Tür

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0