Unpacking bacpac file throws error

When moving data from a sandbox environment to your dev-box you need sqlpackage to unpack the bacpac file to a database. This could give you an error message stating that the file contains corrupted data:

Skærmbillede 2020-03-24 kl. 12.49.06.png

To get yourself passed this you can download the .net core edition of the SQLPackage from here:

https://docs.microsoft.com/en-us/sql/tools/sqlpackage-download?view=sql-server-ver15

Unzip the downloaded file to a folder of your flavor. In that folder there’s another version of the sqlpackage.exe and that should allow you to continue:

Skærmbillede 2020-03-24 kl. 12.52.33.png

Edit:

After this was posted a new bug started appearing:

The error text is:

*** Error importing database:Could not import package.

Warning SQL0: The source contains users that rely on an external authentication provider that is not supported by the target. These users will be treated as users without logins.

Error SQL72014: Core Microsoft SqlClient Data Provider: Msg 102, Level 16, State 30, Line 1 Incorrect syntax near ‘type’.

Error SQL72045: Script execution error. 

The solution is the same as the above mentioned but just a newer version of the SQLPACKAGE software:

https://go.microsoft.com/fwlink/?linkid=2109019

Visual Studio – run as administrator

This is something that I generally forget whenever I create a new dev-box. Visual Studio needs to be running as Administrator otherwise you’ll get messages such as “Access to the path ‘K:\AosService\PackagesLocalDirectory\Bin\InstalledVersion.json’ is denied”:

Skærmbillede 2020-03-23 kl. 07.35.17.png

and “Visual Studio is not running as administrator. Finance and Operations (Dynamics 365) requires Visual Studio to be running as administrator. Please restart Visual Studio as administrator”:

Skærmbillede 2020-03-23 kl. 07.35.28.png

You can always right-click on your VS-shortcut and select “Run as administrator”, but if you’re even remotely like me, you’ll forget that approx 82% of the times.

So what you need to do is to modify the shortcut you’re using. In my case I modify the shortcut in my Taskbar. Right click on the shortcut for Visual Studio and instead of clicking “Run as administrator” you click Properties:

Skærmbillede 2020-03-23 kl. 09.27.35.png

In the properties window you click the Advanced button:

Skærmbillede 2020-03-23 kl. 09.29.37.png

In the window that opens up tick the “Run as administrator”:

Skærmbillede 2020-03-23 kl. 09.30.03.png

Click OK and OK and you’re done. Next time you use the shortcut it runs VS as administrator.