152 lines
6.1 KiB
HTML
152 lines
6.1 KiB
HTML
<html>
|
||
|
||
<head>
|
||
<title>Using .NET Framework in Add-in 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="Add-ins, .NET Framework 4.0">
|
||
<meta name=MS-HKWD content=".NET Framework 4.0, add-ins">
|
||
<meta name=MS-HKWD content=".NET Framework 4.0">
|
||
<meta name=MS-HKWD content="Applications">
|
||
<meta name=MS-HKWD content="Applications, add-in">
|
||
<link rel="stylesheet" type="text/css" href="ApiHelp.css">
|
||
<style>
|
||
<!--
|
||
div.Section1
|
||
{page:Section1;}
|
||
-->
|
||
</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 Add-in Applications</h1>
|
||
<p>Many versions of .NET Framework may be installed with your Windows operating
|
||
system or Visual Studio. See
|
||
<a href="https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx">
|
||
https://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx</a>. </p>
|
||
<p>SOLIDWORKS
|
||
PDM Professional supports one or more versions of .NET Framework.</p>
|
||
<table border="1" width="99%">
|
||
<tr>
|
||
<td vAlign="bottom" width="294"><span style="font-weight: 700">
|
||
<font face="Verdana" style="font-size: 8pt">SOLIDWORKS</font></span><font style="FONT-SIZE: 8pt; FONT-WEIGHT: 700" face="Verdana">
|
||
PDM Professional versions...</font></td>
|
||
<td vAlign="bottom">
|
||
<font style="FONT-SIZE: 8pt; FONT-WEIGHT: 700" face="Verdana">Support
|
||
.NET Framework...</font></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="294"><font style="FONT-SIZE: 8pt" face="Verdana">2013 and
|
||
later</font></td>
|
||
<td><font face="Verdana" style="font-size: 8pt">4</font><font style="FONT-SIZE: 8pt" face="Verdana">.0 and later</font></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="294"><font style="FONT-SIZE: 8pt" face="Verdana">2009 - 2012</font></td>
|
||
<td><font style="FONT-SIZE: 8pt" face="Verdana">3.5, 3.0, and 2.0</font></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="294"><font style="FONT-SIZE: 8pt" face="Verdana">2008 and
|
||
earlier</font></td>
|
||
<td><font style="FONT-SIZE: 8pt" face="Verdana">2.0</font></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<p><font face="Verdana" style="font-size: 8pt">If using .NET Framework 4.0
|
||
or later, prevent failures when calling methods that pass arrays of structures by:</font></p>
|
||
<blockquote>
|
||
<ol>
|
||
<li class=kadov-p>Opening the project in Visual Studio.<br>
|
||
</li>
|
||
<li class=kadov-p>Right-clicking <b>References > EPDM.Interop.epdm</b>
|
||
in the Solution Explorer
|
||
and selecting <b>Properties</b>.<br>
|
||
</li>
|
||
<li class=kadov-p>Setting<b> Embed Interop Types</b> to <b>False</b> in
|
||
Properties.<br>
|
||
</li>
|
||
<li class=kadov-p>Right-clicking <b>References > EPDM.Interop.EPDMResultCode</b>
|
||
in the Solution Explorer
|
||
and selecting <b>Properties</b>.<br>
|
||
</li>
|
||
<li class=kadov-p>Setting<b> Embed Interop Types</b> to <b>False</b> in
|
||
Properties.<br>
|
||
</li>
|
||
<li class=kadov-p>Initializing arrays of structures in your code to:<br>
|
||
<ul type="square">
|
||
<li>VB.NET: <b>Nothing</b> <br>
|
||
</li>
|
||
<li>C#: <b>null</b></li>
|
||
</ul>
|
||
</li>
|
||
</ol>
|
||
</blockquote>
|
||
<p>If your SOLIDWORKS PDM Professional 2012 or earlier version add-in application
|
||
is compiled using Microsoft Visual Studio and a .NET Framework version
|
||
other than version 2.0, then SOLIDWORKS PDM Professional may show the following message when you
|
||
try to load the
|
||
add-in:<br><br>
|
||
“The Archive Server could not open the Windows Registry.”<br>
|
||
</p>
|
||
<ul>
|
||
<li><font face="Verdana" style="font-size: 8pt">C# or VB.NET</font><p>To
|
||
solve this problem, try changing your add-in project’s target framework to .NET
|
||
Framework 2.0:</p></li>
|
||
</ul>
|
||
<blockquote>
|
||
<ol>
|
||
<li class=kadov-p>Right-click the project in the <b>Solution Explorer</b>.</li>
|
||
<li class=kadov-p>Select <b>Properties</b>.</li>
|
||
<li class=kadov-p>Click <b>Compile > Advanced Compile Options</b>.</li>
|
||
<li class=kadov-p>Select .NET Framework 2.0.</li>
|
||
<li class=kadov-p>Click <b>OK</b>.</li>
|
||
</ol>
|
||
<p>After changing your project’s target framework to .NET Framework 2.0, you might
|
||
no longer be able to reference the SOLIDWORKS PDM Professional
|
||
<i>nnnn</i>
|
||
Type Library (<b>EdmInterface.dll</b>), because Visual Studio created the DLL using the latest version of .NET Framework,
|
||
but you just changed the
|
||
project to target an earlier version of .NET Framework (2.0). If you encounter this
|
||
problem, you can generate a compatible SOLIDWORKS PDM Professional primary interop
|
||
assembly by using the Microsoft's Type Library Importer (<b>TlbImp.exe)</b> that is
|
||
included in an earlier
|
||
version of the Microsoft .NET Framework SDK.</p>
|
||
<ol>
|
||
<li class=kadov-p>Download and install a version of .NET Framework SDK that is
|
||
compatible with your add-in project's version.</li>
|
||
<li class=kadov-p>Open a Windows Command Prompt.</li>
|
||
<li class=kadov-p>Navigate to <b>C:\Program Files\Microsoft SDKs\Windows\v</b><i>x.x</i><b>\Bin</b>
|
||
in which the earlier .NET Framework version of <b>TlbImp.exe</b> is
|
||
installed.</li>
|
||
<li class=kadov-p>Type<b> TlbImp.exe </b><i>install_dir</i><b>\EdmInterface.dll /sysarray /out:Interop.EdmLib.dll /namespace:EdmLib. </b></li>
|
||
<li class=kadov-p>Modify all add-in examples in this help file to use
|
||
the new interop ssembly.</li>
|
||
</ol>
|
||
</blockquote>
|
||
<ul>
|
||
<li><font face="Verdana" style="font-size: 8pt">C++<br>
|
||
<br>
|
||
This problem can occur at runtime if the add-in failed to register its DLL
|
||
during the build process. To solve this problem, ensure that your add-in
|
||
registers the DLL: <br>
|
||
</font><ol style="font-family: Verdana; font-size: 8pt">
|
||
<li>Open your C++ add-in project.</li>
|
||
<li>Right-click the project in the <b>Solution Explorer</b>.</li>
|
||
<li>Select <b>Properties</b>.</li>
|
||
<li>Click <b>Linker > Input</b>.</li>
|
||
<li>Configure <b>Module Definition File</b> to point to the add-in's <i>
|
||
project_name</i><b>.def</b>.</li>
|
||
<li>Save the project.</li>
|
||
<li>Click <b>Build > Clean Solution</b>.</li>
|
||
<li>Click <b>Build > Build Solution</b>.</li>
|
||
</ol>
|
||
</li>
|
||
</ul>
|
||
<h4>See Also</h4>
|
||
<p><a href="Using_NET_Framework_in_Applications.htm">Using .NET Framework in
|
||
Stand-alone Applications</a></p>
|
||
|
||
</body>
|
||
|
||
</html>
|