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

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.

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.

What is the best way to deploy a Template project in C#?

Heyy all =)
We create a custom project template in C# following This topic to force all developers to develop uniformly, all inherit from the same class and receive the same development tools we developed in four separate DLLs and all have the App.config file with default keys etc.
We work on vs2012 or vs2013.
Since I have put the DLLs manually and attach them to come into the same project ZIP file (are that is the right way to do it or somthing like this answare?) Now if there are any changes we will have time to re-export it, etc. So we thought the installation project.
Now I'm not sure what type of project to use.
I saw that there are a number of options I will list below and I would love advice about the right, the best, and most appropriate way to do it:
Creating Extensions By Using the VSIX Project Template or other Extensibility projects
The WIX way
Using Wizards somthing like this perfect answare
One of the project from the Visual Studio Installer Projects Extension

Can open MVC4 solution in VS2010, but not in VS2012

Looked through some similar questions, could not find one that fits my case.
I have a solution that I created some time ago in VS 2010 (maybe originally in MVC2), and eventually upgraded to MVC4.
The solution works properly when opened with VS 2010, builds and runs - everything as expected.
To confirm that I use MVC4, I checked the properties of my System.Web.Mvc.dll. It appears to be 4.0.0.0
From this I assume that I have MVC4 successfully installed on the machine.
However, when I try to open the solution with VS 2012 I get the following infamous error
Full text:
Unsupported This version of Visual Studio does not have the following
project types installed or does not support them. You can still open
these projects in the version of Visual Studio in which they were
originally created.
- Recipes, "C:\ ... Copy\Recipes\Recipes.csproj"
I can also create a new MVC4 project using VS 2012, so I'm assuming I don't lack any tools VS 2012 needs.
What else could be the problem?
There's probably an entry in the <ProjectTypeGuids> element of the .csproj file that VS2012 doesn't recognize. I have a vague recollection there was some tooling identifier change but I can't recall specifically.
My suggestion would be to create a new project from scratch and then compare the <ProjectTypeGuids> elements in each .csproj file to try to figure out which one from the VS2010 project it doesn't like in VS2012. It's likely going to require some trial-and-error tweaking of the list so make a backup of the file first so you don't get yourself into a situation where you can't open it at all.
If you don't want to take that approach another option would be to create a new empty project and then import the individual files from the old project into the new, but that could obviously be quite time-consuming if it's a large project.

Work with VS 2010 on a project for VS 2005

I have a project on SourceSafe that the team work with VS 2005.
I have installed VS2010 and like some features of this version.
Is there a way that I keep the project to day with SourceSafe, but however work locally with VS2010.
Say, I could not add new files to solution, but at least obtain, modify and archive the existing ones.
You can update all of the source files pretty safely unless you're adding code that is new since VS 2005. The main difference between the VS versions is in the project, and the solution files. What you can do is make your local project and solution files writable, and then use your source control to modify the source files. When all is said and done though you'll want to build it in 2005 (with the SourceSafe versions of the project and solution files) to make sure it all still works.
Also note that the conversion utility in Visual Studio that converts projects from previous VS versions is only intended to convert projects from the previous version. Since VS 2010's previous version is VS 2008 and not VS 2005 you may have to perform manual changes on your solution and project settings to get everything to build. The main thing that comes to mind is how global include directories are handled. If you have access to VS 2008 convert it to that first, and then to VS 2010.
Besides targetting the 2.0 framework VS2010 will still let you use new language features so you have to be careful.
And as Ben Burnett said, the sourcesafe binding doens't have to be a problem as long as you don't check out project and solution files. You can remove the read only flag from them so VS2010 can edit them, but they don't need be be checked into sourcesafe.
But I really wonder which feature you like so much about VS2010 that you want to restrict yourself to not be able to add, remove or rename files from your project.

Solution file vs. Project file in Visual Studio

Can someone briefly explain to me the difference between Visual Studio's solution file (.sln) and project file (.vcproj).
It seems to me opening either one open the correct solution/project in Visual Studio. Is one the super-set of the other?
Note: I am currently using Visual Studio 2008 working on a project that was brought forward from Visual Studio 2005 (I believe).
A solution is a set of projects. If you need more than one project in your software, then go with solutions. I.E.: A Class Library Project + A Web Application Project.
A project file typically corresponds to a single module: EXE or DLL or LIB. A solution manages a collection of project files.
A solution is a collection of projects. Visual Studio is made so that it cannot function without a solution, so if you open a bare project, it will generate the solution automatically (or try to find one).
One solution can contain zero or more projects. Everything is in projects, so a solution with zero projects doesn't contain anything at all besides the solution properties.
Visual studio keeps track of where the projects are used, so if you open a project file, it will open (IIRC) the last solution where it was used.
When you create a project from scratch, a solution is also created, but it's not shown until you add another project to it. It looks like you have only the project open, but it's actually a solution containing the project that is open.
Specifically project files are intended to contain the data required to build the files in the project into an exe or dll. This file is utilized by the local compilers or with systems such as Team Foundation system and server side build agents.
Solutions are a client (IDE) construct designed to manage collections of projects, which in effect is a collection of different build definitions and associated files.
Solution files are typically made up of multiple project files.

Resources