The PackageConversionScript.ps1 is a PowerShell script that converts an old unsigned package that consists of one xml and one sql file into a new unsigned package structure that consists of two xml files. The script is provided within the installer folder in a separate directory called PackageConversionScript.
Before running the script, you must have the following:
- Package with older format: A zip folder containing exactly two files:
- projectsettings.xml
- PSWDisplayText.sql
Note: Both of these files are required for the script to work. If either is missing, the script will throw an error. - PowerShell: The script is written in PowerShell, so you need to have PowerShell available in your system. Ensure that you can run scripts in PowerShell (check execution policy if necessary).
- SQL Server is installed in your system.
- You need to have admin privileges to run the script file.
The PackageConversionScript.ps1 simplifies the process of converting old unsigned packages to a new format. The folder PackageConversionScript, contains the following files:
- PackageConversionScript.ps1
- TempDB.mdf
- TempDB_log.ldf
| Old package format | New package format (unsigned) |
|---|---|
|
Zip file
|
Zip file
|
To run the script and convert your old package:
Old Package:A zip file named old_package.zip containing
- projectsettings.xml
- PSWDisplayText.sql
Command: .\PackageConversionScript.ps1 -packageToConvert "C:\packages\old_package.zip" -convertedPkgPath "C:\packages\new_package.zip"
Output
The script will generate a new zip file new_package.zip containing:
- projectsettings.xml
- PSWDisplayText.xml (the converted file from PSWDisplayText.sql).
- Do not remove TempDB.mdf, TempDB_log.ldf files from the folder where the “PackageConversionScript.ps1” exists before running the script. The script internally uses those files to generate the new package.
- This script by default as a prerequisite uses SqlLocalDB and requires administrator privileges. In case you do not have (or do not want to use) SqlLocalDB, then you need to attach the TempDB files with an existing SQL Server instance and then need to modify the connection string in the script accordingly. Please use a test / standalone server and do not use any production / sensitive server to attach and execute the script. The SQL Server must be 2022 or greater.
- This script does not sign packages. It simply converts the old unsigned package format to the new format.
- If the packageToConvert is invalid or the required files (projectsettings.xml or PSWDisplayText.sql) are missing, the script will throw an error and won't execute.
- Do not include spaces in the folder names within the path specified for “packageToConvert” and “convertedPkgPath”.
- When this converted package is imported in SCM, it triggers an alert. You
must ensure that the unsigned package and all its files are scanned fully
for safety and then proceed with the upload.