Files
pdm/documentation/api_extracted/Using_NET_Framework_in_Applications.htm

160 lines
6.0 KiB
HTML

<html>
<head>
<title>Using .NET Framework in Stand-alone Applications</title>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name=MS-HKWD content="Stand-alone applications, .NET Framework 4.0">
<meta name=MS-HKWD content=".NET Framework 4.0, stand-alone applications">
<meta name=MS-HKWD content=".NET Framework 4.0"><meta name=MS-HKWD content="Stand-alone applications, C#">
<meta name=MS-HKWD content="Applications, stand-alone">
<meta name=MS-HKWD content="Applications">
<meta name=MS-HKWD content="Stand-alone applications">
<meta name=MS-HKWD content="Primary Interop Assemblies">
<meta name=MS-HKWD content="EPDM.Interop.epdm.dll">
<link rel="stylesheet" type="text/css" href="ApiHelp.css">
<style>
<!--
div.Section1
{page:Section1;}
.auto-style1 {
font-family: Verdana;
font-size: 8pt;
}
-->
</style>
</head>
<body>
<h1><span style="font-weight: normal; font-size: 7.5pt;">SOLIDWORKS PDM Professional API Help</span></h1>
<h1>Using .NET Framework in Stand-alone Applications</h1>
<p>If your Visual Studio project uses the <a href="GettingStarted-epdmapi.html">
primary interop assembly</a>
provided with SOLIDWORKS PDM Professional:</p>
<ul>
<li><font face="Verdana" style="font-size: 8pt">Reference <b>
EPDM.Interop.epdm.dll</b> and <b>EPDM.Interop.EPDMResultCode.dll </b>by:<br>
&nbsp;</font><ol style="font-family: Verdana; font-size: 8pt">
<li><font face="Verdana" style="font-size: 8pt">Right-clicking the
project name in the Solution Explorer.<br>
&nbsp;</font></li>
<li><font face="Verdana" style="font-size: 8pt">Selecting <b>Add
Reference.<br>
&nbsp;</b></font></li>
<li><font face="Verdana" style="font-size: 8pt">Selecting <b>Framework</b>
in the left-side panel.<br>
&nbsp;</font></li>
<li>Clicking <b>Browse</b> and navigating<font face="Verdana" style="font-size: 8pt">
to the top folder of your SOLIDWORKS PDM Professional installation.<br>
&nbsp;</font></li>
<li><font face="Verdana" style="font-size: 8pt">Locating and selecting
<b>EPDM.Interop.epdm.dll</b>.<br>
&nbsp;</font></li>
<li><font face="Verdana" style="font-size: 8pt">Clicking <b>Open</b>.<br>
&nbsp;</font></li>
<li><font face="Verdana" style="font-size: 8pt">Clicking <b>Add</b>.<br>
&nbsp;</font></li>
<li>Repeat step 4<font face="Verdana" style="font-size: 8pt">.<br>
&nbsp;</font></li>
<li>Locating and selecting <b>EPDM.Interop.EPDMResultCode.dll</b>.<br>
&nbsp;</li>
<li>Repeat steps 6 and 7.<br>
&nbsp;</li>
<li>Click <b>Close</b>.<br>&nbsp;</li>
</ol>
</li>
<li><font face="Verdana" style="font-size: 8pt">Include the following
statements in your code:<br>
&nbsp;</font><ul>
<li><font face="Verdana" style="font-size: 8pt">VB.NET: </font>
<p><font face="Verdana" style="font-size: 8pt"><b>Imports
EPDM.Interop.epdm<br>
Imports EPDM.Interop.EPDM.Interop.EPDMResultCode<br>&nbsp;</b></font></li>
<li><font face="Verdana" style="font-size: 8pt">C#: <b><br>
using
EPDM.Interop.epdm<br>
using EPDM.Interop.EPDMResultCode</b><br>&nbsp;</font></li>
</ul>
</li>
</ul>
<ul>
<li><font face="Verdana" style="font-size: 8pt">Change the version of .NET
Framework, select the platform target <strong>Any CPU</strong>, and for .NET
Frameworks 4.5 de-select <strong>Prefer 32-bit</strong>:<br>
&nbsp;</font><ul>
<li><font face="Verdana" style="font-size: 8pt">&nbsp;VB.NET: <br>
&nbsp;</font><ul>
<li><font face="Verdana" style="font-size: 8pt">In<b> Project &gt;</b> <i>your_project_name</i>
<b>Properties... &gt; Application</b>,<b> </b>set <b>Target framework</b> to <b>
.NET Framework 4.0 or later </b>(or keep your Visual Studio's default
setting)<br></font>
</li>
<li><font face="Verdana" style="font-size: 8pt">In<b> Project &gt;</b> <i>your_project_name</i>
<b>Properties... &gt; Compile &gt; Compile Options</b>:<br>
&nbsp;</font><ul>
<li><font face="Verdana" style="font-size: 8pt">Set <b>Target CPU</b> to <b>AnyCPU<br>
&nbsp;</b></font></li>
<li><font face="Verdana" style="font-size: 8pt">If the .NET Framework
version is 4.5 or later, de-select <b> Prefer 32-bit</b> <b><br>&nbsp;</b></font></li>
</ul>
</li>
</ul>
</li>
<li><font face="Verdana" style="font-size: 8pt">C#: <br>
&nbsp;</font><ul>
<li><font face="Verdana" style="font-size: 8pt">In<b> Project &gt;</b> <i>your_project_name</i>
<b>Properties... &gt; Application</b>, set <b>Target framework</b> to <b>
.NET Framework 4.0 or later </b>(or keep your Visual Studio's default
setting)<b><br>
&nbsp;</b></font></li>
<li><font face="Verdana" style="font-size: 8pt">In<b> Project &gt;</b> <i>your_project_name</i>
<b>Properties... &gt; Build</b>:<br></font>
<ul>
<li><font face="Verdana" style="font-size: 8pt">Set <b>General &gt; Platform target
</b>to<b> Any CPU<br></b></font></li>
<li><span class="auto-style1">If the .NET Framework version is 4.5 or
later, d</span><font face="Verdana" style="font-size: 8pt">e-select <b>
Prefer 32-bit<br>&nbsp;</b></font></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><font face="Verdana" style="font-size: 8pt">Prevent failures when
calling methods that pass arrays of structures by:</font><blockquote>
<ol>
<li class=kadov-p>Opening the project in Visual Studio.<br>
&nbsp;</li>
<li class=kadov-p>Right-clicking <b>References &gt; EPDM.Interop.epdm</b>
in the Solution Explorer
and selecting <b>Properties</b>.<br>
&nbsp;</li>
<li class=kadov-p>Setting<b> Embed Interop Types</b> to <b>False</b> in
Properties.<br>
&nbsp;</li>
<li class=kadov-p>Right-clicking <b>References &gt; EPDM.Interop.EPDMResultCode</b>
in the Solution Explorer
and selecting <b>Properties</b>.<br>
&nbsp;</li>
<li class=kadov-p>Setting<b> Embed Interop Types</b> to <b>False</b> in
Properties.<br>
&nbsp;</li>
<li class=kadov-p>Initializing arrays of structures in your code to:<br>
&nbsp;<ul type="square">
<li>VB.NET: <b>Nothing</b> <br>
&nbsp;</li>
<li>C#: <b>null</b> </li>
</ul>
</li>
</ol>
</blockquote></li>
</ul>
<h4>See Also</h4>
<p><a href="Using_NET_Framework_in_Addins.htm">Using .NET Framework in Add-in
Applications</a></p>
</body>
</html>