I know that if I define a preprocessor directly in the wixproj file, I can
use it in wxs file just like this: $(var.PROPERTYNAME). However, the problem
with this kind of preprocessor is it is Configuration/Platform specific. We
want to define a SW version number(which needs to be used in wxs file as
well as wixproj file for AfterBuild target) so it will easily become out of
sync(for example, build engineer only modifies the version for the current
Configuration/Platform combination in Visual Studio IDE, and it becomes
different from other combinations).

I got one suggestion from a thread. I created one txt file which only
defines a MSBuild project and inside this project, I defined a version
number property in the common PropertyGroup. After that, I imported this
project in my wixproj file. By doing this, my main wix project file can
reference this property(so that I can rename my output file using the
version number, which is my ultimate goal) and yet this property will not
show up in the project's properties window so we won't mess it up.

My txt file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003";
ToolsVersion="4.0">
    <PropertyGroup>
      <Version>1.2.3.4</Version>
    </PropertyGroup>
</Project>


And in my wixproj file, I import it by:
Import Project="Version.txt" />


So now in my project file I can reference just simply by $(Version). But if
I reference it inside my wxs file like this:
<?define VersionNumber = "$(var.Version)" ?>


It is complaining about undefined preprocessor. So can anyone tell me how to
reference it correctly? Thanks!



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/How-to-reference-a-preprocessor-which-is-imported-by-the-wixproj-file-tp7581769.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to