microsoft / DacFx

DacFx, SqlPackage, and other SQL development libraries enable declarative database development and database portability across SQL versions and environments. Share feedback here on dacpacs, bacpacs, and SQL projects.
https://aka.ms/sqlpackage-ref
MIT License
356 stars 20 forks source link

Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: The Element or Annotation class SqlIndex does not contain the Property class Online #427

Closed jackliusr closed 8 months ago

jackliusr commented 8 months ago

Steps to Reproduce:

  1. import a dacpac

(DacFx/SqlPackage/SSMS/Azure Data Studio)

b3go commented 8 months ago

@ErikEJ I guess you meant me :D I could do a PR but I have the same question about the version number. Also the script seems to be unable to locate sqlpackage.exe if it was installed via dotnet tool install. Maybe it would be easier to just take it from an env var? Pipeline Task users could easily change it if they want to use another version.

Btw I opened an issue in the relevant repo https://github.com/microsoft/azure-pipelines-extensions/issues/1225

ErikEJ commented 8 months ago

I did a PR https://github.com/microsoft/azure-pipelines-extensions/pull/1226

jpomfret commented 7 months ago

Hey folks, I'm struggling to work out what the issue is here in order to resolve it 😄

I have a GitHub Action workflow failing with this error:

The Element or Annotation class SqlIndex does not contain the Property class Online.
At line:97891 char:9
+         throw $records[0]
+         ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], Exception
    + FullyQualifiedErrorId : dbatools_Publish-DbaDacPackage

Reading through this conversation it seems like it's a mismatch in version of dacfx and sqlpackage.exe? However, I am using the windows-latest image for the runner, the list of installed software states that this includes DacFx 162.2.111.2 and I'm using the latest dbatools module (Publish-DbaDacPackage) which has SqlPackage.exe version 162.2.111.2

image

I have tried to use the previous version of dbatools\dbatools.library but this gives me the same error.

What am I missing? Thanks in advance!

dzsquared commented 7 months ago

@jpomfret - if you add a script step that calls sqlpackage /version, does it return 162.2.111? Checking the dba tools code quick, I think it uses the msbuild nuget instead of sqlpackage itself - https://github.com/dataplat/dbatools/blob/86b3f3db92ab8f2f6ebab4259d47f7da158a748c/public/Publish-DbaDacPackage.ps1#L69 that nuget package is uh, not updated.

jpomfret commented 7 months ago

hey @dzsquared Really sorry I got side tracked on this - when I run sqlpackage /version I get the following:

sqlpackage : The term 'sqlpackage' is not recognized as the name of a cmdlet, function, script file, or operable 
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\a\_temp\cd2d7e43-4e35-4661-b3fd-6f6a022cd6d2.ps1:8 char:1

I think that dbatools uses the sqlpackage from the library module - but I'm not exactly sure how this works 🤔 I'll reach out to Chrissy on this too.. https://github.com/dataplat/dbatools.library

ckrueger1979 commented 6 months ago

This topic shouldn't be closed. Visual Studio contains a new version of dacfx then https://aka.ms/dacfx-msi

I had to copy this directory for deployment: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\ because I couldn't find a standalone download