I have publish my current project. I got the publish folder in my Project's folder. I installed my program and it works perfectly, but I need to know if it is possible that after installation (installer is from the Visual Studio 2012 when you publish the project) the program will start automatically upon windows start up.
You could have the installer create a link to your application in the Windows Registry, under the Run or RunOnce registry keys for Windows.
Here is more information about the Run and RunOnce registry keys:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa376977(v=vs.85).aspx
Related
When publishing a console application, I have a lot of settings that I can change when deploying. I can choose between azure, clickonce, docker, normal folder and I am also able to choose the target runtime and the deployment mode.
But when using the windows service template for my project and I want to publish this, then the GUI looks totally different. I am not able to choose the settings that I had with the console application. I am not even able to choose the target runtime nor the deployment mode. Despite all that when I continue, the folder where my windows service is deployed doesn't contain an exe file of my application. It contains the setup.exe, but that is not what I want. I want the exe file of the windows service itself.
Does anyone have an idea why the settings are different and why it only gives a setup.exe?
Here below the settings of the publish console application as it should be.
Here below the settings of the publish windows service template which looks totally different and with fewer settings.
I don't understand your question very well, I suggest you review the files created by the publishing process.
1.In Solution Explorer, select Show All Files.
2.In the project folder, expand bin/Release/net6.0/publish.
If you are publishing console applications in visual studio, you can refer to this document, which has detailed publishing steps.
https://learn.microsoft.com/en-us/dotnet/core/tutorials/publishing-with-visual-studio?pivots=dotnet-6-0#publish-the-app
After writing the window service class, do the following:
Right click and select Add Installer
The ProjectInstaller.cs file is added to the project, and the view in this file will automatically add two components serviceProcessInstaller1 and serviceInstaller1
3.Set the main properties of serviceInstaller1, ServiceName: the unique system service identifier, used when executing the command in the command, use to identify a window service. Set StartType, if it is Manual, start manually, stop by default, if it is Automatic, it will start automatically.
4.Rebuild the project
5.Open Developer Command Prompt for Visual Studio with administrative credentials. In Developer Command Prompt for Visual Studio, navigate to the folder that contains your project's output (by default, the \bin\Debug subdirectory of your project).
Enter the following command:installutil MyNewService.exe
6.Start and run the service. In Windows, open the Services desktop app. Press Windows+R to open the Run box, enter services.msc, and then press Enter or select OK.
I was trying to launch an application using a windows service written in c# , VS 2015. The problem is that the application has a 32 bit dll. My machine is a 64-bit one. When I try running the windows service, I get a prompt that says "application failed to launch correctly 0xc0000142".
This is what I've done till now to resolve it
1.) Changed the build and target of the project in VS15 to point to x86
2.)Loaded the 32-bit dll into dependency walker. However, I hit an issue with dependency walker
3.) Checked in System Registry editor that the value of LoadAppInit_DLLs was 0
4.) Ran the project on administrator mode
I don't face these issues if I run the windows service in Debug mode by clicking "start" in VS15.
The issues occur if run installutil and then try launching the windows service by running "NET start service_name"
If the value of LoadAppInit_DLLs is 0 but still not run program correctly, you should try to reinstall your .NET Framework to newest version.
After that, open your VS2015 with command: devenv /ResetSettings in Run. Open your project and try debug again.
In Visual Studio 2010 I have a c# windows application created and a setup deployment project.
Under configuration manager, the app is targeted at x86 but I cannot choose what the setup project targets as there is no dropdown available for this.
In the setup deployment project, I right click - view - registry and create the following . .
Under HKLM/Software/Manufacturer
I add Microsoft, then under that I add Windows, then under that I add CurrentVersion, then under that I add Run, so I end up with HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
Inside run I add a new string value for my app and set its value to "[TARGETDIR]my_app.exe" /R
This all compiles fine, when I run the installer on a target machine, it installs the Application but the registry entry does not get written. I have tried installing my Application on windows 7 32-bit and 64-bit, neither gets the key created. In regedit, the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run exists and I can navigate to it but my entry is not there. I can create it manually so why can't the installer do it?
All I want is to set this key on any target machine no matter what the target is - 32-bit or 64 bit, XP, or Vista or Win7/8
I have created a setup for my windows application in .NET 2008
After building the same i have the .msi and setup.exe files in my release folder.
The problem i am facing is :
I can install the application using the msi installer files from the shared network folder. But when i copy the installer locally and tried to install it,
i get the following error: Error reading file.Please Try again.
Anybody having any ideas if there are any properties to set in the installer project.
Regards
Constant Learner
Just a thought, you can use Orca to go through the .msi and see if you're having any static references to your development machine within your msi.
The application is a simple windows application without any database associated with it.
Its just a hello world windows application. So i presume its something related to the configuration part of the installation...
Constant Learner
how to resume installation after restarting pc in c# in Setup and Deployment project?
Create a registry entry indicating where your installer left off.
Make an entry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce with your installer name and location.
Your installer will be run after the PC reboots.
Read the registry entry and continue your installation.