Powershell 7
EricLamontagne
Posts: 46 Bronze 3
Hi,
Can you tell me if Powershell 7 should be supported or not?
I tried running the Invoke-DatabaseBuild cmdlet and I get this error in PS 7, but not in PS 5:
Invoke-DatabaseBuild: An unhandled error occurred: System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.SqlConnection' threw an exception.
---> System.MissingMethodException: Method not found: 'System.Security.CodeAccessPermission System.Data.Common.DbProviderFactory.CreatePermission(System.Security.Permissions.PermissionState)'.
at Microsoft.Data.SqlClient.SqlConnection.CreateExecutePermission()
at Microsoft.Data.SqlClient.SqlConnection..cctor()
--- End of inner exception stack trace ---
at Microsoft.Data.SqlClient.SqlConnection..ctor()
at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)
at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)
at RedGate.Versioning.Automation.Shared.SQL.DatabaseExistenceChecker.CheckDatabaseExists(String connectionString) in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.Shared\SQL\DatabaseExistenceChecker.cs:line 18
at RedGate.Versioning.Automation.Compare.SchemaValidation.ScratchDatabase.Dispose() in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.Compare\SchemaValidation\ScratchDatabase.cs:line 44
at RedGate.Versioning.Automation.Compare.SchemaValidation.ProjectValidator.ValidateProject(String projectPath, CreateDatabaseParameters createDatabaseParameters) in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.Compare\SchemaValidation\ProjectValidator.cs:line 26
at RedGate.Versioning.Automation.PowerShell.Commands.InvokeDatabaseBuildCommandImpl.Process() in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.PowerShell\Commands\InvokeDatabaseBuildCommand.cs:line 265
at RedGate.Versioning.Automation.PowerShell.DlmAutomationCommandImpl`1.ProcessRecord() in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.PowerShell\DlmAutomationCommandImpl.cs:line 177
at RedGate.PowerShell.CommandBase`2.DelegateTo(Action doImplementation)
---> System.MissingMethodException: Method not found: 'System.Security.CodeAccessPermission System.Data.Common.DbProviderFactory.CreatePermission(System.Security.Permissions.PermissionState)'.
at Microsoft.Data.SqlClient.SqlConnection.CreateExecutePermission()
at Microsoft.Data.SqlClient.SqlConnection..cctor()
--- End of inner exception stack trace ---
at Microsoft.Data.SqlClient.SqlConnection..ctor()
at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)
at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)
at RedGate.Versioning.Automation.Shared.SQL.DatabaseExistenceChecker.CheckDatabaseExists(String connectionString) in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.Shared\SQL\DatabaseExistenceChecker.cs:line 18
at RedGate.Versioning.Automation.Compare.SchemaValidation.ScratchDatabase.Dispose() in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.Compare\SchemaValidation\ScratchDatabase.cs:line 44
at RedGate.Versioning.Automation.Compare.SchemaValidation.ProjectValidator.ValidateProject(String projectPath, CreateDatabaseParameters createDatabaseParameters) in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.Compare\SchemaValidation\ProjectValidator.cs:line 26
at RedGate.Versioning.Automation.PowerShell.Commands.InvokeDatabaseBuildCommandImpl.Process() in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.PowerShell\Commands\InvokeDatabaseBuildCommand.cs:line 265
at RedGate.Versioning.Automation.PowerShell.DlmAutomationCommandImpl`1.ProcessRecord() in \BuildAgentC\work\3367df887a9829e1\Clients\PowerShell\Cmdlets\RedGate.Versioning.Automation.PowerShell\DlmAutomationCommandImpl.cs:line 177
at RedGate.PowerShell.CommandBase`2.DelegateTo(Action doImplementation)
Tagged:
Best Answer
-
Ivo_Miller Posts: 31 Silver 3PowerShell 7 is not yet supported unfortunately. Some work has been done towards it and we will likely do some more investigations into supporting it in the near future. It is definitely on our radar. We are currently limited to PowerShell 5.Ivo Miller
RedGate Software Developer
Answers
still just say:
Supported PowerShell versions
- PowerShell 3 or above
Would be helpful to get the docs updated with a disclaimer re: pwsh 7.It is still very much on our radar and some further progress has been made towards it.
Updating to PowerShell 7 requires moving all our code to support net core. Much of that is done but it requires work from multiple teams as our PowerShell components support a number of different integrations.
RedGate Software Developer