.2. My understanding of the .NET Framework documentation does not recommend setting the "fileVersion" in the assembly identity. They recommend SxS semantics by upgrading the assembly's "version" only. You can drive your product version off of an assembly's version using "!(bind.assemblyVersion.FileId)".
3. You can only specify binder variables in .wxs files. It's a binder (in light.exe) concept not an MSBuild (in MSBuild.exe reading .wixproj files) concept. If you want to move your version specification to MSBuild, then you need to use a preprocessor variable (i.e. !(var.Xxx) or !(env.Xxx)). The WiX.chm actually has a decent amount of detail on preprocessor variables. Also, you don't have to specify both the File/@Name and File/@Source unless the file name needs to be different. I personally, like to only specify File/@Source and the File/@Id and File/@Name will be taken care of for me (as long as I don't have two files with the same name... in that case I have to specify at least one File/@Id). -----Original Message----- From: Colin Fox [mailto:greenene...@gmail.com] Sent: Monday, January 19, 2009 10:54 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Getting the version from the Assembly file On Mon, Jan 19, 2009 at 10:22 AM, Rob Mensching <rob.mensch...@microsoft.com > wrote: > 0. Probably aren't a lot of examples out there. It is relatively new > functionality. I would be happy with one example. :) > 1. the "!(bind.Xxx)" means binder variable while "$(var.Xxx)" means > preprocessor variable. Preprocessing is the very first process run in the > WiX toolset (in candle) and binding is the very last (in light). Different > data is available at different times. > Ok, got it. > > 2. !(bind.assemblyFileVersion.Xxx) is only available if you instruct light > to populate file versions (not generally recommended). That's why I tend to > use !(bind.FileVersion.Xxx) instead. > Is there a reason why it's not recommended? And perhaps I'm misunderstanding something... When I build my exe, it is built with an AssemblyInfo.cs file that has an [assembly:] attribute. I just want to pull that attribute out of the executable so that my msi file has the same version number. Am I correct in assuming that the Version attribute of the Product tag in the .wxs file is supposed to be the same as the application's version? > > 3. Does a File/@Id with value "myProgramEXE" exist in your MSI? If not, > that would cause this error as well. > Yes, I have the File/@Id with Id="myProgramEXE". Here is a slightly larger segment of my .wxs file: <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> <Product Id="11732b0c-41a8-483b-8a99-a2a1afece53c" Name="My Great Program" Language="1033" Version="!(bind.assemblyFileVersion.myGreatProgramEXE)" Manufacturer="My Software Corp" UpgradeCode="ba6c6a55-3a6c-4080-b77a-92aa0efbc67d"> <Package InstallerVersion="200" Compressed="yes" /> <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLLOCATION" Name="MyProgram"> <Component Id="ProductComponent" Guid="62a436f8-b2d3-4f10-ae62-dc5616a0d34e"> <File Id="myGreatProgramEXE" Name="$(var.MyProgram.TargetFileName)" Source="$(var.MyProgram.TargetPath)" DiskId="1" KeyPath="yes"> the $(var.MyProgram.TargetFileName) and TargetPath work just fine. Is the wxs file the wrong place for a bind variable? Does it belong in a wixproj instead? If so, then how would the version be set int he .wxs? Also - thanks Rob for the time you've spent on this. I really appreciate it. > > -----Original Message----- > From: Colin Fox [mailto:greenene...@gmail.com] > Sent: Monday, January 19, 2009 09:52 > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Getting the version from the Assembly file > > Ok, I've tried this but I can't determine where this is supposed to go. I > can't find any complete examples that actually use this. > > Here's what I tried, which doesn't work: > > <?xml version="1.0" encoding="UTF-8"?> > <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" > xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> > <Product Id="11732b0c-41a8-483b-8a99-a2a1afece53c" > Name="My Deluxe Program" > Language="1033" > Version="!(bind.assemblyFileVersion.myProgramEXE)" > Manufacturer="My Software Corp" > UpgradeCode="ba6c6a55-3a6c-4080-b77a-92aa0efbc67d"> > <Package InstallerVersion="200" Compressed="yes" /> > > This is in my product.wxs file. When I try to build the solution, I get > "Unresolved bind-time variable". > > If this isn't where the bind.assemblyFileVersion is supposed to go, where > is > it? > > Thanks, > Colin > > ps. I also tried using a $(var.ProductVersion) here and in the .wixproj > saying ProductVersion=!(bind.assemblyFileVersion...) and it didn't work > either. > > also - what does the ! character represent? Doesn't that usually mean > "not"? > > > On Thu, Jan 15, 2009 at 8:02 AM, Rob Mensching > <rob.mensch...@microsoft.com>wrote: > > > Another option, if you are using WiX v3 is to use a binder variable to > grab > > the file version directly. Something like "!(bind.FileVersion.FileId)". > > > > -----Original Message----- > > From: Reggie Burnett [mailto:r...@comcast.net] > > Sent: Thursday, January 15, 2009 04:50 > > To: General discussion for Windows Installer XML toolset. > > Subject: Re: [WiX-users] Getting the version from the Assembly file > > > > I ship 4 binary components that all have the same version so I use a > > small snippet in my msbuild script that reads the version # from one > > of the components and then passes that into to wix through a > > preprocessor var. > > > > On Tue, Jan 13, 2009 at 6:44 PM, Michael Osmond <mosm...@baytech.com.au> > > wrote: > > > Colin, > > > > > > You can set an environment variable in the build process and then > access > > > that inside wix as $(env.projectVersion) > > > > > > Or you can set an Wix variable in the candle command line > > > "candle -dMyProject.Version=<value>" > > > > > > Michael > > > > > > -----Original Message----- > > > From: Colin Fox [mailto:greenene...@gmail.com] > > > Sent: Wednesday, 14 January 2009 10:11 AM > > > To: General discussion for Windows Installer XML toolset. > > > Subject: Re: [WiX-users] Getting the version from the Assembly file > > > > > > Yes - our current release strategy is to always release major upgrades. > > > The entire MSI is under 10 megs so it's not a huge deal. > > > > > > I'm relatively new to the company, and this process has been in place > > > since long before I got here, but part of the build process is to use a > > > build tool to set the version number, and it goes and modifies some > > > files. I was hoping to streamline things a bit and just modify one file > > > and have the version be deduced by the rest of the system. > > > > > > If it can't be done through a wix variable, then I can probably modify > > > the build tool to change the wix file, but that just feels wrong (not > to > > > mention will cause unnecessary changes for our revision control > system). > > > > > > On Tue, Jan 13, 2009 at 3:14 PM, Rob Mensching > > > <rob.mensch...@microsoft.com>wrote: > > > > > >> Are you always going to release using Major Upgrades? If not, then > > >> you need to keep the name constant. That fact is why you don't see > > >> many people putting the version number in the MSI name. Not a common > > >> request thus not necessarily simple to implement. > > >> > > >> -----Original Message----- > > >> From: Colin Fox [mailto:greenene...@gmail.com] > > >> Sent: Tuesday, January 13, 2009 14:36 > > >> To: wix-users > > >> Subject: [WiX-users] Getting the version from the Assembly file > > >> > > >> Hi everyone. > > >> > > >> I'd like go be able to set the version of my application in the > > >> assembly.cs file, and have it used in both the wix file and also in > > > the wix file name. > > >> > > >> So if my app is version 1.2.3, I'd like the .msi file to be called > > >> "MyAmazingApp_1_2_3.msi" or something equivalent. > > >> > > >> I've seen some articles on the net about pulling an assembly version > > >> and putting it into the wix file but they all seem like giant hacks. > > >> > > >> It seems to me that since versions seem to feature so prominently, it > > >> makes sense to integrate them more smoothly into the build system. And > > > > > >> you shouldn't have to set it in more than one place. > > >> > > >> How difficult would it be to create another candle varable, such as > > >> $(var.MyProject.Version) ? > > >> > > >> Is this something I can add myself, or do I have to jump through those > > > > > >> ugly hoops? > > >> > > >> -- > > >> Regards, > > >> cf > > >> > > >> ---------------------------------------------------------------------- > > >> -------- > > >> This SF.net email is sponsored by: > > >> SourcForge Community > > >> SourceForge wants to tell your story. > > >> http://p.sf.net/sfu/sf-spreadtheword > > >> _______________________________________________ > > >> WiX-users mailing list > > >> WiX-users@lists.sourceforge.net > > >> https://lists.sourceforge.net/lists/listinfo/wix-users > > >> > > >> > > >> > > >> ---------------------------------------------------------------------- > > >> -------- > > >> This SF.net email is sponsored by: > > >> SourcForge Community > > >> SourceForge wants to tell your story. > > >> http://p.sf.net/sfu/sf-spreadtheword > > >> _______________________________________________ > > >> WiX-users mailing list > > >> WiX-users@lists.sourceforge.net > > >> https://lists.sourceforge.net/lists/listinfo/wix-users > > >> > > > > > > > > > > > > -- > > > Regards, > > > cf > > > > ------------------------------------------------------------------------ > > > ------ > > > This SF.net email is sponsored by: > > > SourcForge Community > > > SourceForge wants to tell your story. > > > http://p.sf.net/sfu/sf-spreadtheword > > > _______________________________________________ > > > WiX-users mailing list > > > WiX-users@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > > > > > > ------------------------------------------------------------------------------ > > > This SF.net email is sponsored by: > > > SourcForge Community > > > SourceForge wants to tell your story. > > > http://p.sf.net/sfu/sf-spreadtheword > > > _______________________________________________ > > > WiX-users mailing list > > > WiX-users@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > > > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by: > > SourcForge Community > > SourceForge wants to tell your story. > > http://p.sf.net/sfu/sf-spreadtheword > > _______________________________________________ > > WiX-users mailing list > > WiX-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > > > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by: > > SourcForge Community > > SourceForge wants to tell your story. > > http://p.sf.net/sfu/sf-spreadtheword > > _______________________________________________ > > WiX-users mailing list > > WiX-users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > > > -- > Regards, > cf > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > -- Regards, cf ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users