Customizing the automatic package building in Visual Studio
If the template Spotfire Extension VS.zip is used, a Spotfire package is automatically built, and also an unpacked module that can be used when debugging the extension.
About this task
The post-build event that builds the package is defined in the file that has the file extension .targets. This xml file is imported to the .csproj file when the template Spotfire Extension VS.zip is used.
The following modifications can be made to control the building of the package:
<ArchiveFormat>The archive inside the package file can either be in "cab" format or in "zip" format. Since "cab" is not natively supported on Linux, the setting specifies that a "zip" archive should be created for Linux packages and that a "cab" archive should be created for Windows packages. Both "cab" and "zip" archives are supported by the different Spotfire clients.
<PathToPackageBuilder>This must point to the Package Builder console included in the SDK. Update this if the extension project is created in a different folder than "MyExtensions".
<PathToPkdescFile>This argument identifies the .pkdesc file for an extension package. Note that one .pkdesc file can include multiple assemblies (that is, multiple projects in Visual Studio), but this is not necessary.
<PathToPackageFolder>The path to the folder where the package file should be created.
<TargetPath>This argument identifies the path and name of the output package file. The default value for the filename is $(AssemblyName)-$(IntendedPlatform).spk.
IntendedPlatformis set to Windows or Linux depending on if the compilation is compiling for .NET Framework or .NET Core.<BaseFolderPath>This argument identifies the root folder for files and folders mentioned in the .pkdesc file and points to the folder where the compiled binaries are created. It should normally not be changed.
<RefPath>This argument identifies the folders where all dependent assemblies are stored and contains three paths separated by semicolons:
The path to the compiled binaries (same as
<BaseFolderPath>)."
AdditionalBinaryFolders". This is defined in the project file and is normally empty. If extra paths are needed to resolve all references when building the package, these can be added.The path to the Spotfire API binaries. If the project is placed in some other location than "MyExtensions", this path must be changed.
<UnpackedModuleFolder>This argument points to the folder where the unpacked module should be stored.
The command line for running Package Builder is using the settings listed above and also the following arguments:
/saveunpackedmoduleThis argument makes the Package Builder console unpack the created package and store it on disk. This is needed to seamlessly debug the extensions. It can be removed if no debugging is needed, but in that case the argument /unpackedmodulefolder must be removed from the command line as well.
/automaticpackageversionnumberThis argument tells Package Builder console to automatically generate unique version numbers for the package (not for any of the included files). This is a convenience feature to assure that a newly built package will replace an existing package when deployed to the Spotfire Server.
One side effect of using this argument is that you will get a new module folder in the "unpacked modules" folder each time you compile. Therefore, if you re-compile frequently, you might want to purge this folder occasionally.
Note: If you do not want to build package files for every compilation, just edit the .csproj file and comment out the import statement at the end of the file.