After converting my project from matlab to .net. I get three folders. How can i use these files in visual studio to develop asp.net visualc# web form application. Kindly provide the information.
MATLAB: Regarding matlab to asp.net c#
asp.net c#MATLAB Compiler SDKvisual studioweb application
Related Solutions
To run your .NET application on the deployment machine without MATLAB installed you will need to copy the following files onto the deployment machine
a. Application.exe (compiled executable generated from Microsoft Visual Studio .NET)
b. Component_name.dll (generated by the MATLAB .NET builder)
c. Component_name.ctf (generated by the MATLAB .NET builder)
d. MWArray.dll (MathWorks Assembly located in
$MATLABROOT\bin\win32
In the recent releases of MATLAB it is located in:
$MATLABROOT\toolbox\dotnetbuilder\bin\win32\v2.0
Also, please note that MWArray.dll is available in MATLAB Compiler Runtime. You can find it in the same path as above, but you have to replace MATLABROOT by the MCR installation directory.
e. MCRInstaller.exe (MATLAB Component Runtime located in $MATLABROOT\toolbox\compiler\deploy)
$MATLABROOT can be found by issuing the following command:
matlabroot
in the MATLAB Command Prompt.
Perform the following steps:
1. Run the MCRInstaller.exe on the deployment machine in order to install the MCR.
2. Install the supported compiler by referencing the page below:
3. You need to install .net framework on the target machine, this does not come with 'gacutil.exe'; but development environment comes with 'gacutil.exe'. After that you follow the steps below in the system command prompt:
gacutil.exe /i MWArray.dllgacutil.exe /i component_name.dll
Please note that recent versions of MATLAB are shipped along with 'gacInstaller.exe'. If your MATLAB version does not have gacInstaller, then you should have Microsoft Visual Studio development environment along with .net framework.
Note that Microsoft says "Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache." For more information please see the following website:
The 'incorrect format' error usually means that some 64-bit process is trying to call a 32-bit process, or vice versa.
Unlike normal programs, web applications run on a host server. The 'incorrect format' error can be given if the host server architecture does not match the web application (or any of its dependencies) architecture. In this case, the default Microsoft Visual Studio web development server is available only in 32-bit. In order to develop 64-bit web applications, another server must be used.
A good server is Microsoft's Internet Information Services (IIS) server, available on all Windows systems. IIS is usually disabled by default. Follow the steps below to activate it and configure it in the Microsoft Visual Studio environment (instructions based on Windows 7):
1. To enable IIS, go to Start > Control Panel > Programs and Features > Turn Windows Features On or Off. This will start the Windows Features manager window. Selections should look like below:
Hit OK. A restart may be required.
2. Open the IIS Manager by going through Start > type 'Internet Information Services' in the search field > select IIS Manager. You should see the IIS Manager window, with the system name and server tree on the left hand side.
3. Setup the appropriate application pool (group of sites or web applications that are served by one or more worker processes). Right click on Applicatoin Pools > Add Application Pool. You should see the window below.
Give a name for the pool, select the target .NET framework version, then hit OK. Pipeline mode should be classic if Web Figures are used.
4. Set the architecture of the application pool. Select the application pool > click Advanced Settings... on the right side.
'Enable 32-Bit Applications' should be 'False' to run 64-bit applications.
5. Setup your web application in the IIS Manager. Select Sites > Right click on Default Web Site > Add Application. This should open the window below:
In the 'Alias' field, enter the name of the site. Select the 64-bit application pool you just created in the 'Application pool' field. Add the physical path of the web site into the 'Physical path' field (the folder where the web application project lives). Hit OK.
6. Confirm the site settings. Select the site > click on Advanced Settings... on the right hand pane. You should see the window below.
'Virtual Path' is the URL of the site relative to the host. In this case, it would be:
"http://localhost/WebApplication3"
7. Configure Visual Studio to use the IIS server. In Visual Studio, open the project properties > Web > Servers > select 'Use Local IIS Web server'.
In the 'Project Url' field, enter the virtual path of the web site previously set up in the IIS manager.
This should complete the process to allow Visual Studio to develop 64-bit web applications and reference 64-bit assemblies, such as MWArray from 64-bit MATLAB.
Best Answer
Here's a link to document.
document: Integrate a .NET Assembly Into a C# Application
For developing, rather than using installer in for_redistribution, it's useful to use .dll file in for_testing folder. In Visual Studio C# project, include this *.dll file (or *Native.dll if you want to use native .NET API) and MWArray.dll as references. MWArray.dll is located in each of the following.
$MATLAB_INSTALL\toolbox\dotnetbuilder\bin\win64\v4.0\MWArray.dll
or
$MATLAB_Runtime_INSTALL\toolbox\dotnetbuilder\bin\win64\v4.0\MWArray.dll
For C# sample code, please check "C# Code to Implement Application" of Step 5 in this document.