Configure Aspose.Words for C++ in Visual Studio
Contents
[
Hide
]
Aspose.Words for C++ API works with Visual Studio 2017 or later. To work with Visual Studio, you may need to install Visual C++ Redistributable available on Microsoft official website.
Configure with MSBuild .targets files
Follow these steps to configure your project with MSBuild .targets files:
Add Import tags with Aspose.Words for C++ targets files into your vcxproj file
- Open your project
*.vcxproj
file in the text editor - Find
<ImportGroup Label="ExtensionTargets"></ImportGroup>
at the end of the file - Add the following
Import
tags insideImportGroup
:<ImportGroup Label="ExtensionTargets"> <Import Project="<path-to>\CodePorting.Translator.Cs2Cpp.Framework_<version>\CodePorting.Translator.Cs2Cpp.Framework.targets" Condition="Exists('<path-to>\CodePorting.Translator.Cs2Cpp.Framework_<version>\CodePorting.Translator.Cs2Cpp.Framework.targets')" /> <Import Project="<path-to>\Aspose.Words.Cpp\aspose.words.cpp.targets" Condition="Exists('<path-to>\Aspose.Words.Cpp\aspose.words.cpp.targets')" /> </ImportGroup> </Project>
Configure manually
Follow these steps to manually configure Aspose.Words for C++ in Visual Studio:
Add the Additional Include Directories:
- Open Project Property
- Go to C/C++ → General
- Add the following Additional Include Directories:
Aspose.Words.Cpp\include
CodePorting.Translator.Cs2Cpp.Framework_<version>\include
Add the Additional Dependencies:
- Open Project Property
- Select Configuration → All Configurations and Platform → All Platforms
- Go to Linker → Input
- For Release configuration:
Aspose.Words.Cpp\lib\x64\Release\Aspose.Words.Cpp_vc14x64.lib
CodePorting.Translator.Cs2Cpp.Framework_<version>\lib\codeporting.translator.cs2cpp.framework_vc14x64.lib
- For Debug configuration:
Aspose.Words.Cpp\lib\x64\Debug\Aspose.Words.Cpp_vc14x64d.lib
CodePorting.Translator.Cs2Cpp.Framework_<version>\lib\codeporting.translator.cs2cpp.framework_vc14x64d.lib
Add the Commands:
- Open Project Property
- Go to Build Events → Post-Build Event
- Add the following Commands:
- For Release configuration:
xcopy /y /d "$(ProjectDir)Aspose.Words.Cpp\lib\x64\$(Configuration)\Aspose.Words.Cpp_vc14x64.dll" "$(OutDir)" xcopy /y /d "$(ProjectDir)CodePorting.Translator.Cs2Cpp.Framework_<version>\lib\codeporting.translator.cs2cpp.framework_vc14x64.dll" "$(OutDir)"
- For Debug configuration:
xcopy /y /d "$(ProjectDir)Aspose.Words.Cpp\lib\x64\$(Configuration)\Aspose.Words.Cpp_vc14x64d.dll" "$(OutDir)" xcopy /y /d "$(ProjectDir)CodePorting.Translator.Cs2Cpp.Framework_<version>\lib\codeporting.translator.cs2cpp.framework_vc14x64d.dll" "$(OutDir)"