Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to DefineConstants property should trigger rebuild #4952

Closed
wixbot opened this issue Nov 9, 2015 · 8 comments
Closed

Changes to DefineConstants property should trigger rebuild #4952

wixbot opened this issue Nov 9, 2015 · 8 comments

Comments

@wixbot
Copy link

wixbot commented Nov 9, 2015

We use the MSBuild property <DefineConstants> to pass values used in WXS files from build server to MSBuild and then to WiX compiler.

Changes to the <DefineConstants> should be detected by incremental build and caused the WXS files to be compiled again. Right now, the MSBuild thinks the source code is up-to-date even it should rebuild affected WXS files.

A workaround is to run Rebuild.

We use <DefineConstants> to create multiple MSI files with a single CAB media file. It would be beneficial to have incremental builds that would recompile MSI when<DefineConstants> changes and the CAB files will not be rebuild (it is time consuming in our build system).

Originally opened by jozefizso

@wixbot
Copy link
Author

wixbot commented Nov 14, 2015

MSBuild incremental support today is driven by timestamps so there's not much wix.targets could do to change that.

Resolution set to external
Status changed from Untriaged to Resolved

@wixbot
Copy link
Author

wixbot commented Nov 19, 2015

A solution might be to have a msbuild task in wix.targets to create a dummy file (maybe containing the contents of ) that changes whenever change. Then add this file to the Inputs attribute of the Target.

Originally posted by wesman
Status changed from Resolved to Untriaged

@wixbot
Copy link
Author

wixbot commented Nov 19, 2015

We pass constants values from the TeamCity server, so project file does not change, but the compiled output should (eg. we pass new build number but WiX does not compile anything, as MSBuild does not detect a change).

This can be mitigated by wesman's proposal. WiX build scripts can update a temporary file, that will contain the DefinedConstants value. The script will read the file, compare the content and update it if it does not match.

This file will be input dependency for the WiX core build, so if it is changed, WiX will rebuild the project. (eg. compile a new installer with updated version number).

Originally posted by jozefizso

@wixbot
Copy link
Author

wixbot commented Nov 19, 2015

Or you could make it so changes to your DefineConstants change the intermediate&output locations so you aren't dependent on overwriting existing files with different data. IMHO, that would be a better solution that creating another temporary build file.

Originally posted by robmen
Status changed from Untriaged to Resolved

@wixbot
Copy link
Author

wixbot commented Nov 19, 2015

@robman that does not work. Change to output location does not trigger rebuild, as input files are the same.

Originally posted by jozefizso

@wixbot
Copy link
Author

wixbot commented Nov 19, 2015

If the output file does not exist, MSBuild should detect that and build independent of the state of the inputs. That's why the Rebuild target works. It deletes the output files (Clean) then builds even though the input files did not change.

Originally posted by robmen

@wixbot
Copy link
Author

wixbot commented Nov 19, 2015

The constants from <DefinedConstants> are used in WXS files. Unless the input files change, the build script does not call light.exe which compiles WXS into intermediates and MSI.

If I pass the version number using <DefineConstants>, WXS are not rebuild and the MSI would contain old version number.

That's why the input to the build target must be also the content of the <DefineConstants>.

Originally posted by jozefizso

@wixbot
Copy link
Author

wixbot commented Nov 19, 2015

.csproj files work the same way. To prevent needless cab rebuilding, look at -cc and -reusecab.

Originally posted by barnson

@wixbot wixbot added this to the v3.x milestone Dec 20, 2015
@wixbot wixbot closed this as completed Dec 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant