<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/2033/1/7/_/styles/combined.css?spaceKey=TOP&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/TOP/Building+.NET+Components+for+Asterisk+SCF">Building .NET Components for Asterisk SCF</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://wiki.asterisk.org/wiki/display/~kpfleming">Kevin P. Fleming</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        proper capitalization of .NET<br />
    </div>
        <br/>
                         <h4>Changes (11)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h2. Overview <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >This page describes how to build the Asterisk SCF slice-defined Application Programming Interface (API) for components written in <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">.Net</span> <span class="diff-added-words"style="background-color: #dfd;">.NET</span> languages. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{info}  <br>All core Asterisk SCF components are currently written in C++. Building the API for .Net is only required if you wish to build your own Asterisk SCF components using .Net languages.  <br></td></tr>
            <tr><td class="diff-unchanged" >{info} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">All core Asterisk SCF components are currently written in C++. Building the API for .Net is only required if you wish to build your own Asterisk SCF components using .NET languages. <br>{info} <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. Software Requirements <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;"> <br></td></tr>
            <tr><td class="diff-changed-lines" >* <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">.Net</span> <span class="diff-added-words"style="background-color: #dfd;">.NET</span> framework 3.5 <br></td></tr>
            <tr><td class="diff-unchanged" >* Ice Third Party Libraries - [http://www.zeroc.com/download.html] <br>* Visual Studio 2008 (or greater) [http://www.microsoft.com/visualstudio/en-us/] <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>h4. Build Ice <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Asterisk SCF currently requires a custom version of Ice, so if you haven&#39;t done so, you must build Ice from the source found in the Asterisk SCF Ice repo. In particular, to build a .Net component for Asterisk SCF, you must build the cpp and cs sub-folders in the Ice build tree. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Taking into account that the Ice build system places generated object code next to the source (for both debug and release builds), we recommend that, on Windows at least, you clone the Ice repo into two different locations, one for release and one for debug. You will want a release build of the cpp folder so that you get a release version of the slice2cs utility, and you will probably want a debug build of both the cpp and cs folders. Follow the INSTALL.WINDOWS instructions in those folders to build.  <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Asterisk SCF currently requires a custom version of Ice, so if you haven&#39;t done so, you must build Ice from the source found in the Asterisk SCF Ice repo. In particular, to build a .NET component for Asterisk SCF, you must build the cpp and cs sub-folders in the Ice build tree. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Taking into account that the Ice build system places generated object code next to the source (for both debug and release builds), we recommend that, on Windows at least, you clone the Ice repo into two different locations, one for release and one for debug. You will want a release build of the cpp folder so that you get a release version of the slice2cs utility, and you will probably want a debug build of both the cpp and cs folders. Follow the INSTALL.WINDOWS instructions in those folders to build. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >If you follow our advice and have separate release and debug copies of the Ice repo, in your release Ice source tree make sure you configure it for Release as follows: <br>{noformat} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h4. Build <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >Check the References node to make sure the Ice assembly is located. It is assumed to be in the default custom-build location, which is C:\Ice-3.4.1\bin. If you configured <span class="diff-added-words"style="background-color: #dfd;">the</span> Ice build process to install in some other location, update the Ice reference. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Select *Build &gt; Build Solution* to compile the project and create an AsteriskSCFDotNetApi.dll <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h4. Use it <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >Add a reference to AsteriskSCFDotNetApi.dll to your <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">.Net components</span> <span class="diff-added-words"style="background-color: #dfd;">.NET component&#39;s</span> solution. You will also need to add a reference to Ice. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Building.NETComponentsforAsteriskSCF-Overview"></a>Overview</h2>

<p>This page describes how to build the Asterisk SCF slice-defined Application Programming Interface (API) for components written in .NET languages.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>All core Asterisk SCF components are currently written in C++. Building the API for .Net is only required if you wish to build your own Asterisk SCF components using .NET languages.</td></tr></table></div>

<h2><a name="Building.NETComponentsforAsteriskSCF-SoftwareRequirements"></a>Software Requirements</h2>

<ul>
        <li>.NET framework 3.5</li>
        <li>Ice Third Party Libraries - <a href="http://www.zeroc.com/download.html" class="external-link" rel="nofollow">http://www.zeroc.com/download.html</a></li>
        <li>Visual Studio 2008 (or greater) <a href="http://www.microsoft.com/visualstudio/en-us/" class="external-link" rel="nofollow">http://www.microsoft.com/visualstudio/en-us/</a></li>
        <li>Ice plugin for Visual Studio. <a href="http://www.zeroc.com/vsplugin.html" class="external-link" rel="nofollow">http://www.zeroc.com/vsplugin.html</a></li>
</ul>


<h2><a name="Building.NETComponentsforAsteriskSCF-Installation%2FBuildNotes"></a>Installation/Build Notes</h2>


<h4><a name="Building.NETComponentsforAsteriskSCF-BuildIce"></a>Build Ice</h4>

<p>Asterisk SCF currently requires a custom version of Ice, so if you haven't done so, you must build Ice from the source found in the Asterisk SCF Ice repo. In particular, to build a .NET component for Asterisk SCF, you must build the cpp and cs sub-folders in the Ice build tree.</p>

<p>Taking into account that the Ice build system places generated object code next to the source (for both debug and release builds), we recommend that, on Windows at least, you clone the Ice repo into two different locations, one for release and one for debug. You will want a release build of the cpp folder so that you get a release version of the slice2cs utility, and you will probably want a debug build of both the cpp and cs folders. Follow the INSTALL.WINDOWS instructions in those folders to build.</p>

<p>If you follow our advice and have separate release and debug copies of the Ice repo, in your release Ice source tree make sure you configure it for Release as follows:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>1. Edit the cpp\config\Make.rules.mak
2. Uncomment the line: OPTIMIZE = yes
3. Build as usual, using: nmake /f Makefile.mak install
</pre>
</div></div>

<p>A similar change is required in the cs folder.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>A common problem encountered with the VS 2008 command prompt is that the C# compiler may not be in your path. If you have installed numerous SDKs (as many developers do), the FrameworkDir variable may be set to a useless value. This will cause you to get the error message: "csc was not a recognized command." To correct this, edit your vcvars32.bat file in a similar manner to this:

<p><b>OLD:</b><br/>
@SET FrameworkDir=Framework32<br/>
@SET FrameworkVersion=v2.0.50727</p>

<p><b>NEW:</b><br/>
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework<br/>
@SET FrameworkVersion=v2.0.50727<br/>
@SET Framework35Version=v3.5</p></td></tr></table></div>

<h4><a name="Building.NETComponentsforAsteriskSCF-InstalltheIce3.4VisualStudioPlugin"></a>Install the Ice 3.4 Visual Studio Plugin</h4>

<p>The Visual Studio Plugin will not install unless the MSI downloaded from ZeroC detects that Ice 3.4.1 has been installed on your system. However, it will fail to detect this because we are using a locally built version of Ice. To get around this problem, you should set the InstallDir key for the Ice software to the location where your build process is installing Ice, which is typically at C:\Ice-3.4.1\</p>

<p>To set the InstallDir key:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>1. Run regedit
2. Make sure the key: HKEY_LOCAL_MACHNINE\SOFTWARE\ZeroC\Ice 3.4.1\ exits. If not, create it.
3. Add the string value: InstallDir = C:\Ice-3.4.1\
</pre>
</div></div>

<p>Once you get the Ice plugin installed, open the Visual Studio solution installed in the /slice folder. If the plugin installed correctly, you should see the new menu option <b>Tools &gt; Ice Configuration...</b></p>

<h4><a name="Building.NETComponentsforAsteriskSCF-Build"></a>Build</h4>

<p>Check the References node to make sure the Ice assembly is located. It is assumed to be in the default custom-build location, which is C:\Ice-3.4.1\bin. If you configured the Ice build process to install in some other location, update the Ice reference.</p>

<p>Select <b>Build &gt; Build Solution</b> to compile the project and create an AsteriskSCFDotNetApi.dll</p>

<h4><a name="Building.NETComponentsforAsteriskSCF-Useit"></a>Use it</h4>

<p>Add a reference to AsteriskSCFDotNetApi.dll to your .NET component's solution. You will also need to add a reference to Ice. </p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://wiki.asterisk.org/wiki/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://wiki.asterisk.org/wiki/display/TOP/Building+.NET+Components+for+Asterisk+SCF">View Online</a>
        |
        <a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=8127046&revisedVersion=11&originalVersion=10">View Changes</a>
                |
        <a href="https://wiki.asterisk.org/wiki/display/TOP/Building+.NET+Components+for+Asterisk+SCF?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>