Either you use third party installer or customize the setup and deployment tool from VS to add serialNumber Dialog form.
Take a look at this
Link
For trial version, this depends on where you want to implement the trial option, if you want it during installation, third party installer will be the best option but to do this within your program but they are quite costly and the most popular of them is InstallShield.