Using DotnetZip with Visual Studio C++/CLR
-
28-10-2019 - |
Frage
I tried to use DotNetZip with C++/CLR But I found everyfile i downloaded contain no .h file, in the example code, there is "using namespace Ionic::Zip;"
How can I get that to work in my code?
Lösung
You need to add a reference to the DotnetZip DLL. Once the reference to the DLL is added the compiler will process the metadata in the DLL and make the types and methods available to you in the same way it does by processing a header file. To add a reference do the following
- Right click on the project in "Solution Explorer" and select "References"
- Click the "Add New Reference" button
- Select the "Browse" tab and navigate to the DotnetZip DLL
Andere Tipps
Another solution that don't need to use Visual Studio GUI
is to add directly a #using
directive in each CPP
source file that uses Ionix.zip
.
Example:
#using <Ionic.Zip.dll>
using namespace Ionic::Zip;
If using namespace
is not used, #using
is interesting to document which sources are using Ionix.Zip
. If using namespace
is used, it is more interesting to put this directive in Project's reference as proposed by JaredPar.