A user comment recently alerted me to the need to update a past article I wrote on integrating MSBuild and WiX so that one might achieve build automation with WiX. My previous article was written a long time ago, and probably was done before actually implementing the process in practice.
How I actually integrated WiX with MSBuild in the real world will be shown in this post.
Let’s assume you want to set up WiX so that MSBuild can pass some variables to it (a good example being the product version; let’s assign that to a constant named PRODUCTVERSION).
In your WiX source, you’d reference that passed-in product version using:
1 | $(var.PRODUCTVERSION) |
To get that to work, the first thing I do is edit the *.wixproj file itself. Place the following somewhere in the file (mine is at the bottom about):
1 2 3 4 5 | < Target Name = "BeforeBuild" > < CreateProperty Condition = "$(PRODUCTVERSION) != ''" Value = "PRODUCTVERSION=$(PRODUCTVERSION);$(DefineConstants)" > < Output TaskParameter = "Value" PropertyName = "DefineConstants" /> </ CreateProperty > </ Target > |
Then, in your msbuild/team build script, you can build the WiX project and pass in the product version like so:
1 2 3 | < MSBuild Projects = "$(PathToProjectFolder)\YourProject.wixproj" Properties = "PRODUCTVERSION=$(YourProductVersion)" /> |
Naturally, you need to define the “PathToProjectFolder” and “YourProductVersion” somewhere.
Also, if you want to pass additional properties, they should be semicolon delimited when setting the “Properties” attribute.
Hi nice article,
excepting more like this…Matt weber
This was exactly what I needed and it worked perfectly!
Thanks!!
Hi,
Great article ! Thanks for sharing.. It really helped me to get through a situation..
… [Trackback]…
[...] Read More here: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Read More on that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Find More on that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] There you can find 75049 additional Information on that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Read More on that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Read More here to that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Read More Information here to that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Here you will find 2560 additional Info to that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Info on that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Find More Info here on that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…
… [Trackback]…
[...] Read More here to that Topic: badecho.com/2011/09/automating-wix-with-msbuild [...]…