mauede
Well-known member
Dear C# Experts,
First off, please forgive me to ask basic, maybe silly questions. I am a C# beginner.
I developed a C# script (attached) that gets access to a Postgres database, the Velocity database, ConsoleX (available from GitHub), and some fuzzy string search algorithms.
Therefore my code makes references to Npgsqp, Velocity API, ConsoleXUI, and DuoVia.FuzzyStrings.
Please, be aware I cannot attach the whole "solution" folder as it is too big for the server to accept it even if compressed. I have attached all the .cs files of this project.
Visual Studio 2022 allows me to insert all the references I need. In fact, my code works locally (on the PC where I developed it) with and without the debugger (attached is a picture of the References).
My goal is to deploy an executable stored on a shared drive from which my colleagues can download it and run it.
I published my code using Visual Studio. I managed to avoid signing the application and generating a certificate or a manifest.
I just wanted to make things easy for me and my colleagues who are eager to use it.
From Visual Studio top menu bar I selected:
Project --> Test1 Properties -> Publish -> Publish Now.
The publication process was successful. The .exe file was placed on a shared drive.
When I run the executable from the shared drive the program dies on a system call:
"Path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;"
Such a call is supposed to inform the application about which configuration file to use to connect to the Postgres database.
I stuffed my code with printing statements to find out where it dies.
As an experiment, I eliminated the function that reads the configuration file and hardcoded the string to connect to Postgres.
It did not solve the problem. The executable dies upon attempting to access Postgres.
I called the department IT gentleman who has experience with code development. He singled out my problem.
He said I have to generate a self-contained executable. Basically, what MathLab calls a "Run-Time Environment". Something
like a "container" that contains the .exe file and also all its references.
I have no idea how to do that through Visual Studio. The IT gentleman has no idea either.
If I were working on a Linux or Unix platform I would edit the makefile. Unluckily, my knowledge of Windows at the system level is close to zero.
I would greatly appreciate some help to move on from this impasse.
Thank you in advance for your attention.
First off, please forgive me to ask basic, maybe silly questions. I am a C# beginner.
I developed a C# script (attached) that gets access to a Postgres database, the Velocity database, ConsoleX (available from GitHub), and some fuzzy string search algorithms.
Therefore my code makes references to Npgsqp, Velocity API, ConsoleXUI, and DuoVia.FuzzyStrings.
Please, be aware I cannot attach the whole "solution" folder as it is too big for the server to accept it even if compressed. I have attached all the .cs files of this project.
Visual Studio 2022 allows me to insert all the references I need. In fact, my code works locally (on the PC where I developed it) with and without the debugger (attached is a picture of the References).
My goal is to deploy an executable stored on a shared drive from which my colleagues can download it and run it.
I published my code using Visual Studio. I managed to avoid signing the application and generating a certificate or a manifest.
I just wanted to make things easy for me and my colleagues who are eager to use it.
From Visual Studio top menu bar I selected:
Project --> Test1 Properties -> Publish -> Publish Now.
The publication process was successful. The .exe file was placed on a shared drive.
When I run the executable from the shared drive the program dies on a system call:
"Path = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;"
Such a call is supposed to inform the application about which configuration file to use to connect to the Postgres database.
I stuffed my code with printing statements to find out where it dies.
As an experiment, I eliminated the function that reads the configuration file and hardcoded the string to connect to Postgres.
It did not solve the problem. The executable dies upon attempting to access Postgres.
I called the department IT gentleman who has experience with code development. He singled out my problem.
He said I have to generate a self-contained executable. Basically, what MathLab calls a "Run-Time Environment". Something
like a "container" that contains the .exe file and also all its references.
I have no idea how to do that through Visual Studio. The IT gentleman has no idea either.
If I were working on a Linux or Unix platform I would edit the makefile. Unluckily, my knowledge of Windows at the system level is close to zero.
I would greatly appreciate some help to move on from this impasse.
Thank you in advance for your attention.