Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not sure whether you still require this or not but wanted answer this as we did similar kind of operation in the postbuild event. As far as the research I did this is not possible to set the file name as you want internally through setup process.</p> <p>You can do this in other way by naming the output file through an external application in post build event.</p> <p>Here is what you can do:</p> <p>In the post build event -></p> <blockquote> <p>[MsiRenamerAppPath]\MsiRenamer.exe "$(BuildOutputPath)"</p> </blockquote> <p>Create an application which will rename the msi file with the version number from the deployment project. Following is the code used for the application. This should fulfill your requirement I guess.</p> <p>Getting msi properties code is used from <a href="http://www.alteridem.net/2008/05/20/read-properties-from-an-msi-file/" rel="nofollow noreferrer">alteridem article</a></p> <pre class="lang-cs prettyprint-override"><code>class MsiRenamer { static void Main(string[] args) { string inputFile; string productName = "[ProductName]"; if (args.Length == 0) { Console.WriteLine("Enter MSI file:"); inputFile = Console.ReadLine(); } else { inputFile = args[0]; } try { string version; if (inputFile.EndsWith(".msi", StringComparison.OrdinalIgnoreCase)) { // Read the MSI property version = GetMsiProperty(inputFile, "ProductVersion"); productName = GetMsiProperty(inputFile, "ProductName"); } else { return; } // Edit: MarkLakata: .msi extension is added back to filename File.Copy(inputFile, string.Format("{0} {1}.msi", productName, version)); File.Delete(inputFile); } catch (Exception ex) { Console.WriteLine(ex.Message); } } static string GetMsiProperty(string msiFile, string property) { string retVal = string.Empty; // Create an Installer instance Type classType = Type.GetTypeFromProgID("WindowsInstaller.Installer"); Object installerObj = Activator.CreateInstance(classType); Installer installer = installerObj as Installer; // Open the msi file for reading // 0 - Read, 1 - Read/Write Database database = installer.OpenDatabase(msiFile, 0); // Fetch the requested property string sql = String.Format( "SELECT Value FROM Property WHERE Property='{0}'", property); View view = database.OpenView(sql); view.Execute(null); // Read in the fetched record Record record = view.Fetch(); if (record != null) { retVal = record.get_StringData(1); System.Runtime.InteropServices.Marshal.FinalReleaseComObject(record); } view.Close(); System.Runtime.InteropServices.Marshal.FinalReleaseComObject(view); System.Runtime.InteropServices.Marshal.FinalReleaseComObject(database); return retVal; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload