Rymn
Rymn

Reputation: 186

App launches manually but not automatically after instilation

I'm writing a program in Visual Studio 2015. When I build and install using setup wizard then find the installed application and double click on it I get no issues. The app opens and is fully functional.

Lately I've tried adding a "auto launch after setup" to my app using this: This solution. It builds successfully and installs but doesn't run. Instead I get this error in the event viewer:

Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.DirectoryNotFoundException
   at System.IO.__Error.WinIOError(Int32, System.String)
   at System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean, Boolean, Boolean)
   at System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)
   at System.Drawing.Icon..ctor(System.String, Int32, Int32)
   at System.Drawing.Icon..ctor(System.String)
   at myApp.Form1.buildIconArray(System.String)
   at myApp.Form1..ctor()
   at myApp.Program.Main()

Here is buildIconArray

public void buildIconArray(string name)
        {
            for (int i = 0; i <= 100; i++)
            {
                iconArray[i] = new Icon("icons/" + name + "/" + i + ".ico");
            }
        }

iconArray is defined way above:

Icon[] iconArray = new Icon[101];

Like I said, even doing the installation with this modification script I am able to open and operate the program normally and without error.

It kind of seems like the problem might be with systemio? When I remove this function the application does no error but it also does not build any icons.. :/

I am not using OneClick installer, couldn't figure out how to get it to work in VS2015. I'd be willing to try it if someone can point me in the right direction. I"m using this: Microsoft Visual Studio 2015 Installer Projects

Upvotes: 1

Views: 91

Answers (1)

Rymn
Rymn

Reputation: 186

Thanks to Brendan Green in the comments from the OP.

The problem was the application was the installation. The application ran from the installer directory and not the installation directory.

Upvotes: 1

Related Questions