问题
I'm trying to build an InstallShield project with MSBuild and TFS 2013. I followed the steps required to override the product code as indicated here. First, I created an .isproj file and managed to generate the installer successfully. However, the product code seems not to be changed. I check the file setup.ini and noticed that the Product GUID still the same as the value of Product Code in the .ism file. Is there a way to verify that the product code and product version have been changed?
@Update
It worked finally, I was able to verify the newly generated product code using Orca.
Chris's script works perfectly as well!
回答1:
This is how I do it:
In my ISM release view (build tab) I set the Release Location to \Installer instead of In my Path Variables I declare an ISBUILDDIR path variable and give it a default value of ISProjectDataFolder
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Build">
<PropertyGroup>
<MSIProductVersion>$([System.Text.RegularExpressions.Regex]::Match($(TF_BUILD_BUILDNUMBER), "\d+.\d+.\d+.\d+"))</MSIProductVersion>
<Configuration>Debug</Configuration>
<InstallShieldProductConfiguration>ProductConfigName</InstallShieldProductConfiguration>
<InstallShieldRelease>ReleaseName</InstallShieldRelease>
<InstallShieldProductVersion>$(MSIProductVersion)</InstallShieldProductVersion>
<MSIProductCode>$([System.Guid]::NewGuid().ToString("B").ToUpper())</MSIProductCode>
<InstallShieldBuildDependsOn>PreBuild</InstallShieldBuildDependsOn>
</PropertyGroup>
<ItemGroup>
<InstallShieldPathVariableOverrides Include="$(OutDir)">
<PathVariable>ISBUILDDIR</PathVariable>
</InstallShieldPathVariableOverrides>
</ItemGroup>
<ItemGroup>
<InstallShieldPropertyOverrides Include="$(MSIProductCode)">
<Property>ProductCode</Property>
</InstallShieldPropertyOverrides>
</ItemGroup>
<ItemGroup>
<InstallShieldProject Include="$(MSBuildProjectDirectory)\$(MSBuildProjectName).ism"/>
<InstallShieldMergeModulePath Include="$(MSBuildProjectDirectory)\MSM"/>
</ItemGroup>
<Target Name="PreBuild">
<Exec Command="attrib -s -h -r /s "$(MSBuildProjectDirectory)\*.*"" IgnoreExitCode="true" ContinueOnError="true"/>
</Target>
<Import Project="$(MSBuildExtensionsPath32)\InstallShield\2012\InstallShield.targets"/>
</Project>
来源:https://stackoverflow.com/questions/22625594/how-to-verify-if-the-product-code-and-product-version-have-been-updated-using-ms