How to build same project with multiple configuration C# VisualStudio2012 - visual-studio

I have a solution with many projects.
I Would like to build several projects with multiple configuration settings.
e.g:
ProjectA is set as target framework: 3.5 and platform target x86.
output assembly name is: ProjectA.dll.
I want, when clicking the build button, to build the project in several output files:
ProjectA_3.5_x86.dll - for Target framework 3.5 and platform x86
ProjectA_4.5_x64.dll - ...
This is what buildservers does.
Is there a way to have config file that build operation looks at, and then determine how to build each projects, with different assembly names and different build configurations ?
Thanks !

As far as I know, you can only produce one dll per compile of a project. It sounds like what you would want to do is create different build configurations; which can be done by manually editing the project file or using the configuration manager. You can set up different configurations (3.5 framework, x86 CPU, with an assembly name of xxx.yyy) and then select that configuration when you do a compile. However, it is important to understand that you will have to do multiple compiles on your code, selecting the different configurations, to produce the different dlls. If you have an automated build process, you should be able to just set up the project to compile multiple times and change the configuration name.

Related

MSVC C2859 when using a different build configuration of another project as a library

I have a fairly large multi-project C++ solution in Visual Studio 2015. Some of the projects compile to static libraries which are used by other projects, and most of them use precompiled headers to speed up compilation. Each project also has multiple build configurations: debug, release, and several testing configurations which always build an executable to run the tests (even if the normal configurations build a static library).
When building debug and release configurations, or when doing a full rebuild, everything works well, but when doing an incremental build of a test configuration for a project that uses another project's static library, I get C2859 errors which cause the build to fail.
For example, let's say I have a project peach which builds a static library, and a project cobbler that relies on peach. The precompiled header for cobbler references only system and external libraries (no headers from inside the solution). cobbler's test configuration references peach.lib. peach.lib is created by peach's release configuration, so I have a solution configuration called cobbler-test which specifies that:
peach uses its release project configuration
cobbler uses its test project configuration.
Building cobbler-test from scratch (or rebuilding it, clean & build, etc) works fine. But if I then modify a source file called crust.cpp in cobbler and try to build, I get this error:
c:\...\cobbler\src\crust.cpp(1): error C2859: C:\...\out\cobbler-test.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.
Again, this only happens when referencing a static library from the same solution that was built with a project configuration name different from the current one. With both projects using release or debug, incremental builds work fine.
Having to do a full rebuild every time defeats the purpose of using precompiled headers in the first place. Is there any way to get incremental testing configurations to work without having to resort to creating extra project configurations for every combination of projects?
My current solution to this problem is not to use testing configurations, and to create separate projects for testing projects that generate static libraries. This allows all dependent projects to use the same project configuration and allows the precompiled headers to work their magic without blowing up when doing incremental builds.
While this works fairly well for the static libraries, since they can easily be imported with #pragma comment(lib, ...), it's a bit more problematic for projects that build standalone executables. Thankfully, in my case most of those projects don't have a lot of stuff that needs testing.

How to make main project to use libs built from other projects in solution

Actually, question was set in the Theme of the message. But yet again,
i have Solution with 3 projects, two of whitch are Static libraries and one is Application. How my Application project could know from where to pull these .libs.
Yeh, i can do it from Linker->Input->Additional libraries, but i think there are must be other way if projects are in one solution.
There is another way, works on VS2010 and up. Right-click your EXE project, Properties, Common Properties, Framework and References. Click the Add New Reference button and select your project that generates the .lib. Repeat as necessary.
This does two things, it takes care of the Additional Dependencies linker setting, automatically adding the output of the library project. And it ensures that projects are built in the right order, normally something you'd have to with the Project Dependencies command. In your given example, with enough machine horsepower, the library projects will build concurrently. And the main project won't start building until they are both done.

How to run a specific project when you have multiple projects in xcode?

If you have a xcode project like restkit that has the core code for restkit + examples that have their own project, how do you run a specific project?
https://github.com/RestKit/RestKit/
If you look at the /Example's folder, you will see they have a few of them and each have their own project file.
You can use multiple targate in xcode.
A target specifies a product to build and contains the instructions
for building the product from a set of files in a project or
workspace. A target defines a single product; it organizes the inputs
into the build system—the source files and instructions for processing
those source files—required to build that product. Projects can
contain one or more targets, each of which produces one product.

How can I set up my project hierarchy in QtCreator?

I'm quite new to QtCreator, so perhaps I left my heart in eclipse-ville, but I can't for the life of me understand how I should be setting up a project hierarchy in QtCreator. I understand there is an option to create a kind of root project and then from there add sub-projects to it, which makes sense but it leaves me wondering whether or not this is necessary at the time of creating the project, e.g. can I just create a library in one project and reference it later by another project?
I've tried setting up a blanket type of project by creating a new subdirs project and then adding the main program as a subproject, but then how should I add my library project?
Ideally, I'd like to create one project as the main application and reference another project as a library. Help?
The documentation of Qt Creator contains two sections that may help you find the answers to your questions:
Adding Subprojects to Projects
Adding Libraries to Projects
EDIT:
You can find a really simple sample project here: QtSymbianDllExample. "It is intended to demonstrate how to create and use a DLL with Qt on the Symbian platform". It is a sample for Symbian development but that is irrelevant now, I do not have a Symbian phone. What is important is that it contains a root project (QtSymbianDllExample\qtssymbiandllexample.pro) and two subprojects (QtSymbianDllExample\qtenginedll\qtenginedll.pro, QtSymbianDllExample\testui_simpledllengine\testui_simpledllengine.pro) which you can examine and compare to you projects. I have checked that I can build the root project by doing the following steps:
Download and install the Windows Offline Installer from http://www.qt.io/download/
Download and extract QtSymbianDllExample.zip
Run Qt Creator
File / Open File or Project... Select qtssymbiandllexample.pro
Build / Run qmake
Build / Build project "qtsymbiandllexample"

VS/MSBUILD: Copy output files of sub-project without adding reference to exe

I have a solution wich consists of main application MainProject and several plugin projects Plugin1, Plugin2 etc. Each of them is build in a separate project within Visual Studio.
For building the soution, I want all files of the plugins to be copied into the main application's output directory. But I don't want MainProject.exe to contain explicit references to the plugin dlls (they are loaded dynamically). Therefore defining project references for MainProjectdoesn't work.
I could use a post-build-step copying the files "manually" (as described in C# - Copy dlls to the exe output directory when using dependency injection with no references?), but since there might be multiple files for each plugin and they also change from time to time this solution is rather tedious to maintain (especially since I do have different build configurations, each of them producing different files). Also I would like to easily select, which plugins should be copied for a certain build.
What would be the best way, possibly involving custom MSBuild configuration changes, to do this?
See this link: http://msdn.microsoft.com/en-us/library/bb629394%28v=vs.100%29.aspx
When invoking MSBuild on the main project, if you could pass something on the lines of:
msbuild /p:CustomBeforeMicrosoftCommonTargets=[your custom msbuild file];PluginList=PathToPlugin1.csproj,PathToPlugin2.csproj
In your custom msbuild file, a target such as GatherInfo will get you the paths to output files of each plugin project. See this question for a sample: https://stackoverflow.com/questions/23346782/how-to-identify-files-needed-to-build-a-wix-project

Resources