How to build two version of .net framework at one click on visual studio - visual-studio-2010

below is what I want:
There are several versions of .Net Framework, like 3.5 and 4.0. Is there a way on Visual Studio to click the build button and get two built .exe or .dll files?
I know there is "Batch Build" in Visual Studio to build several .exe at the same time, but I can create different build configurations. But I cannot assign different build configuration with different .Net Framework version and get the build result at the same time. Did I miss something or is there any work around?
Thanks a lot.

To do this you should have one Major project that develop on one it. its version is 3.5
create another project and add first project files to it. after build the solution you have two version of compilation from your code.
to have a clean work you can use Post-Build event to copy output files to another directory.
ask me if any point is not clear

Related

Is it possible to include a program project and a Wix project both in a Visual Studio Solution?

For example, I use Visual Studio to create a mono game project in the solution, and I add another wix project that
when I hit "build solution", the mono game project being build, and wix project build a installer directly afterward.
In this way, I don't need to separate my project everywhere, because I just want some more additional options with One-Click installer.
If I can use Wix, I can customize the installer, but how?
After search for some time, I found this
http://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html
But, I would like to put two projects in a same solution folder, rather than two separate solution folder. This way, if I change the path, will the link just broke up?
Yes, you can. Simply add a reference to the project from your WIX project.
Note that with project references, you can use variables in your wxs files. For example if your game project were DavidWong.MyGame:
<File Id="MyGame.exe"
Name="$(var.DavidWong.MyGame.TargetFileName)"
Source="$(var.DavidWong.MyGame.TargetPath)" KeyPath="yes" />
See the documentation for more info.
Yes, it can be done ( project reference and $(var.ProjectName.TargetDir) and so on ) but in my experience there are a few reasons not to:
1) When a new version of Visual Studio comes out you might be stuck if a new version of WiX is not yet released to support that version of Visual Studio. I've seen this several times and currently you'd have to run a beta build of WiX v3.10 if you wanted to support Visual Studio 2015.
2) All developers now have to install WiX or get error messages that some projects couldn't be loaded.
3) Some developers will complain that they don't want "setup" code in their .NET solution. I think this is a thin complaint but I kinda get it.
What I like to do is have an application solution and an installer solution. I use postbuild copy commands and MSBuild publish profiles to stage content in a "deploy" folder that models the deployed system and then use that reference that structure in my wix code.

Share files between projects in visual studio 2013?

I have a F# project which is compiled for .Net 4.5. However, I need it to be compiled .Net 4.0 too. I created another project target .Net 4.0 and I can copy all the same files from the .Net 4.5 project to the newly created project.
The project referred some NuGet libraries which have different packages for .Net 4.5 and 4.0 so I cannot simply change the project's .Net version and recompile. How to avoid maintain two copies of the same files? I know VS 2015 has shared files function.
try "Add As Link".
Project menu > Add Existing Item... and in the Add drop-down list, click Add As Link.
I think you would be better off using source control to share files.
The source control has one copy.
Having a multiple copies on your hard drive is actually a good thing. One project can use a stable version while another project updates and tests a new version.
The only disadvantage is if one project checks in changes, you must remember to do a 'get' for the other projects.

Build multiple configurations of a project in a single build operation in Visual Studio

I'm trying to build an XPCOM extension for Firefox, and I need to build separate dlls for Firefox 4 and Firefox 5, to link against their different versions of the xulrunner SDK. Is there some way that I can do this using a single vcproj to generate two output files from different configurations of a single project? The only difference between the configurations is the directory of the xulrunner SDK in the include and lib paths.
As far as I can tell, VS2010 will only build one configuration at a time. I've tried adding a new platform for the project, but it will only let me add predefined platforms (x64, Itanium).
Thanks for any suggestions.
Try going to Build->Configurations Manager. You can define multiple build configurations there and then build whichever ones you'd like using Build->Batch Build. Is this what you're asking about?
(BTW, first post! Yay!)
EDIT: I should add that this works in VS2008, which is the only VS I have installed here, but the feature is still available in VS2010.

How to have the same VS project with multiple .csproj files depending on the VS version?

Sometimes I've seen a solution that includes up to three .csproj files for each project in the solution. Something like this:
Project.UI.2005.csproj
Project.UI.2008.csproj
Project.UI.2010.csproj
and the same with .sln files:
ProjectSolution.2005.sln
ProjectSolution.2008.sln
ProjectSolution.2010.sln
So if you copy the solution and want to open it using VS2005, you just need to open Project.UI.2005.csproj or ProjectSolution.2005.sln.
What is the best way of creating those 3 (or 2) files, in order to be able to open the same solution in multiple versions of Visual Studio?
Maybe the only way of doing this is modifying manually the .sln/.csproj. If so:
How can I modify those files correctly so I won't crash the solution?
I want to do this because sometimes I develop applications using VS2010 and when deploying the source code to my customers, they can't open it in VS2008, and then I have to do some tweaks.
Note:
I know there will be referencing and compiling problems if I use features only included in .NET Framework v4.0, or similar. Let's suppose all the projects in the solution are compiling under .NET Framework 2.0 (specified in the project properties).
I finally ended developing a small application do to this.
I'm still testing it, but it is working good so far.
All you need to do is, select the .sln file you want to convert, and specify the versions involved in the conversion, and it will do all the work for you.
If you have a VS 2010 project:
Solution (Solution.sln)
Project_1 (Project_1.csproj)
Project_2 (Project_2.csproj)
and you want downgrade the version (to 2008), it will keep those files, and also create:
Solution.2008.sln
Project_1.2008.csproj
Project_2.2008.csproj
And you will be able to open Solution.2008.sln with Visual Studio 2008 without problems.
As soon as I finish it, I'll share executables and sources here.

How to rebuild ALL?

In Visual Studio, how do I rebuild a complete solution, including all configurations?
If I choose "Rebuild solution", it always rebuilds ONLY Debug or ONLY Release, but never both.
Use the batch build option...right click on the solution to see it.
Here is a screen shot (VS2010 but I believe it's the same for VS2008 too)
Batch build screen shot http://img368.imageshack.us/img368/1516/batchbuild.jpg
Some of my project had the 'batch build' option, others didn't.
Found that those that did have it were written in c#.net and those that didn't have it were in vb.net, more information here:
https://msdn.microsoft.com/en-us/library/jj651644.aspx
You can build most types of projects with multiple, or even all, of their build configurations at the same time by using the Batch Build dialog box.
However, you can't build the following types of projects in multiple build configurations at the same time:
Windows 8.x Store apps built for Windows using JavaScript.
All Visual Basic projects.
In Visual Studio 2005, I discovered that under Build->Configuration Manager, I did not have Build checked for the project.

Resources