Dsjohn
Dsjohn

Reputation: 61

Microsoft Visual Studio Installer Projects 2022 - Error 1001 when installing migrated Windows form application to Visual Studio 2022/.Net 4.8

I have a Visual Studio 2008/.Net 3.5 Windows Form application with a separate setup project using “Install” and “Uninstall” Custom Actions. The “Install” Custom Action creates an “EventLog” source, and the “Uninstall” Custom Action deletes the source and the log. The Setup Project removes the previous version when making a new application release with the “RemovePreviousVersions” property set to “True.”

namespace EventLogInstallerDLL
{
    [RunInstaller(true)]
    public partial class EventLogInstaller:Installer
    {
        public EventLogInstaller()
        {
            InitializeComponent();
        }

        string sLog =  "Application";
        string sSource = "APP";

        public override void Install(IDictionary savedState)
        {
            base.Install(savedState);

            // Create the source, if it does not already exist.
            if (!System.Diagnostics.EventLog.SourceExists(sSource))
            {
                System.Diagnostics.EventLog.CreateEventSource(sSource, sLog);
            }
        }

        public override void Uninstall(IDictionary savedState)
        {

            // Delete the source, if it exists.
            if (System.Diagnostics.EventLog.SourceExists(sSource))
            {
                System.Diagnostics.EventLog.DeleteEventSource(sSource);
                System.Diagnostics.EventLog.Delete(sLog);
            }

            base.Uninstall(savedState);
        }
    }
}

I migrated the application to Visual Studio 2022/.Net 4.8 to utilize the Oracle Managed Access Driver. The migrated version uses the “Microsoft Visual Studio Installer Projects 2022” extension to create the latest installation package (.msi and setup.exe files). A similar “Custom Action” exists in the new Setup Project. The old version, when launched, detects the availability of the new migrated version and starts the Windows Installer. The Installer throws the following error.

Error 1001. Error 1001. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. --> Attempted to perform an unauthorized operation.

After clicking “OK,” the Installer states the following.

Installation Incomplete The Installer was interrupted before APP could be installed. You need to restart the Installer to try again. Click ‘Close’ to exit.

The migrated version of the application is not successfully installed and will not execute.

Event Log.

Installation success or error status: 1603.

Event Log

I suspect the error involves the “Uninstall” Custom Action of the old Visual Studio 2008/.Net 3.5 Setup Project attempting to delete the Event Log source/log and not having sufficient privileges to perform the action.

Can any actions be performed in the new migrated Visual Studio 2022/.Net 4.8 Setup Project to successfully uninstall the old Visual Studio 2008/.Net 3.5 Windows Form application and install the new migrated version? I removed any “Custom Actions” in the “Microsoft Visual Studio Installer Projects 2022” setup project and still received the “Error 1001” when installing the newly migrated version.

The old Visual Studio 2008/.Net 3.5 Windows Form application exists on many users’ laptops. The users do not have administrator privileges when they launch the application, and it tries to install the newly migrated version. We want all users to get upgraded to the new version as soon as they execute the old application version again.

Upvotes: 0

Views: 949

Answers (1)

Wenbin Geng
Wenbin Geng

Reputation: 3696

Your guess is correct. Usually, error 1001 will occur when the user has insufficient permissions to uninstall the program. This is because the program was not uninstalled cleanly. In addition to the remnants of the event log, there may also be remnants of the registry. If you continue to install at this time, the installation may fail. Microsoft's official explanation of Error1603 also verifies your guess.

Error 1603 when you try to install a Windows Installer package: A fatal error occurred during installation

Usually, to uninstall the software that shows 1001, we can take the following steps (it may not be effective if the user has insufficient permissions):

  1. Find the program you want to delete on the desktop, right-click and select Properties/Find Target. The path to the program will be on the page that opens. If there is no icon on the desktop, you can try searching for it. In addition, the software is generally stored in C:\Program by default. Search in Files and delete the entire program software folder. If the system refuses, please boot the computer and press F8 to enter safe mode and delete the entire software folder (or download the Unlocker small software to delete it). Then, start/run, enter regedit and press Enter to open the Registry Editor, select Edit/Search, find the English name of the software you uninstalled, find the key value of the software and delete it (search it multiple times and delete it repeatedly).

  2. Add or delete the program in the registry. Run, enter regedit and press Enter. Open the registry and locate the [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\windows\CurrentVersion\Uninstall] subkey. Under this subkey, delete the corresponding software icon. and key values, just restart your computer.

However, if you want to completely solve this issue, my suggestion is to use Microsoft's official ClickOnce. ClickOnce is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction.

ClickOnce deployment overcomes one of the three major issues in deployment, which is security permissions. That is, Windows Installer deployment requires administrative rights and only allows limited users to install; ClickOnce deployment enables non-administrative users to install and only grants the code access security permissions required by the application.

Upvotes: 0

Related Questions