How can I pass a Visual Studio project's assembly version to another project for use in a post-build

Posted by Coder7862396 on Stack Overflow See other posts from Stack Overflow or by Coder7862396
Published on 2010-06-11T06:21:16Z Indexed on 2010/06/11 6:32 UTC
Read the original article Hit count: 284

Filed under:
|
|
|
|

I have a solution with 2 projects:

  • My Application 1.2.54 (C# WinForms)
  • My Application Setup 1.0.0.0 (WiX Setup)

I would like to add a post-build event to the WiX Setup project to run a batch file and pass it a command line parameter of My Application's assembly version number. The code may look something like this:

CALL MyBatchFile.bat "$(fileVersion.ProductVersion($(var.My Application.TargetPath)))"

But this results in the following error:

Unhandled Exception:The expression """.My Application" cannot be evaluated. Method 'System.String.My Application' not found. C:\My Application\My Application Setup\My Application Setup.wixproj

Error: The expression """.My Application" cannot be evaluated. Method 'System.String.My Application' not found. C:\My Application\My Application Setup\My Application Setup.wixproj

I would like to be able to pass "1.2.54" to MyBatchFile.bat somehow.

© Stack Overflow or respective owner

Related posts about msbuild

Related posts about variables