I have a library written in native c++, and then a second library which links to the first in managed c++ (sorry if I am misusing terms, hopefully you get what I am talking about). I can build both, and the second I can reference from my .net application and use perfectly fine. I want to pack the second into a nuget package.
What is the process for this? Linked tutorials or other answers are wonderful, though I feel like I have tried them all and run into problems or they are for different use cases. I'd prefer to do this by the command line using msbuild as I want to make this part of our github workflow, but I'd settle for doing this in visual studio so I can have some semblance of a victory and mental respite.
This is for .Net Framework 4.7.2 (not in my control)
Thanks!
I approached this from a different angle and built the libraries normally and then packaged the dll's into a nuget package using the Nuget CLI rather then the msbuild pack functionality.
This was the tutorial I referenced.
You need to make a relatively simple .nuspec file specifying which DLLs to package and then you can simply run the pack command like so:
nuget.exe pack my-file.nuspec
Related
I want to use some of the great libraries out there (e.g. cgal), but don't know how (have been exclusively writing my own code so far).
It seems every library requires a different process in order to use it (at least on windows)
I'm currently using Clion as an IDE in Windows 10 with minGW. I've tried using the Conan dependency manager but couldn't get it to work (and the documentation/video tutorials are not done very well).
Is there a recommended simple way to do it?
Is using vcpkg with visual studio a good way to go about it?
edit: for clarification, I am an academic physicist developing scientific simulations mostly to be used by myself, so I don't have to package my code with all the dependencies included.
Thanks.
I am trying to learn networking in windows in C++ (specifically for making a very simple mmo server).
I was reading about cross-platform-ness and socket complexity and came accross both protobuf and zeroMQ quite a lot.
After reading about zeroMQ I decided it makes sense for an mmo server.
So i went over to the zeroMQ website and downloaded the msi installer. I ran it, and now i'm stuck.
I don't quite understand what the MSI did... Did it plop a zeroMQ.dll in system32? Di I still need to get the C++ binding? Basically, how do you install zeromq for C++?
P.S. extra points if someone shows me how to do it with Nuget. I guess that's why I don't know how to install libraries manually, I always use Nuget...
Thanks.
Nuget does have a package for ZeroMQ, but that seems to be only for C# currently.
The MSI you installed contains Python binding for ZeroMQ, and is installed for the selected python version in the installer.
For C++, they have pre-build binaries on their download page.
However, these libraries are build with an older version of Visual Studio, which are not compatible with Visual Studio 2015. If you want to use ZeroMQ, i'm afraid you are going to have to build the library your self.
When you have successfully build ZeroMQ, you can follow their guide to get a feeling of how to use it. Or you can add the C++ bindings which has a pretty and easy-to-use interface.
At my work we are trying to use a standalone repository, meaning that our repo contains the source of course but also the dependencies and the build tool chain. By build tool chain I mean all the tools that are needed to build our application. But the only exception is Visual Studio : to be able to compile our c++ parts, we need to install the entire environment and this is not really convenient. So I was wondering : Would it be possible to compile a c++ application without having VS installed ? But only some kind of build tool chain package ?
I investigated a found out the MSBuild tool which is now part of the VS package but which can be also downloaded alone ("Microsoft Build Tools 2013"). But this does not sontain the MSVC compiler, so it would not help me...
Would it be possible to manually copy the compiler to be able to do this ? Has anyone ever done that ?
Thanks
Roland
Yes, it's possible. One possibility is copy the cl.exe (VS_FOLDER/bin/architecture) and all its dependencies.
Compiling a Native C++ Program on the Command Line
Another strategy consists in downloading Microsoft Windows SDK:
Download Microsoft SDK
Best regards
I'd rather not install the entire VS 2008 installation given that I'm not going to be using anything other than the compiler. Will VS 2010's multitargeting work correctly using only the Platform SDK instead of the full VS2008 install?
The custom setup options are not nearly fine-grained enough to allow you to leave the big chunks like the IDE out. It isn't just the SDK that's used, at least the VC subdirectory needs to be there. And bits of Common7, also the folder that contains the IDE. Rename the folders, delete them later if it works out.
You can directly call the .net 3.5 MSBuild from command line by digging it out of the frameworks folder within windows. I am not certain if you could repoint Visual Studio at a different copy though. More importantly, unless you have found a bug, the copy of MSBuild included in the .Net 4 framework should properly build a project targeting the 3.5 framework. So you might be jumping through some unnecessary hoops in the first place.
What are the pluses and minuses to using the vcredist.exe versus the msm files to install the Visual C++ 8.0 runtime libraries?
Merge Modules can not be updated (unless they solved that in Windows Installer) once they are installed, so my advice would be to stick with vcredist.exe.
Another issue with the merge modules I recently bumped into is that they set the MSI installer property ALLUSERS to 1 which means per-machine. That forces your whole install to be per-machine, which is a problem if you want it to be per-user. Whether there's a way to have a per-user installer that includes a CRT merge module I don't know, but I haven't found it yet.
One downside to the merge modules is that you can't deploy multiple versions of the VC80 or VC90 merge module in the same msi because the file identifiers overlap. You can deploy one of each though. So for example, if you wanted to deploy the RTM version of VC80 and the SP1 version, you will get errors if they are in the same msi (I use WiX).
Another issue, build behavior is different between VS 2005/2008 as it pertains to applying a service pack or update.
2005
If you install service pack 1 on your build machine, your program will automatically link against the updated files. The service pack will also update the merge modules, so provided you're pointing your installer to use the updated files, you're fine. However, this can be an issue if you're using third party compiled static libs that may require an older version of the runtime specifically.
2008
The behavior here is the exact opposite. If you install SP1, the merge modules are updated to the SP1 level, but your program will compile against the RTM versions unless you set a per-project preprocessor macro: _BIND_TO_VCLIBS_CURRENT_VERSION=1. This can be set either in stdafx.h or in the "Preprossor definitions" for your project, or if you're using an old nmake project, you will have to pass it wherever your command line options are, such as CFLAGS.
This means that if you're using the msm provided by visual studio, and you apply SP1, your project deployment is broken until you define the macro.
Another caveat to the macro: if you're using a 2005 project that links against a 2008 static lib, setting the macro will break the 2005 project, due to the symbol not existing in the 2005 version of the compiler. In this case I usually split the project I'm linking against into a 2005 and 2008 version of the solution.
To point out the obvious, Merge Modules are not really a good solution if you aren't going to use an MSI installer. Vcredist is absurdly simple to use regardless of the install process you are using.
MSM will give you a better streamline experience then vcredist, it will integrate with the progress bar and will rollback on error (or cancel).
From the developer side you will benefit by seeing the msm log in the main setup log file and it will execute its actions side by side with the setup action (with vcredist you will need to sequence it yourself).
Because of all of the above reasons I usually choose to use the msm (and its more or less one Wix liner to use it).
Have you considered statically linking instead? Then you don't have a redistribution problem.