PDA

View Full Version : MSBuild override PathVariables



janakp
07-03-2006, 09:09 PM
I have a Basic MSI Project. One component with Dynamic file linking with source referencing a path variable. I want to specify the location of source files (override the path variable) at build time using MSBuild.

I modified Macrovision.InstallShield.targets the to add the PathVariables property to the InstallShield task:
<InstallShield InstallShieldPath="$(InstallShieldPath)" Project="@(InstallShieldProject)" ProductConfiguration="$(InstallShieldProductConfiguration)" ReleaseConfiguration="$(InstallShieldRelease)" ReleaseFlags="@(InstallShieldReleaseFlags)" OutputGroups="@(TaggedOutputs)" MergeModulePath="@(InstallShieldMergeModulePath)" PathVariables="@(InstallShieldPathVariables)"></InstallShield>

In my .isproj file I added an ItemGroup to override my path variables:
<ItemGroup>
<!-- Override Path Variables for the project -->
<InstallShieldPathVariables Include="E:\ACInstallerResources\Dlls">
<PathVariable>PATH_TO_CUSTOMACTION_DLL</PathVariable>
</InstallShieldPathVariables>
<InstallShieldPathVariables Include="E:\ACInstallerResources\ACFiles">
<PathVariable>PATH_TO_RUNTIME_FILES</PathVariable>
</InstallShieldPathVariables>
<InstallShieldPathVariables Include="E:\ACInstallerResources\Icons">
<PathVariable>PATH_TO_AC_ICON</PathVariable>
</InstallShieldPathVariables>
<InstallShieldPathVariables Include="E:\ACInstallerResources\Text">
<PathVariable>PATH_TO_EULA</PathVariable>
</InstallShieldPathVariables>
</ItemGroup>

And, ran MSBuild.exe <path to xyz.isproj> from command line. The build succeeds but it is still getting the files from the path variables defined using the IDE (VS.Net 2005)

I found this old post (http://community.installshield.com/showthread.php?t=130595) which seems to indicate that path variables don't work with dynamic file linking, but there was no response to the post to verify that.

Is there an alternate way to specify location of source files at build time?

Thanks.

MichaelU
07-10-2006, 10:39 AM
Here are some things you can verify:
1. The product configuration and release you are building must be set to use Test path variable values - that's what the MSBuild input can affect.
2. You can make sure that MSBuild is passing the information you intend, either with higher verbosity (/v:d or /v:diag) or by adding a Message task.

Since you didn't mention anything about having set the use-test-values setting, I expect it's tripping this up.

janakp
07-10-2006, 02:42 PM
In the IDE, I changed the "Use Path Variable Test Values" setting to Yes. And ran MSbuild, still not overriding values. Do I need to add this setting to the .isproj msbuild file? If so, how do I do that? the ReleaseFlags itemgroup?

I also added the following Message task in the targets file right before the InstallShield task:
<Message Text="Path Variables:@(InstallShieldPathVariables->' %(PathVariable)=%(Identity)')"/>

The output in console window while executing msbuild is:
Task "Message"
Path Variables: PATH_TO_CUSTOMACTION_DLL=E:\ACInstall
erResources\Dlls; PATH_TO_RUNTIME_FILES=E:\ACInstallerRes
ources\ACFiles; PATH_TO_AC_ICON=E:\ACInstallerResources\I
cons; PATH_TO_EULA=E:\ACInstallerResources\Text
Done executing task "Message".

I tried using /v:d & /v:diag. In /v:d I did not see anything that would tell me that my pathvariables have been overrridden. v:/diag had too much output to fit in a console window.

Thanks.

janakp
07-13-2006, 03:15 PM
For anyone else who comes across this issue, InstallShield Tech Support acknowleged this as a bug. The Macrovision tracking # is IOC-000051791.