Automatic appending suffixes and changing GUID for various entities while running for several languagues

Aug 2, 2016 at 1:16 PM
Edited Aug 2, 2016 at 1:19 PM
I am trying to run my build MSI on several languages, but it looks like the newer version (1.0.41.0) has changed the way the various entities have been created.

For example while running on a second language I get the following:
<Component Id="Component.App.1" Guid="ff11fdfe-8c4e-4c21-be49-1ef853673915">
              <File Id="App.dll.1" Source="..\..\ProgramFiles\App.dll" Compressed="yes" />
 </Component>
while in the initial language

  <Component Id="Component.App.dll" Guid="ff11fdfe-8c4e-4c21-be49-1ef85bc1e493">
              <File Id="App.dll" Source="..\..\ProgramFiles\App.dll" Compressed="yes" />
  </Component>
As you can see .1 was appended and the GUID was changed.
In the previous version of Wix#, it was the same on all languages run.

Here is the sample code:
   static public void Main(string[] args)
   {
    [...]           
            foreach (var lang in Configuration.LanguageTable)
            {
                BuildMsi(version, lang);
            }
    }

 private static void BuildMsi(Version version,string language)
        {
            Feature applicationFeature = new Feature("Application");
          
            Project project = new Project
            {
               [....]
     
                Package = new Package
                {
                       [....]      
                },

                Dirs = new[]
                {
                    new Dir(ConfigurationManager.AppSettings["InstallDir"] 
                    new DirFiles(applicationFeature,ConfigurationManager.AppSettings["ProgramFilesSrcDir"] + @"\*")
                }

               [....]
               project.ResolveWildCards();

               [....]
}
Any idea how to block this?
Coordinator
Aug 4, 2016 at 5:26 AM
> ... running on a second language...
Sorry I cannot understand what it means. But something tells me that it might be irrelevant.

Wix# is a WiX based MSI authoring solution. But not WXS building tool. Thus wxs is considered to be an intermediate building step only. Thus the specific elements and layout (e.g. elements order) are irrelevant as long as the output msi file produced correctly. That is why Wix# is completely removing from user view bunch of XML definitions that can be auto generated insted manually defined by user. Component element is handled this way. The component Id and Guid auto-generation algorithm is based on component content (e.g. File element id/name). This algorithm can change from time to time to address certain id allocation issues. For example there were reports about potential duplication of component Id so the algorithm had to be changed to ensure uniqueness of the allocated Ids. But this in no way affected building the final msi so there should be no problems for users.

Thus my question is: "What is exactly the problem that you are trying to solve?" It seems like you have no problems with building msi. Is it correct?

Anyway, if for whatever reason you want to overwrite the component id allocation you can do it by providing an explicit ID/GUID via WixEntity attributes as demonstrated below:
new Dir(@"%ProgramFiles%\My Company\My Product",
                    new File("setup.cs") { AttributesDefinition = "Component:Id=MyComId;Component:Guid=ffffffff-ffff-4544-b2b6-960518a0ecba" }),
It will produce this WXS:
<Component Id="MyComId" Guid="ffffffff-ffff-4544-b2b6-960518a0ecba">
  <File Id="setup.cs" Source="setup.cs" />
</Component>
It will work but to be honest it will defete the whole purpose of Wix#.