Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

c# - installer- Setup project in VS 2015

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...