-
Speaking at .NET Conf - Put your C#, VB and F# projects and packaging on a diet
I'm really exited to be selected as one of the community speakers for .NET Conf
.NET Conf is a free “virtual” conference organised by Microsoft and the .NET developer community that is streamed live around the world. Being virtual, it means organising travel and accommodation is remarkably easy!
My talk is titled “Put your C#, VB and F# projects and packaging on a diet”, drilling in to the new project system for .NET, and how you can use it even with old projects that target .NET Framework and it starts at 04:00 UTC on Friday 14th September (check local times). Go to https://www.dotnetconf.net/ to watch the live stream.
All the demos from my talk and links to other resources can be found in the Github repo https://github.com/flcdrg/project-system-diet
-
Converting a SQL Server .bacpac to a .dacpac
Microsoft SQL Server has two related portable file formats - the DACPAC and the BACPAC. Quoting Data-tier Applications:
A DAC is a self-contained unit of SQL Server database deployment that enables data-tier developers and database administrators to package SQL Server objects into a portable artifact called a DAC package, also known as a DACPAC. A BACPAC is a related artifact that encapsulates the database schema as well as the data stored in the database.
When they say related, they're not kidding! Both of these files formats are based on the Open Packaging Conventions (a fancy way of saying it's a .zip file with some other bits), and cracking them open you discover that a bacpac file is basically a dacpac with a few extra files and a couple of different settings. Knowing this, it should be possible to manually convert a bacpac to a dacpac.
First, unzip the .bacpac file (using 7-zip, or rename to .zip and use Windows File Explorer’s Extract Archive).
Now do the following actions (you could do these programmatically if this is something you need to do repeatedly):
- Edit model.xml
- Change DataSchemaModel@SchemaVersion to 2.4
- Edit Origin.xml
- Change ContainsExportedData to false
- Change ModelSchemaVersion to 2.4
- Remove ExportStatistics
- Recalculate the SHA256 checksum for model.xml and update the value stored in
Checksums/Checksum@Uri=’/model.xml’
- Remove directories
\_rels
and Data
Now re-zip up the remaining files and change the file suffix back to .dacpac
To verify that the .dacpac is valid, try using SSMS with the Upgrade Data-tier Application wizard. Run it against any database and if you can proceed to without error to the "Review Upgrade Plan" step, you should be good to go.
- Edit model.xml
-
Create a temporary file with a custom extension in PowerShell
Just a quick thing I wanted to record for posterity. The trick is using the
-PassThru
parameter with theRename-Item
cmdlet so that this ends up a one-liner thanks to PowerShell's pipeline:$tempNuspec = Get-ChildItem ([IO.Path]::GetTempFileName()) | Rename-Item -NewName { [IO.Path]::ChangeExtension($_, ".nuspec") } -PassThru