This project has moved and is read-only. For the latest updates, please go here.

Read BizTalk application in powershell from BTDF generated MSI

Topics: General Questions
Mar 29, 2014 at 4:35 PM
is there any way to read the BizTalk Application name present in the msi that is generated by BTDF? i am using powershell to read the Biztalk application name from msi. is this possible?
i know how to read ProductName and ProductCode associated with MSI, but these properties don't represent the BizTalk application name. So is there any way to get the BizTalk application name present in BTDF generated MSI?
Mar 29, 2014 at 6:37 PM
As per BTDF documentation ProductName should return the BizTalk pjoect name. The documentation given like below

ProductName [ProjectName] for BizTalk Product name shown in the title of the installer


But when i try to access ProductName, i am getting ProductName + Product version in powershell
Mar 29, 2014 at 7:28 PM
Edited Mar 29, 2014 at 7:31 PM
i am using following powershell method to read msi details
function Get-MsiDatabaseVersion
{
    param (
        [IO.FileInfo] $FilePath,
        [string] $PropertyRequired
    )

    try {
        $windowsInstaller = New-Object -com WindowsInstaller.Installer

        $database = $windowsInstaller.GetType().InvokeMember(
                “OpenDatabase”, “InvokeMethod”, $Null, 
                $windowsInstaller, @($FilePath.FullName, 0)
            )

        $q = "SELECT Value FROM Property WHERE Property = '$PropertyRequired'"
        $View = $database.GetType().InvokeMember(
                “OpenView”, “InvokeMethod”, $Null, $database, ($q)
            )

        $View.GetType().InvokeMember(“Execute”, “InvokeMethod”, $Null, $View, $Null)

        $record = $View.GetType().InvokeMember(
                “Fetch”, “InvokeMethod”, $Null, $View, $Null
            )

        $productName = $record.GetType().InvokeMember(
                “StringData”, “GetProperty”, $Null, $record, 1
            )

        return $productName

    } catch {
        throw "Failed to get MSI file version the error was: {0}." -f $_
    }
}
And i have set following two properties in btdfproj file like below

<ProductName>Common.Framework</ProductName>
<ProductVersion>1.0.0</ProductVersion>

but when i am reading ProductName property in msi from powershell i am getting combination of both like below
Common.Framework 1.0.0

i should only get productName, why i am getting a combination?


what could be the problem?
Mar 30, 2014 at 11:15 PM
Add the property PackageComments to a PropertyGroup in your .btdfproj and set the value to the BizTalk app name, or if the value of the ProjectName property is the same as the BizTalk app name, you can use that as the value (like $(ProjectName)).

Example:
<PropertyGroup>
  <PackageComments>MyBizTalkAppName -- OR -- $(ProjectName)</PackageComments>
</PropertyGroup>
Now read the package comments from the MSI.

Thanks,
Tom
Mar 31, 2014 at 2:04 AM
Thanks Tom for your reply,
well..i am writing a generic script for multiple teams. So i cannot assume they will write the MyBizTalkAppName -- OR -- $(ProjectName) in PackageComments.

is there any other property in msi that is set to $(ProjectName) by default by BTDF?
Mar 31, 2014 at 5:19 AM
If you have no control over the Deployment Framework projects, then the teams could also customize their MSI's and put anything they choose into the MSI product name field. Keep in mind that the ProductName property is not always the BizTalk application name. The app name is stored in an MSBuild property named BizTalkAppName, which may be overridden in a .btdfproj and otherwise falls to a default setting. That property is never passed to the MSI.

If you want a generic script, I don't think you can avoid asking the teams to have at least one standardized field in the MSI. Otherwise you can never guarantee that you will find the BizTalk app name in the MSI.

Thanks,
Tom
Apr 1, 2014 at 5:41 AM
Ok Tom its clear now,
i have the teams to make a standard field to use .
Apr 1, 2014 at 5:54 AM
OK. Just an FYI -- in v6.0 (not yet available) I changed the default configuration of the MSI to place the name without the version number in the MSI product name field. That still wouldn't help you as the teams could customize that any way they desired, but it's a better default to have only the name.

Thanks,
Tom
Apr 10, 2014 at 7:31 AM
Edited Apr 10, 2014 at 7:44 AM
i have discussed with my teams here, they all are following different approach to give Biztalk application name.

hence i came up with another way to find out the biztalk application name.

i have written the generic scirpt that deploys into multi server environment easily.

just in case if you find some time,
you can download it from Here