How do you save your console application as exe program?
I have found the exe file within the Debug folder, but returns an error when executed.
Error message –
Could not load file or assembly 'Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c' or one of its dependencies. The system cannot find the file specified.
I’m using the Ionic library, I think I need to package the whole program, not sure how to do this?
Right click on the your project on the solution explorer
On configuration choose release
Now you will find a release folder next
to the debug folder use the .exe inside it
Related
I'm building a DLL as part of a plugin for software called Navisworks. When I try to build the DLL I get this error:
Error Cannot register assembly "C:\Program Files\Autodesk\Navisworks Manage 2021\Plugins\Zoney2021\Zoney2021.dll". Could not load file or assembly 'Autodesk.Navisworks.Api, Version=18.0.1347.51, Culture=neutral, PublicKeyToken=d85e58fa5af9b484' or one of its dependencies. The system cannot find the file specified
I've researched this error plenty and found no obvious solution to it. The referenced assembly is in the right directory and has "copy local" and "specific version" set to false. I've used dependency walker and there are no subdependencies. If I manually delete the Zoney2021.dll the program will run and load the build DLL properly. This shouldn't be a permissions issue since I always run Visual Studio as admin. If there's no easy solution, can I have a script that autodeletes the DLL on each build?
Thanks
If you want to delete the file automatically before each build, open your startup project's properties and go to the Build Events tab. There, you can enter a command to delete it.
Something like:
cd "C:\Program Files\Autodesk\Navisworks Manage 2021\Plugins\Zoney2021\"
del Zoney2021.dll
I have a 32 bit application that uses a DLL built by someone else, lets call it xyz.dll. This DLL has dependencies on few other old DLLs. All dlls are saved in the same folder where my app is located. My app compiles fine but in run time, it throws an error "Could not load file or assembly "xyz.dll" or one of its dependencies. is not a valid Win32 application"
I have 2 workarounds that seems to solve this problem. In first one I moved the DLLs to a separated folder and created a batch file to run the app. The batch file first add the dlls' path to the environment, then call the app. Interestingly if I leave the dlls in the same folder with the app and just add this to the path, it wouldn't work.
The second way also moved dlls to a folder and add this path to user environment variable and run the exe directly. Either one of these solutions requires extra steps which is not ideal for app deployment. I am wondering if there is a better way?
When your dll is in the same folder as the application, it is that dll that the application attempts to load, and this fails, as you said.
When you move the dll to another folder and add the pathname of that folder to the PATH environment variable, the application works. In this case, the application is not attempting to load the dll that you have moved to another folder. If this were the case, it would fail. It must be loading another version of the dll that is in one of the folder paths that are in your PATH environment variable.
Simply use Windows search to find all copies of your dll file on your computer. You will be able to determine where that other dll is.
Hi guys a project I'm working on has an app config file which determines what other dll's to load at runtime. I have been tasked with adding the functionality of taking the dll from our servers and then changing the app conifg to have the exe now load up with that file. The idea is the user at runtime will choose a file and then the app config will change and then restart the exe with the new dll loaded.
I couldnt seem to find exactly what I was looking for. We are using Visual Studio 2012 with .net 4.
How do you edit the app config file at runtime and then have the program close and rerun?
This might help with adding an exe file to your app.config file: http://msdn.microsoft.com/en-us/library/ms184658.aspx OR Add an EXE file to a project, so that it will be copied to the Bin/Debug folder just like a DLL?
As for closing and reopening the file: How do I restart my C# WinForm Application?
Should help in pointing you in the right direction anyway.
I am working with developing Windows Service using C#. I want to load CLIPSLIB.dll with Windows Service. First I tried write service as console app in vs2010 placing CLIPSLIB.dll in the project debug folder. It worked fine.
But when I install it and run as Windows Service it throws this exception.
Could not load file or assembly 'Mommosoft.ExpertSystem, Version=0.3.0.2, Culture=neutral, PublicKeyToken=20382083c6694bdc' or one of its dependencies. The system cannot find the file specified.
As I figured out this is happening because Windows Service is unable to load relevant dlls. So whare should I put external dlls to load with Windows Service?
Scott Hanselman has an article that describes how to debug assembly loading errors. the downside to this method is that it requires a registry key change and a reboot in order to emable the fusion loader logging.
That article can be found here:
http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx
since you are writing a windows service check that the reference for the assembly refers to the bin directory and not some other path. Otherwise the fusion loader logs will identify where it is trying to load the assembly from.
as to the .dll files add a folder to your project and add the .dll files there, change the build properties from do not copy to copy if newer in order that the .dll files will end up in your build output bin path.
You must rebuild the CLIPSLib solution,
Download all files in this link :
Link: https://svn.code.sf.net/p/clipsnet/code/
2.Open CLIPSLib.sln in CLIPSLib folder
3.Right-click on the solution and select rebuild solution.
4.Go to the CLIPSLib folder your CLIPSLib.dll and CLIPSNet.dll is in ..\ ..\mlplatform\bin floder.
hope this help.
I am getting the following unhandled exception when I try to create an excel document using my c# application. This process works fine when I am running the c# application from visual studio 10, but when I try to run the application outside of visual studio using the .exe file this error is appearing.
System.IO.FileNotFoundException: Could not load file or assembly 'ExcelApi, Version=1.5.1.2, Culture=neutral, PublicKeyToken=9084b9221296229e' or one of its dependencies. The system cannot find the file specified.
File name: 'ExcelApi, Version=1.5.1.2, Culture=neutral, PublicKeyToken=9084b9221296229e'
Apparently your project has an assembly called ExcelApi.dll which is missing on the target machine. I assume this is a NetOffice dll, which is required in the output directory for your project to run.
Open your project directory (depending on your VS version, you can right-click the project in Solution Explorer and choose Open Folder in Windows Explorer). Go into the \bin folder, then into the folder that matches your build configuration (most likely Debug, but it might be something else depending on how your project is set up). In that directory, copy all of the .exe, .dll, and .config files to the directory you're trying to run your program from.
In particular, you will need at a minimum your executable and config file, along with ExcelApi.dll, OfficeApi.dll, VBIDEApi.dll, and NetOffice.dll. See here for details.