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
Related
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.
I have changed the registry manually for all the machines. It works on my own machine with Visual Studio. I tried another Win 10 Virtual machine and a Win 7 pro on a remote desktop, but it does not work on all of them. However, I have used the remote desktop to run other exes with similar functions and it works.
I have a guess: does the .vshost.exe should also be added to the FEATURE_BROWSER_EMULATION list?
UPDATE: I have noticed the difference of whether the registry key is in Wow6432node according to http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version . And it works after adding the registry key to the Wow6432node. So a new question arouses: When will the webbrowser runs in x86 and when x64? And when will the managed code runs in x86 and when x64? According to my practice, adding registry keys to the path without wow6432node sometimes work and sometimes doesn't.
In the task manager, you will see name of the executable file. If you're running the app with Visual Studio (debug mode), the name will be "application_name .vshost.exe". In this case, you should name the registry key in that way. Otherwise, use name of the executable file generated by debugging, and run it.
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
I am just wondering if it is possible to run a small code just once when the application is installing.
I would like to create a registry with the installation path. The reason why I need that because I have a windows service in my application as well, which install path always changes to system32.
I have an ini file which is created in the installation folder at installation. I need to reach that file with my service and windows form as well.
You don't need any extra code, just create a registry key in HKLM\software\yoursoftware-here with a key name like Installpath and a value of [INSTALLDIR] in your install, then reference that key in your service.
This assumes you are using a basic MSI project in install shield.
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.