Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run Invoke-SqlCmd against SQL Server 2016 #738

Open
Beakerboy opened this issue Jul 26, 2020 · 2 comments
Open

Unable to run Invoke-SqlCmd against SQL Server 2016 #738

Beakerboy opened this issue Jul 26, 2020 · 2 comments

Comments

@Beakerboy
Copy link

Beakerboy commented Jul 26, 2020

I have the simplest yml file possible:

services:
  - mssql2016
image:
  - Visual Studio 2017
install:
  - ps: Invoke-Sqlcmd -Username sa -Password "Password12!" -Query "CREATE DATABASE mydrupalsite"

The error message is:

Invoke-Sqlcmd : Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

I’ve also tried the Visual Studio 2015 image with the same result.

I’ve also tried moving the call to a separate powershell script and calling that with:
- ps: powershell .\dev\appveyor\mssql2016.ps1

The file contains the line:
Invoke-Sqlcmd -Query "CREATE DATABASE mydrupalsite" -ConnectionString "(local)\SQL2016;Database=master;User ID=sa;Password=Password12!"

@Beakerboy
Copy link
Author

I’m able to get around this by skipping powershell and using the basic command line with:
- cmd: sqlcmd -U sa -P Password12! -Q "CREATE DATABASE mydrupalsite"

@FeodorFitsner
Copy link
Member

Calling .ps1 with powershell should work as well. Try changing command prefix to cmd::

- cmd: powershell .\dev\appveyor\mssql2016.ps1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants