开发者

WiX - Writing new file from Custom Action

I have a C# Custom Action that loads an XML document and makes some changes to its contents.

When I run this on my Windows 7 32-bit workstation, the new XML document is not created. When I test the installer on a Windows Server 2003 VM, the CA works as expected and saves the XML document in the installation directory.

string configFile = Path.Combine(configFileSaveLocation, 开发者_如何学运维targetName);
StreamWriter writer = new StreamWriter(configFile);
doc.Save(writer);
writer.Close();

where 'doc' is an XmlDocument.

No exceptions are caught if I put the above 4 lines in a try/catch block.

Any thoughts as to what I'm missing?


Since Impersonate="No" did the trick, it's clearly a permissions issue. But that alone leaves the lack of exception unexplained. Windows Vista and later will redirect certain kinds of bad file accesses to %LocalAppData%\VirtualStore\Program Files*. I bet if you look there instead of the real Program Files* you will see your configuration file.

While researching this I just learned one easy way to get there is to look in the real folder and click the Compatibility files button in Explorer; the button only appears when relevant. See Scenario 2 on Common file and registry virtualization issues in Windows Vista or in Windows 7 for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜