开发者

using CustomActionAttribute in System.Configuration.Install.Installer classes

开发者 https://www.devze.com 2023-02-21 23:58 出处:网络
Can I use CustomActionAttribute in classes that inherit from System.Configuration.Install.开发者_运维百科Installer? I want my class library to support both WiX and Visual Studio setup project.I don\'t

Can I use CustomActionAttribute in classes that inherit from System.Configuration.Install.开发者_运维百科Installer? I want my class library to support both WiX and Visual Studio setup project.


I don't see any immediate reason why you couldn't do this. One obstacle is that Wix managed CA functions must be declared public static, so you would probably need to refactor most of your logic into functions that could be called by both your Install/Uninstall functions as well as your Wix CAs functions.

If you were to do this I would recommend creating the project from the Votive Managed Custom Action template in Visual Studio and then manually adding a Installer Class to the project. You can then define static functions in the installer class that can be exposed as CAs using the CustomAction attribute.


The reasons for not doing it are: you can't have methods with same names in your custom actions assembly custom action method calls in WiX And the DTF methods and VS setup project methods are different in signature. Also, as I've understood, VS setup project CAs don't use Session object, unlike DTF CAs.

0

精彩评论

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

关注公众号