I am trying to create a patch (.msp file) using wix, where I am copying some files to installation path of the application (Program files) and also trying to add registry key.
While installing (using msi) it works fine as expected, binaries are updated.
But when I try to apply the patch it does not work, means binaries are not getting updated.
However, I observed that when I try to apply the patch once again the binaries seem to be updated.
Seems like here I am adding component by providing Guuid.
Question is: Why it works for fresh installation but not when using patch? Is it possible to add component with new guuid using patch (msp)?
Some more precise information is needed:
"While installing (using msi) it works fine as expected, binaries are updated".
Is this a fresh install or an upgrade of some kind? If it is a fresh install and your install replaces older binaries because they have a lower version then that is to be expected. You're just installing over existing files, although if they were previously installed by an MSI (yours or anyone's) then you may not be updating them correctly.
It is possible to add a component with a patch, but the rules can be complicated. The intent of a patch is mainly to fix existing components, not add them. Also, if you remove a component as part of a patch then the patch will not work properly. The main issue you need to be aware of is the component rules and not breaking them in a patch or an upgrade.
http://robmensching.com/blog/posts/2003/10/18/component-rules-101/
To add components or do any kind of change (other than fixing existing files) the safest thing to do in your situation is a major upgrade.
To find out if you've broken the component rules during an update (like a patch) take verbose log and look for SELMGR messages related to removal of components not being supported. Also set MSIENFORCEUPGRADECOMPONENTRULES =1 so that the update will fail if the rules have been broken.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370093(v=vs.85).aspx
http://robmensching.com/blog/posts/2007/1/4/doing-a-small-update-or-minor-upgrade-in-msi-use/