How to get the latest code to be executed of console application - c#

Actually i have a window service which calls a console application every 5 seconds, for this i have created a folder in D drive and the release files of console application are copy/pasted there but whenever i make any changes in code and copy/paste the latest dlls from the bin/release folder latest code is not getting executed.

I guess you have installed (knowingly or indirectly via VS) the assemblies in the GAC (Global assembly cache). The GAC has priority over local files.
See here for more information.

Related

Confusion with emgu.cv x86 folder

I developed an c# application using emgucv for face detection. According to emgucv documents folder "x86" or "x64" (depending on platform for which application is running) are need to be kept parallel to executing exe. So i did accordingly and run the project, application works just fine on my machine.
If I release this c# application along with all the dependent dlls and "x86" folder and copied to an windows 7 machine, after executing the application i get error Unable to load DLL 'cvextern' : The specified module could not be found. (Exception from HRESULT: 0x8007007E)
This is what i tried to solve the error:
I copied all the DLLs from folder "x86" to executing folder (i.e outside to x86 folder) and now application runs without any error.
So I am in confusion whether to keep x86 folder in executing folder or content of x86 folder. As per my observation both are working but what is recommended?
Normally the cvextern.dll file is located in the following folder:
project_folder\bin\x86\Debug\x86
project_folder\bin\x86\Debug\x64
The same goes for the x64 version:
project_folder\bin\x64\Debug\x64
project_folder\bin\x64\Debug\x64
The folder can also contain other files, e.g. opencv_ffmpeg310.dll. The Emgu.CV.World.dll and similar DLLs are located in the Debug/Release folder (one folder up).
Not sure which version of EmguCV you are using, I am using 3.2 so everything is built for x64. When I distribute my application, I create a x64 folder in the folder where the exe lives. In this x64 folder I put ALL of the DLLs from the EmguCV distribution. On my machine EmguCV lives in:
D:\Emgu\emgucv-windesktop_x64-cuda-tbb-ipp-icc 3.2.0.2682
So from the bin\x64 folder I copy everything to where the application exe is.
Doug

c# .NET application crashes on startup on 1 of 3 machines with System.IO.FileNotFoundException

I am writing an application in C# with Visual Studio 2010 and am close to the end with engineering of my application. For testing i use 3 different machines:
Machine A: Workstation-PC (Intel CPU, Win 7 64Bit, .NET 4.0)
Machine B: Private PC (Intel CPU, Win7 64Bit, .NET 4.0)
Machine C: Labor-PC (AMD64, Win7 64Bit, .NET 4.0)
I want a standalone .exe file for the final version. The application works like a charm on Machines A and B no matter if i run the application in the solution folder or copy it to any directory and run it there. It works always (as it should). But Machine C throws an error, directly on application startup and outputs a "...WERInternalMetadata.xml"-file which says "System.IO.FileNotFoundException":
CLR20r3
myapp.exe
1.0.0.0
53318d78
Testreporter
1.0.0.0
53318d78
5d
f
System.IO.FileNotFoundException
But when I start the application in the solution folder(e.g. ...myapp\bin\x64\Debug), where the *.dll files are contained, the application works perfectly without any problems.
Does this mean, that the program searches for its dependecies in the root directory?
I've already checked the references in code. Furthermore if there were any problems with references, the app would not run on Machine B...
I find it curious that Machines A and B run the program without issues no matter where i place the .exe but Machine C only runs my app properly when placed in specific path....
Maybe the processor plays a role there? Any ideas on how to solve this?
BTW:
How can i build a .exe-file that already contains all dependencies and libraries my application needs. A standalone-exe so to say...
Thank you very much
It looks like the EXE is able to find the necessary DLLs in GAC on machines A and B, but is failing to do so in Machine C. Hence, only the particular path is working.
Please check the GAC.
Also, to embed DLLs into EXEs, refer to this SO thread: Embedding DLLs in a compiled executable
I've found a thread with similar topic, leading me to the solution:
System.IO.FileNotFoundException. Where do I find what path is wrong?
I am using Power Packs, too. When i removed the "Microsoft.VisualBasic.PowerPacks.Vs.dll" from the solution directory and started the application, my program failed with the descripted error. Copying back, then starting the application again was successful. So I guess my the target machine (machine C) needs a Power Pack Installation.
So I guess I can solve this problem in 4 ways?:
1.) Leaving the "Microsoft.VisualBasic.PowerPacks.Vs.dll" with the .exe in same folder and then start my application.
2.) Installing the PowerPack http://go.microsoft.com/fwlink/?LinkID=145727&clcid=0x804
3.) Installing the PowerPack.dll manually to the GAC. Or getting them to the GAC with the corresponding tools as described here http://msdn.microsoft.com/en-us/library/yf1d93sz%28v=vs.110%29.aspx
4.) Embed the .dll right into the .exe
Am I right?
Thank you very much for your help!
I had this problem also, with similar entries in Windows->Application logs, including FileNotFoundException. Very disappointed that every app log clue was just a rabbit hole (lack of specific info on WHAT file).
I eventually discovered the error of my wicked ways via Procmon.exe, and scanning through every line marked "NOT FOUND" in the Result column. There was a companion DLL generated as part of the project that I'd forgotten to copy over to the target machine.
If Procmon.exe ever disappears I'll be dead. It has helped to resolve probably 90% of subtle issues encountered since I began using VisualStudio in 1998.
Gave myself a "BoneHead of The Day" award...

How to setup System.Data.SQLite.dll

Have I an application using sqlite...
Ive tried this:
installing via ClickOnce Application setup (it works)
I Put SQLite.dll file together with .exe in the same folder. (it works}
hmm the folder with an .exe only (not working)
What I mean is when you build the project and get the .exe on the folder \bin\Debug and move it somewhere then when you run the app errors will not occurs.
I wondering if there's a way that i can run even without installing ClickOnce Application setup?
I thinking of setup the SQLite.dll on specific path reference? Is it possible to do that?
-thanks
System.Data.SQLite.dll is not part of the standard .NET Framework so it does not get installed in the GAC of the client machines when .NET runtime is installed at first.
that's the reason why you should have this dll referenced by your executable, distributed together and in the same folder as your exe is deployed.
or you could distribute it somewhere else like in a sub-folder of your application setup and have proper entries in the configuration file or in the .NET C# code to specify where assemblies not found in the standard locations have to be loaded from.
You can use Nuget to get the package installed. For my case, it automatically created 2 subfolders for me, which is x86 and x64, I just followed the folder structure in the bin folder, and it worked fine for my case.

How to make project version independent?

I am creating a console application. It uses third party .DLL. My PC has latest version (say 2.3.0.0). When I run this application on other PCs (by copying the .exe file), I get FileNotFound exception that it can not find the .dll with version 2.3.0.0. The other PC had version of 2.1.0.0 which will suffice based on
How do I tell , to not look for the specific version at run time ?
I know for compile time you can avoid this by setting "Specific Version" to false. But how about run time?

WPF application for Client Execution

I have created a simple inventory application in WPF. How should I give it to client now ?
One way what I did: I have set my AppPresentation solution as start up project and I can see all the DLLs from other solutions are added in the Debug and Release directory of this solution.
When I copy the Release folder to other drive (from D: to C:) and run the AppPresentation.exe some Error occurs about some DLL missing but I can still see those DLLs in this folder.
However when I copy the debug folder to the other drive and run the application i.e. AppPresentation.exe now I can run the application successfully with complete working.
Can I give this entire Debug folder to the client and expect that it runs perfectly on his machine ? I will ensure .NET 4.0 Framework is installed on that machine (but not Visual Studio ofcourse). Will this work ?
It will work as long as you have the required version of the .NET Framework installed on the client and all the necessary dll's have been included,
Ideally you should look at creating a Visual Studio setup project:
Using a setup project has the following advantages:
All your dll's and other files required for the application to run will be consolidated in one setup file
You can specify prerequsites such as .NET Framework which will prevent installation until all the required components have been installed first.
Users can specify exactly where on disk the application should be installed without manually copying the dlls (as would be the case in your scenario).
This is but a few advantages of using a setup project but hopefully you'll be convinced to give it a try as it is the preferred way of installing Windows applications
P.S If your setup project gets more complex consider looking at Wix

Categories

Resources