Visual Studio 2022 Comminty - Deployment

29 views Asked by At

I am writing my first c# windows form .net app which is a utility program for some common tasks I do after I have had a imaging session.. I have it recording the targets I imaged in a sqlite database and copying files which are 2 of the most common tasks I do. I have been deploying and installing the App as I get each function working so that I can use it with my hobby. Even though I have put safe guards in my code to try and not have the db become corrupted, I still want to build a function to backup and restore the db. Currently when I deploy, I have no idea where my executable or database is deployed to.

I found this code on here which I think desplays the actual disk location.

// to get the location the assembly is executing from
//(not necessarily where the it normally resides on disk)
// in the case of the using shadow copies, for instance in NUnit tests, 
// this will be in a temp directory.
string path = System.Reflection.Assembly.GetExecutingAssembly().Location;

//To get the location the assembly normally resides on disk or the install directory
string path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;

//once you have the path you get the directory with:
var directory = System.IO.Path.GetDirectoryName(path);

Which when I used it in my app after I published and installed it I gave me the following location of where the app was actually installed. message box with app location

Yea, ok. That really doesn't help me.

The publish windows I go through are as follows: enter image description here enter image description here

If you notice in the first publish image, there is a previous button that is grayed out which I THINK is where I would have more options in the publishing and deployment. Another thing I THINK is happening is that this is a OneClick application (Not sure) and this is restricting my publishing options.

Any suggestions, help, direction would be most appreciated

0

There are 0 answers