Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am working on a window application (Ex. a calculator) in VS2015. I had created a setup file for this application which will install the application in PC. Can we write code inside the setup project (like adding a new .cs file or something like that) because I am trying to create my own product key (custom key) specific to every PC? Also, that code should run while installing the product very first time on desktop asking for the product key to the user. Once the window application gets installed, whatever code written inside the main project (calculator, not in setup project) should only get executed.

If anyone could suggest some other way so that the application should ask for custom product only during the time of installation.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
254 views
Welcome To Ask or Share your Answers For Others

1 Answer

Application, First Launch: Many deployment guys tend to recommend putting licensing in the application itself - on first launch. There are many reasons, and here is an attempted explanation: Installer with Online Registration for Windows Application.

Custom Actions: Custom actions are used to do unusual or proprietary stuff in an MSI setups. Custom actions are legendary for being very difficult to get right and reliable due to the overall complexity of MSI and the complexity of deployment overall (section "The Complexity of Deployment"). Essentially custom actions are complex with sequencing-, conditioning- and impersonation issues and overall poor debugability.

Bottom Line: When you implement logic in your application launch code you are in familiar territory with no impersonation or debugging difficulties to deal with. Much easier to develop. Much easier to debug and maintain.

Per-User Licensing: The challenge is that your application must write to HKCU or the user profile - unless it runs elevated with admin rights. I prefer licensing to be done per-user, potentially allowing the license to roam with the user. Or to use an online licensing approach with licensing set up once over the wire. For example by a login approach to the application. You log into an online service and all licensing is part of that.

P.S: It is possible to apply ACL changes to HKLM allowing a non-elevated application to write a license key to HKLM. Possible, not a recommendation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...