none
dacpac dependencies for sqlpackage.exe RRS feed

  • Question

  • So I am trying to use the snapshot functionality in SSDT to capture point in time for each version of my database through the development cycles.

    I've come to apply v.-1 to a v.-2 database using sqlpackage.exe and I'm getting the following error

    Error SQL0: The reference to external elements from the source named 'x.dacpac' could not be resolved, because no such source is loaded.

    Warning SQL72025: No file was supplied for reference x.dacpac: deployment might fail. When A_PATH\a.dacpac was created, the original referenced file was located X_OLD_PATH\x.dacpac

    An error occurred while adding references. Deployment cannot continue.

    The location of X_OLD_PATH has moved which is the cause, however as these things are generally source controlled and local lcoations may differ this will be a bit of a sore point for a development process. So while I can see how to solve the issue this time around (put a copy of the file back) there are wider issues and questions here.

    1. When taking a snapshot of X - I guess I should take a snapshot of A first to ensure that I have a valid version of the dependency at that point in time?

    2. If so How can I then link the snapshot of X to the snapshot of A. Ideally I'd like them to both be in the same location. Do I really need to keep changing the database references in the VS project?

    3. Is there any way to provide an argument to sqlpackage.exe to change the location of dependency dacpac's and if not could this be added as a required feature?

    Cheers for any comments!

    Monday, April 16, 2012 11:53 AM

Answers

  • Hello Brett

    There is no way in SqlPackage.exe to change the location path of referenced dacpacs. If the path of the referenced dacpac has changed, you can simple copy all referenced dacpacs into the same folder as the dacpac you are publishing.

    For your scenario above, copy a.dacpac and x.dacpac into the same folder and run the following command:

    Sqlpackage.exe /a:publish /sf:a.dacpac  /tsn:SomeServer /tdn:SomeDatabase /p:IncludeCompositeObjects=true

    -Lonny

    Tuesday, May 8, 2012 6:59 AM

All replies

  • Hello,

    Check out the thread below. It may help you.

    http://msdn.microsoft.com/en-us/library/hh550080%28v=vs.103%29.aspx

    http://msdn.microsoft.com/en-us/library/hh531248%28v=vs.103%29.aspx

    Tuesday, April 17, 2012 8:17 AM
  • Thanks gimwealan, unless I am missing something there isn't anything on those pages that allow me to override locations for dependencies (I had already looked through the arg lists)
    Tuesday, April 17, 2012 8:33 AM
  • I don't know if this helps but I was having trouble running SqlPackage /Action:Script between my compiled DACPAC and an extracted DACPAC and got a similar error (An error occurred while adding references). I resolved it by copying all the DACPACS from the \bin\debug directory of my DACPAC (it has about references to 15 other database projects plus master and msdb). After that, it worked. So it seems that in looking for references, it will check the directory first (I don't know if it was looking specifically at the current directory or the one the root DACPAC was in because those were one and the same).
    Thursday, April 19, 2012 4:27 PM
  • Hello Brett

    There is no way in SqlPackage.exe to change the location path of referenced dacpacs. If the path of the referenced dacpac has changed, you can simple copy all referenced dacpacs into the same folder as the dacpac you are publishing.

    For your scenario above, copy a.dacpac and x.dacpac into the same folder and run the following command:

    Sqlpackage.exe /a:publish /sf:a.dacpac  /tsn:SomeServer /tdn:SomeDatabase /p:IncludeCompositeObjects=true

    -Lonny

    Tuesday, May 8, 2012 6:59 AM