You can use the package module provided by VS to conveniently package and deploy the project. You can also perform registry operations during installation and deployment to enable software startup. The specific implementation is as follows:
You do not need to create, install, and deploy this part. After adding and installing a deployment project, right-click to install the project-> View-> registry to run the software on startup, you can add a key value to the Software Directory in HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun. Here we add the preceding items in sequence, and then add the key value in Run. The key name can be set by ourselves. The value must be the physical path of the software. The physical path is determined by the customer's deployment. How can we obtain it? Here we can use [TARGETDIR] to obtain the path selected by the customer, and add the software startup file name. For example, if the name of the software startup file is client.exe, the Value of the Value is: [targetdir1_client.exe. The installation project is generated. Find the setup.exe file in the bindirectory and run it. After installation, we can find the corresponding key value in the registry. Restarting the computer system will automatically run the software we set.