embed parameters in exe?

afix

New member
Joined
Mar 16, 2010
Messages
3
Location
Netherlands
Programming Experience
5-10
Hi,

I am developing a Windows Forms application in VB2008 Express that I want to run directly of the Internet and optionally off-line on another computer (e.g. using a USB stick), without any installation/setup. However I need to pass 2 parameters to it: the language as selected on the website (i.e. not the current culture) and one of the predefined partner names. I can do that for a ClickOnce application but this only works in IE and not off-line. As I cannot use a separate config file, cookie or shortcut, I am thinking of “embedding” the parameters in the exe. Given the large number of combinations (#languages * #partners), I want to create and upload these files automatically using a batch file. I am also thinking of digitally signing the application in the near future.

I can think of 3 ways of storing the parameters (e.g. language "EN" and partner "Abc"):
1. In the filename (e.g. Abc_EN.exe): but this is rather cryptic for end-user and he/she could decide to store it under another name, so not a great option;
2. In one of the file properties (e.g. as "-language EN -partner Abc" in the "Description" property of the "Assembly Information"): this works, but how can I automate the creation of the various exe files?
3. Somewhere with the digital signature???: but where and how and can I access this information from within the application?

I have looked at the Assembly Linker (AL.exe) to build the exe outside of the VS2008E IDE, as it allows me to specify the description property in the command line, but I cannot seem to find the proper syntax to build the entire project (including the form.resx and various icons) and it may be time consuming to do this for each exe file.

I have also looked at stand-alone utilities that can change the file properties (so I only have to build the exe once in the IDE), but have not found one that can do that through the command line. I could off course write my own utility, but I don't know if it affects the digital signature.

I am actually looking for "the proper way to do this" (if it exists). Is there anyone who has a better suggestion? Or does anyone know how to get the third option to work (possibly with “delay signing” and the Strong Name tool)?

Thanx
 

afix

New member
Joined
Mar 16, 2010
Messages
3
Location
Netherlands
Programming Experience
5-10
Anybody?

In the meantime I have also looked at devenv.exe (not available in the express version), msbuild.exe, vbc.exe, codesign.exe, sn.exe, but none of them seem to allow me to specify free text data (like "-partner Abc -language EN") that I can access in the application. The project settings tab allows me to specify and access variables, but I cannot seem to manipulate this outside the IDE using a command-line tool. And separate utilities to modify the file properties seem to be restricted to dates and attributes and don't allow me to modify description, company, language, version, etc.

My question actually comes down to: I want use a command line tool to create a number of variants of one executable having different configuration settings.

Surely I am not the first who needs this? :confused:
 

afix

New member
Joined
Mar 16, 2010
Messages
3
Location
Netherlands
Programming Experience
5-10
Nobody?

Doesn't anybody have any suggestions on how to create a number of variants of one executable with different configuration settings??? :confused:
 
Top Bottom