Chetan, 

It sounds like you're working in VisualmStudio or using MsBuild. I don't know 
anything really about either one with respect to WiX.

That said, setting an environment variable from a program has usually only 
lasted until that program exits. I don't know where or when that C# code is 
running but that could be a problem.

Also, running Candle as a prebuild command seems very wrong.

I looked very briefly at the VS integration and decided it wasn't worth my 
time. Also, there are folks in my organization who do packaging but not any 
development, so as the WiX trailblazer around here, I didn't want to depend on 
stuff they don't have. 


On Feb 20, 2014, at 12:02 AM, Chetan Rajakumar <chetan_rajaku...@infosys.com> 
wrote:

> Hi Walter,
> 
> I am not able to accomplish this, please help me out. I am doing the below 
> Steps:
> 
> 1. From C# code I am setting environment variable as shown below, 
> System.Environment.SetEnvironmentVariable("DRAFTVERSION", "1.2.3.4");
> 
> 2. In Installer Project's Properties under Pre-Build event Command line, I 
> have written the below line.
> "$(WiX)\bin\candle.exe" -dSvnVersion=%DRAFTVERSION% -out 
> "$(ProjectDir)\Product.wxs"
> 
> 3. In Product.wxs
> <Product Id="*" Name="MyProduct" Language="1033"
>           Version="$(var.SvnVersion)" Manufacturer="MyManufacturer" 
> UpgradeCode="335459EF-2345-4CD7-8EDA-59996E3333C3">
> 
> I am getting below error.
> Undefined Preprocessor Variable.
> 
> Please let me know if I have missed something.
> 
> 
> Thanks and Regards,
> Chetan.
> 
> -----Original Message-----
> From: Suvrajyoti Panda [mailto:suvrajyo...@contata.co.in] 
> Sent: Friday, February 14, 2014 11:34 AM
> To: General discussion about the WiX toolset.
> Subject: Re: [WiX-users] Read a value from a text file and use it in WIX 
> source file
> 
> Thanks Walter, that works for me  :)
> 
> On 12-02-2014 21:35, Walter Dexter wrote:
>> Sorry I forgot about this. Here's what I'm doing. I'm sure someone 
>> more experienced will have a much better way, but this works for me.
>> 
>> First, in my "build.cmd" file, set "svt" envrironment variable to the 
>> contents of the "svnversion.txt" file:
>> 
>> set /p svt=<svnversion.txt
>> 
>> 
>> Then, pass it to "candle" on the command line:
>> 
>> candle -dSvnVersion=%svt% main.wxs
>> 
>> 
>> In "main.wxs" you can then use it as a variable. For example:
>> 
>> <Property Id="MCO_SVNVERSION" Value="$(var.SvnVersion)" />
>> 
>> 
>> 
>> On Tue, Feb 11, 2014 at 9:34 AM, Suvrajyoti Panda 
>> <suvrajyo...@contata.co.in
>>> wrote:
>>> Thanks Walter, that would be really helpful if you can give me an example.
>>> 
>>> Regards,
>>> Suvra Jyoti
>>> 
>>> On 11-02-2014 19:53, Walter Dexter wrote:
>>>> It may not be the most elegant way, but I'm doing the same thing by
>>> passing
>>>> the contents of the file (first line anyway) as a command line 
>>>> argument
>>> to
>>>> the linker.
>>>> 
>>>> I use a .cmd file to run the WiX ci mpile and link so its just a bit 
>>>> of batch file processing.
>>>> 
>>>> If you need an example I can get it for you once I get to work. Let 
>>>> me
>>> know.
>>>> On Feb 11, 2014 12:40 AM, "Suvrajyoti Panda" 
>>>> <suvrajyo...@contata.co.in>
>>>> wrote:
>>>> 
>>>>> Hi All,
>>>>> 
>>>>> I have a requirement wherein in i need to read a value from a text 
>>>>> file located at  D:\Project\ESI\Code\trunk\lastVersion.txt. This 
>>>>> file contains a single  line as below:
>>>>> 
>>>>> 6.0.0 Build 3280
>>>>> 
>>>>> This 6.0.0 is basically the "version" . Now i want to read this 
>>>>> value of version and use it in the name of the product in the WIX 
>>>>> source file as
>>>>> below:
>>>>> 
>>>>> <Product *Name**='Tort Installer 1.0'* 
>>>>> Id='5A1581BE-27C3-46A1-8699-4F1D642C97E0'
>>>>> UpgradeCode='C54B7D5D-0E66-43E8-A770-C9750693F057'
>>>>>       Language='1033' Codepage='1252' Version='1.0.0'
>>>>> Manufacturer='$(var.ManufacturerName)'>
>>>>> 
>>>>> Instead of the "1.0" in the "Name" attribute i want to use the 
>>>>> value of "6.0.0" that is there in the text file mentioned above.
>>>>> 
>>>>> Please let me know how can i go about solving this issue.
>>>>> 
>>>>> Regards,
>>>>> Suvra Jyoti
>>>>> 
>>>>> 
>>> ---------------------------------------------------------------------
>>> ---------
>>>>> Android apps run on BlackBerry 10
>>>>> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>>>>> Now with support for Jelly Bean, Bluetooth, Mapview and more.
>>>>> Get your Android app in front of a whole new audience.  Start now.
>>>>> 
>>>>> 
>>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg
>>> .clktrk
>>>>> _______________________________________________
>>>>> WiX-users mailing list
>>>>> WiX-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>>>> 
>>> ---------------------------------------------------------------------
>>> ---------
>>>> Android apps run on BlackBerry 10
>>>> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>>>> Now with support for Jelly Bean, Bluetooth, Mapview and more.
>>>> Get your Android app in front of a whole new audience.  Start now.
>>>> 
>>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg
>>> .clktrk
>>>> _______________________________________________
>>>> WiX-users mailing list
>>>> WiX-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> ---------
>>> Android apps run on BlackBerry 10
>>> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>>> Now with support for Jelly Bean, Bluetooth, Mapview and more.
>>> Get your Android app in front of a whole new audience.  Start now.
>>> 
>>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg
>>> .clktrk _______________________________________________
>>> WiX-users mailing list
>>> WiX-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>> 
>> ----------------------------------------------------------------------
>> --------
>> Android apps run on BlackBerry 10
>> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
>> Now with support for Jelly Bean, Bluetooth, Mapview and more.
>> Get your Android app in front of a whole new audience.  Start now.
>> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.
>> clktrk _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>> 
> 
> 
> ------------------------------------------------------------------------------
> Android apps run on BlackBerry 10
> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> Now with support for Jelly Bean, Bluetooth, Mapview and more.
> Get your Android app in front of a whole new audience.  Start now.
> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
> for the use of the addressee(s). If you are not the intended recipient, 
> please 
> notify the sender by e-mail and delete the original message. Further, you are 
> not 
> to copy, disclose, or distribute this e-mail or its contents to any other 
> person and 
> any such actions are unlawful. This e-mail may contain viruses. Infosys has 
> taken 
> every reasonable precaution to minimize this risk, but is not liable for any 
> damage 
> you may sustain as a result of any virus in this e-mail. You should carry out 
> your 
> own virus checks before opening the e-mail or attachment. Infosys reserves 
> the 
> right to monitor and review the content of all messages sent to or from this 
> e-mail 
> address. Messages sent to or from this e-mail address may be stored on the 
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
> 
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to