2014
Visual
Studio Setup
Visual Studio Set up Documentvin Jaipuriyar
Visual Studio Setup
1Purpose:
Purpose of this document is to define the process to setup build and debug custom DLL using VisualStudio.
2Assumption:
It is assumed that correct version of Microsoft Visual studio is installed. Microsoft Visual Studio is installed
tosupport 64 bit code generation.
3 Steps:
3.1 Create Properties file
Copy and paste following information is Text Editor. Make sure there no “line breaks” in the contents
forfollowing TAGS:
x AdditionalIncludeDirectories
x PreprocessorDefinitions
x AdditionalDependencies
x DelayLoadDLLs
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0"
xmlns="[Link]
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<_PropertySheetDisplayName>CHANGE_ME</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>TC_ROOT\include;TC_ROOT\include_cpp;<Include custom header
folder></AdditionalIncludeDirectories>
<PreprocessorDefinitions>STEP;AP203;AP214;WIN32_LEAN_AND_MEAN;WNT;_CRT_SECURE_NO_DEPREC
ATE;_CRT_NONSTDC_NO_DEPRECATE;_SECURE_SCL=0;_HAS_TR1=0;_WIN32;WIN32;_WIN64;_INTEL=1;CR
TAPI1=_cdecl;CRTAPI2=cdecl;IMAN_TAO;BYPASS_FLEX;POMDLL;IPLIB=none;%(PreprocessorDefinitions)</P
reprocessorDefinitions>
<CompileAs>CompileAsCpp</CompileAs>
<AdditionalOptions>
</AdditionalOptions>
<Optimization>Full</Optimization>
<OmitFramePointers>true</OmitFramePointers>
Visual Studio Setup
<ProgramDataBaseFileName>$(TargetDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<AdditionalOptions>/ignore:4099 /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>[Link];[Link];[Link];[Link];[Link];[Link];[Link];lib
[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];libfor
[Link];[Link];[Link];[Link];[Link];[Link];[Link];libinternal_exits.lib;libvalidation.
lib;[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link]
b;[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];libsub_mgr.lib;libt
[Link];[Link];libnxmgr_im.lib;[Link];[Link];[Link];[Link];libuser_exits.lib;[Link];libcol
[Link];[Link];[Link];[Link];[Link];[Link];libtc_utils.lib;libsch
[Link];libschmgt_bridge.lib;[Link];[Link];[Link];[Link];[Link];
[Link];libbase_utils.lib;[Link];[Link];[Link];[Link];[Link];libc
[Link];[Link];[Link];[Link];[Link];libFnd0formula
[Link];%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>TC_ROOT\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];libd
[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];libinternal_exits.dll;
[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];[Link];
[Link];[Link];[Link];[Link];libsub_mgr.dll;[Link];libnxmgr_im.dll;[Link];libai.
dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<PreventDllBinding>false</PreventDllBinding>
<ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
</ItemDefinitionGroup>
</Project>
x Change the highlighted variables (TC_ROOT) as per the installed environment.
x Change the highlighted CHANGE_ME to the desired project name.
x Save it as <project_name>.props file
3.2Create Batch Command File
[Link] .bat file with following content
@echo off
set TC_ROOT=<Specify full path as per your installation>
set TC_DATA=< Specify full path as per your installation>
call %TC_DATA%\tc_profilevars.bat
Visual Studio Setup
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\[Link]"ÅChange this as
per your Visual Studio installed on your system.
[Link] file in folder of your choice.
3.3Create Preference
OOTB TC 10.1 does not defined TC_customization_libraries preference. For custom libraries to be
recognized by tcserver, it is required to have the preference and include the library name (without .dll)in
this preference.
The library name should be same as that is specified in CUSTOM_register_exit API.
To create preferences follow these steps:
1. Start Teamcenter
2. In Teamcenter got Edit->Options menu. Following dialog will be displayed
[Link] on Filters
Visual Studio Setup
4. In the search field enter “TC_cust”.
5. If the preference exists then it will be displayed.
Visual Studio Setup
[Link] the displayed preference and click “Edit”.
Visual Studio Setup
[Link] library name in text field and click on “+”
[Link] specified library will be added to the list
[Link] “Save” to save the preference
[Link] preference does not exists
[Link] on create ICON to display create widow
b. Enter “TC_customization_libraries” in “Name” field
c. Select “Site” in “Protection Scope” dropdown field
d. Select “General” in “Category” dropdown field
e. Select “Multiple” in “Multiple” dropdown field
[Link] library name in text field and click “+”
[Link] specified name will be added to the values field
[Link] some text in “Description” field for “Save” button to be enabled
[Link] on “Save” to save the preference.
3.4Start Visual Studio
[Link] click on .bat file to launch Visual Studio
[Link] empty project
[Link] “Empty Project”
4. Specify project name in “Name” field
5. Select suitable location for project using “Browse” button
6. Click “Ok”
7. New project is created
8. Select “Configuration Manager” from drop down for “Win32” list
[Link] Manager dialog is displayed
[Link] “<New..>” in Platform drop down
11. Select “x64” for “Platform” and “<Empty>” for “Copy setting from:”. If not available
forselection then enter “x64”.
12. Click “OK”
13. Close “Configuration Manager” window
14. New configurations “Debug | x64” and “Release | x64” will be created as shown
15.
Remove “Debug | Win32” and “Release | Win32” using RMB->Remove menu
[Link] the saved properties file into the project folder
[Link] your custom properties using RMB->Add Existing Property Sheet
[Link] properties file
19. Click “Open”
20. Property is added under “Debug | x64”
Visual Studio Setup
21. Repeat steps 19-21 for “Release | x64”
22. Open properties file using RMB->Properties menu
[Link] dialog is displayed
24. Select “General” and change value for “Target Extension” from .exe to .dll by using <Edit..>in
the drop down
[Link] .exe to .dll
26. Click “OK”
27. Check to make sure that “Multi-Threaded DLL (/MD) is selected for “Runtime Library”
underC/C++->Code Generation section
28. Check to make sure “Yes (/DEBUG)” is selected for “Generate Debug Info” under Linker-
>Debugging section.
29. Click “OK”
30. Select project name node in properties tab and perform RMB->Properties
31. Make sure “Configuration Type” is set “Dynamic Link Library (.dll)” under “Configuration
Properties->General” section.
[Link] existing Header and source file in “solution” tab
Visual Studio Setup
33.
Select Header and perform RMB->Add->Existing Item
34. Navigate to the folder where header file resides and select all required header files and
click“Add”
Visual Studio Setup
35. Preform same action for Source Files
36. Header and Source Files are added to solution
[Link] the header file folder in properties tab
38. Select “libCUSTOM” and perform RMB->Properties
39. Updated “Additional Include Directories” under C/C++->General section
40. Click on the drop down on the values column and select “<Edit..>”
41. Additional Include Directories dialog is displayed
42. If a directory for the custom header file was added in .props file and it does not exists.
Thenremove that folder by selecting the line and clicking on “X”.
43. Now click on “Folder” ICON to add desired header file folder
44. This will display a “…” (three dot browse) button to browse for folder.
[Link] on “…” button and browse to folder where header files resides and click “Select Folder”
[Link] folder is added to the list
47. Repeat steps 43-45 if more folders needs to be added.
48. Click “OK”
49. Click “OK” to close properties dialog
50. Build project using Build->Build libCUSTOM menu
[Link] success full build following message will be displayed.
[Link] files will be found in <Project Folder>\x64\Debug folder
[Link] .dll, .exp, .ilk, .pdb files to %TC_ROOT%\bin folder
[Link] the Teamcenter deployment is set for 4-Tier then, change the pool manager configuration
to start only one tcserver.
[Link] is best to have a 2-Tier deployment to debug the code.
[Link] server manager if 4-Tier else start RAC.
[Link] MSDEV select Debug->Attach Process
[Link] “tcserver” and click “Attach”
59. Set break points in your code
60. And invoke actions that will execute the code where break point I set.
61. The execution will stop as soon as break point is encountered.
62. Step through the code as desired.