C# Use MKL library in mono - c#

I have C# Console project that develop in visual studio on Windows with .net framework 4.6. In my project use MKL and IPP library. In Windows my project run correctly. I migrate to CentOS 7 and want run my project in this OS. I have several problem that resolved. Now my project build successful and run correct until now use MKL library. In first use of MKL get System.DllNotFoundException" mkl_rt.dll error. but all MKL dll (include of mkl_rt.dll) exist beside of .exe file.

You can download MKL for linux from https://software.intel.com/en-us/mkl/choose-download
after install this .so file exist. you can find libmkl_rt.so and copy it beside your .exe file or add this to ldconfig.

One note - Libmkl_rt.so enables you to select the interface and threading library for Intel MKL at run time. By default, libmkl_tr.so is linking with intel threading run time – libiomp5. Therefore in your cases, you need to add this shared object into your system paths as well. See more details follow mkl developer user guide “Using the Single Dynamic Libraries”

Related

Creating an exe for a Windows standalone application using C# in Visual Studio 2015

I have created Sales Management System using C# and MS SQL Server 2012. This is working fine. All I want to know in how can I create an exe so that this can be installed in another machine without any .NET Framework.
e.g. it should say like SalesManagementSystem.exe, and I should be able to install it in any machine.
Just download the Setup project templates and create an installer:
https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.MicrosoftVisualStudio2015InstallerProjects
See my extensive guide here on how to make an Installer (one that upgrades itself as well):
Install to same path when upgrading application
A .Net application will never run without the corresponding framework installed. But depending on the target OS the framework is already installed. Please check the release history at wikipeda. There you can see which .Net version is already installed in which windows version.
If you want to deploy a single executable you have to embed all your depending assemblies into your executable as a resource (plenty of questions and answers are already at SO) and load them by overwriting the AssemblyResolve event.
If you want to create a windows installer take a look at WiX.
You cannot just skip the .NET Framework on the target machine - it is needed to run your program. The exe file, produced by the C# compiler contains MSIL, which is understood by .NET Framework, as opposed by the destination OS - be it Windows or any other.
Having that said, your best bet is to write an installer for your app and
distribute the .NET Framework distribute the .NET Framework along with it. When launched, the installer might check what is the installed version of the .NET framework on the target machine (if any) and respond appropriately by installing whatever it is needed for your application.
You can use WiX to author an installers.

MonoMac Could Not Load Assembly or Dependency

I have a fairly simple application that I built using MonoDevelop 3.0/XCode 4.0/.NET 4.0 on OS X 10.7 (Lion). Basically, I have a Windows GUI and a Mac GUI for the application, and both share a class library. The class library is very simple (deliberately), and passes the MoMA tests with flying colors. My OS X GUI runs perfectly on my development OS X machine, but when I create a .pkg file and install it on a test OS X machine, it won't run at all. I have the Mono runtime installed on the test machine -- the runtime only, not the SDK or MonoDevelop. The application will open, but as soon as I make a call into the shared library, it fails with
System.IO.FileNotFoundException: Could not load file or assembly 'xxx' or one of its dependencies.
My shared library only has the following dependencies:
System
System.Configuration
System.Core
System.Xml.Linq
System.Data.DataSetExtensions
Microsoft.CSharp
System.Data
System.Xml
Surely the basic Mono framework supports all of these assemblies, right? What am I missing? I can't believe that releasing a simple application like this (via .pkg file, not AppStore) is so difficult! Could someone please point me in the right direction? Thanks.
OK, so, total noob/forehead slapping moment: the reason my application ran on my development OS X environment but not on the test box? .NET framework! I built the class library with Visual Studio 2012/.NET 4.5/Windows 7, checked it with MoMA, then copied it to my dev OS X, set a reference to it in my MonoMac project, and everything was fine, right? That's because that box had MonoDevelop and the .NET framework on it! When I created my .pkg and installed it on a new OS X box, the install was smart enough to download and install the Mono environment, but not the .NET framework, and who can blame it? The solution: build the class library against Mono 4.0, and use that assembly in my MonoMac release! Problem solved.
Thanks for help and comments. Please forgive the basic stupidity of this question: I'm not only a Mono/OS X noob, I'm a desktop development noob, too. I'm a web guy, for cryin' out loud!

Packaging a .NET Application So It Will Run On A Computer Without .NET

I have been recently trying to deploy a C# application on a computer that does not have .NET installed.
I know that there have been many questions around the same topic here on StackOverflow. Here are a few of them, of which I read the responses to all:
Packaging up the .net framework with a .net application deployment
Run a .net application without installing .net client profile?
Run C# windows application in windows XP without installing .NET Framework
So all of the responses to the above questions state that it is impossible without specific software, etc. One software mentioned was the Salamander .NET Linker. The only problem with that is that I cannot seem to be able to run the application after it has been processed by Salamender. I understand that this in itself is impossible, as it requires the .NET virtual machine to run. However, in the past, I have made Java applications and along with them, I shipped the entire JVM. Surprisingly, they still worked. So the reason why this is not a duplicate of the above questions is because my true question is:
What items of the .NET framework would I need to package? If I do manage to package all, would placing them in the same directory as the application I'm running allow the application to run?
I found one solution to this, the Microsoft .NET Redist Package. The only problem with this is that it has a GUI of its own. Aside from that, it would be a perfect fit. So, could anyone tell me one of two things:
Is there a command-line .NET package, and if so, where do I download it?
If there isn't, or it would be impractical to do so, approximately what directories would I need to copy from the .NET installations?
I understand that these files and directories are system specific, and that my .NET installation may not work on your computer, but if C# is like Java, then this should be achievable. Is it? Size is not a limitation, it does not matter to me whether or not the application and all its files is 1GB, or if it is only 1MB.
If in case there is no other solution, I used Dependency Walker to check all the dependencies of my program. If I were to package most of them, would my application, in theory, work?
For .NET, you really must just install the appropriate .NET framework. The .NET framework installation does include command line options to allow for silent installs, such as:
dotnetfx35.exe /q /norestart
For details on the command line options, see the options for 3.5 and for .NET 4.0.
That being said, most installation packages will handle these details for you as part of the installation. Using a decent installer will take care of this dependency automatically.
Depending on the pieces of the .NET Framework you need, you can use Mono. It supports shipping the runtime without installing just like you would a JVM, or you can statically link against the binaries to create a native executable .
If you are planning to deploy your application (and presuming the setup process doesn't need to be too complex), you can simply create a Setup project in Visual Studio and then bootstrap the prerequisites (.NET framework, and other stuff you think you might need).
You can follow the steps described in these MSDN articles:
How to create a Setup project in Visual Studio
How to add prerequisites to a Setup project
A walkthrough is given in this CodeProject article.
For more complex deployment scenarios (such as installing device drivers along your app, or better localization support), I would recommend looking into WiX (Windows Installer XML) toolset. It's a toolset that builds Windows installation packages, which you configure using XML files inside Visual Studio. WiX also supports various bootstrapping scenarios.
This page covers the differences between VS Setup projects, WiX, and InstallShield.

Can visual studio 2008 deployment project run without .net installed in the system?

My programming language is C# .Net 3.5 and I may have to install my applications in very old client systems (windows XP-SP1 and above) and may be that those systems do not contain any version of .Net (or even Windows-Installer-3.1) in them.
I have worked on VS-2008 deployment projects on and off since some time and I have some working knowledge of it.
I want to write a deployment project in VS-2008 but I have 2 questions :
Can a VS-2008 deployment project containing pre-requisites run on a system without any version of .Net (or even Windows-Installer-3.1) pre-installed in the system ?
How to create a boot-strapper installer to run in systems without .net pre-installed in them (boot strapper will install all pre-requisites including .net and other 3rd party run times) ?
Regards
Akshay Mishra
Can a VS-2008 deployment project containing pre-requisites run on a
system without any version of .Net (or even Windows-Installer-3.1)
pre-installed in the system ?
Yes, the EXE bootstrapper which handles prerequisites doesn't have any dependencies. So you can safely add Windows Installer and .NET Framework as prerequisites in your setup project.
How to create a boot-strapper installer to run in systems without .net
pre-installed in them (boot strapper will install all pre-requisites
including .net and other 3rd party run times) ?
Here is an article which may help: http://setupanddeployment.com/uncategorized/custom-prerequisite-visual-studio-setup-file/
You can use Salamander .net linker. I don't exactly understand what it does but what I know is that I was able to pack the necessary reference and the program into 1 folder. When I move the folder to a computer without .net framework installed, it was able to run.
The demo version of the program will give u nag screens every time u run the packed program.
The side effect of doing it this way is my program file size increased from few KB to 40MB.
Other references ..just for information:
http://www.codeproject.com/Articles/321269/Analyzing-a-Net-executable-or-DLL-without-NET-inst
http://www.codeproject.com/Questions/157853/Running-the-c-exe-without-net-framework-on-machine
You need to have .Net version installed on the client system.
Else it wont works.
Because even to start your application your application will search for CLR 2008 version.
You can do one thing. If you dont want to install .Net Framework, please develop your application in lower version of .Net framework.(May be .Net 2.0 will work without any requirement since it is XP SP1)
No, because there are not just DLLs, there is common language runtime needed to execute your program. Read the great book by Richter to better understand what happens when you create a program using .net libraries and its lifecycle.
By the way, i'm not quite sure, there must be some older version of .net installed with SP1. So may be you consider changing your application to use .NET 2?
UPDATE
May be you want to add .NET to your setup as prerequisite? You can add them without creating bootstrapper packages. See the article: http://www.codeproject.com/Articles/35976/Add-Prerequisites-of-NET-Framework-in-Visual-Studi

How to include third Party dll files in Mono 2.10?

I have developed an windows desktop Application using C# .NET 4 framwork.Now, we are going to using MONO2.10 for cross platform.For sample, I have downloaded the mono 2.10 on windows version and able to run my .net exe.While doing so, Its Working fine and it says error the below mentioned error msg. As per my understanding, I think the DLL Reference is not included properly...
i am using 2 third party dll files in application.
Ionic.dll for .net zip library
DocumentFormat.OpenXml.dll for XML file management.
Please guide me to how to include these dll reference in Mono on windows?
Thanks & Regards,
Saravanan.P
This library is not part of Microsoft .NET or Mono Framework.
Therefore, you just need to either put it in GAC or in the same folder with your application, just like you normally do with third-party components.

Categories