Error 1001 when installing custom Windows Service
Asked Answered
J

8

20

I wrote a windows service that runs on Framework 4.0 and running in VS 2015. I also created a setup project (free Installshield version).

My service did not show under services.msc after I installed it, so according to some other posts I had to mark the Primary Output in InstallShield as 'Installer Class', but when I do that I get Error 1001 when I run the setup.exe.

This post states that "Error code 1001 ALWAYS means a failure in the Installer class custom action." and that I should not use Custom Actions. I'm not using any custom actions at the moment.

Most of the solution on this site have instructions for Installshield 2010, and the steps does not work for 2015.

The error appears on both my dev machine as well as all client machines. Any suggestions?

EDIT:

The event viewer displays "Failed to create restore point (Process = C:\Windows\system32\msiexec.exe /V; Description = Installed My App Name.; Error = 0x80070422).

Justiciable answered 5/10, 2015 at 13:28 Comment(0)
J
0

I found something to get rid of the problem, but it does create a new question, albeit a much simpler and less critical one.

What caused my problem is that I had to remove the following code from my ServiceInstaller's AfterInstall:

new ServiceController(ServiceInstaller.ServiceName).Start();

This was added to auto start my service once it has been installed. For now I will just manually start the service.

Justiciable answered 24/11, 2015 at 19:4 Comment(0)
T
38

I had this exact same issue. Suddenly after upgrading to VisualStudio 2013 and the newer InstallShield LE and building my installation packages they would fail with the cryptic 1001 error.

Definitive Answer

I found the definitive answer. You can no longer have the checkbox for "installer class" selected in InstallShieldLE. You must uncheck that item.

In order to open this dialog box, go to Specify Application Data > Files and right click on your Primary Output and select Properties.

uncheck Installer Class

Previously, You Had To Have It Selected: Now It Must Not Be Selected

Previously (Visual Studio 2012 and before you had to have that item selected or the service installation would fail. This is quite terrible.

Now, you have to go to following tree item in the InstallShield LE project and double-click the Services node: services node

After that the Services item appears on the left (have I mentioned what a terrible UX and UI this entire thing is?) and right click it so you can add the service.

add service

Choose the menu item which appears to add the service and you'll get a form which allows you to set up the installer details.

installation details

Once you do that and rebuild your MSI will work and this will resolve the 1001 error.

This was all a terrible waste of time that the original InstallShield Devs could've resolved. Unfortunate.

Timotheus answered 8/7, 2016 at 14:58 Comment(5)
Unchecking "Installer Class" checkbox in the Properties dialog box for the Primary Output worked for me.Avril
@Avril Glad it helped and thanks for the add'tl info you added to the answer.Timotheus
@daylight Thanks. I solved error 1001, but I got error 1920Trope
Make sure you check all of your primary outputs. I had 3 and only checked 1 at first assuming that there was only one primary output. Finally i changed it and it works:)Hautboy
Thanks. If you then get an error message when installing that contains "verify that you have sufficient privileges to install system services" check out this page for the solution: community.pharos.com/thread/2372 as it saved me so much time.Shellfish
L
7

If you have .NET 4.6 installed on your build machine, you'll need the 2015 version of the limited edition to avoid a versioning bug with InstallShield's support for Installer Classes. (There are many causes for a 1001 error, so this is not a guaranteed fix.) Note that InstallShield 2015 Limited Edition does not support the community edition of Visual Studio.

Libnah answered 6/10, 2015 at 12:21 Comment(1)
Thanks. I've upgraded to 2015 now, but I still find the error.Justiciable
F
3

Hopefully this will help some of you encountering the Error 1001 when trying to install a .NET Windows Service using InstallShield 2015 LE installer project with the Primary Output set as an Installer.

It's a known bug when .NET 4.6 is installed on Windows 10.

https://flexeracommunity.force.com/customer/articles/en_US/ISSUE/HOTFIX-Install-Fails-With-Error-1001-When-a-NET-Installer-Class-Component-is-Present-in-InstallShield-2015-SP1

Foret answered 9/1, 2017 at 23:16 Comment(2)
Please do not post the same answer to multiple questions. If the same information really answers both questions, then one question (usually the newer one) should be closed as a duplicate of the other. You can indicate this by voting to close it as a duplicate or, if you don't have enough reputation for that, raise a flag to indicate that it's a duplicate. Otherwise tailor your answer to this question and don't just paste the same answer in multiple places.Choke
This created an error: Class not registered. I'm not sure the linked solution is compatible with InstallShield LE 2015.Madrigal
S
1

Since i cant comment yet i will just reply with an answer to your own accepted answer. I know it has been a while since you asked the question but here goes.

If you want auto start after install you can go to step 3. Configure the Target System. Choose the Services tab. Right click Services and add Service. You should be able to locate any service in your Primary Output. Once added you can select different settings related to auto start and so on. Hope it helps you.

On a side note, i am still looking for the answer to my 1001.

Station answered 8/3, 2016 at 11:1 Comment(0)
Y
0

This error occurs when targeted .NET framework is not installed.

If you are targeting the same development machine then please check if that service (EXE) is already running on that machine or not (It should not running).

Yulandayule answered 13/10, 2015 at 9:15 Comment(1)
I'm targeting framework 4 and it is installed. Not working.Justiciable
J
0

I found something to get rid of the problem, but it does create a new question, albeit a much simpler and less critical one.

What caused my problem is that I had to remove the following code from my ServiceInstaller's AfterInstall:

new ServiceController(ServiceInstaller.ServiceName).Start();

This was added to auto start my service once it has been installed. For now I will just manually start the service.

Justiciable answered 24/11, 2015 at 19:4 Comment(0)
D
0

I am using VS 2012 with InstallShield LE 2015 targeting .NET 4.5 and I have to uncheck the "Installer class" for it to work.

Descombes answered 22/1, 2017 at 22:49 Comment(0)
A
0

After some digging I found out that the installer fails with that error when it tries to remove the service (associated with whatever you are installing) - AND (the service) is not there anymore. My use case scenario - Start install from MVS2015 of a complex solution that comprises also a windows service. When you change the version of the solution, the installer stops in its tracks finding that the your app was installed before and can not uninstall it as it is a different version. It pops up a dialog box stating this and exits .... BUT IT HAS UNINSTALLED the service. Now trying to install or uninstall fails with the error 1001 because windows doesn't find the service to uninstall it.

If somebody has a better solution please post it, but my solution is to use sc command line utility. sc is a utility that can be used to manipulate services from the command line (type sc for help). So i use sc to add the service (by name), and then I can do uninstall, or install as usual. Is compulsory to have a valid bin path in command - but ANY valid path will be accepted.

sc <server> create [service name] [binPath= ] <option1> <option2>...

Example:

sc create MyService binPath= C:\Windows\explorer.exe
[SC] CreateService SUCCESS
Angeli answered 27/3, 2017 at 5:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.