问题
Im writing an applcation with C# in visual studio 2012 but i want to open that project in another place in visualstudio 2008. How i can do this? in saving i have to do something? Or in oening in visualstudio 2008?
回答1:
Since I am stuck with VS 2008 in my home computer, I regularly have to do this.
You can modify your solution file (*.sln) manually. Most of the time you just have to change the first two lines that define the VS version of the solution.
From this link:
You can edit the sln and csproj/vbproj files by hand and try that way, I've used this method with no side effects. In the sln file the first lines for VS2010 will say
Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010and for a VS2008 solution:
Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008Also, in a 2010 project file you may find a section like
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />which will need to be modified as
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />With only these 2 types of changes I was able to open the solution & projects with VS 2008.
回答2:
It's not possible.
Visual Studio generally doesn't support forward compatibility -- that is, opening a newer project in an older version of Visual Studio. It generally supports backward compatibility -- opening an older solution in a newer Visual Studio.
Your only real option here is to retain it as a 2008 solution; even then, when you open it in 2012, it may ask you to convert it to a 2012 solution format, which will make it unusable in 2008.
回答3:
I have found this while I was Googleing. It may be useful in your case:
Visual Studio Project Converter
Disclaimer: I have not personally tried this program.
回答4:
I had the same need basically because I wanted to keep the compatibility with .net 3.5. Although VS2010 and VS2012 support projects running on this FW version, many users are still forced by their companies to use VS2008 or 2010.
I could also develop in 2008 but as a geek that I am I dind't even consider it! :)
So, my solution was to create separate *.sln and *.csproj files for each VS version. This way you guarantee that everything will work out of the box for each VS version.
The easier and faster way I found to do this was to open eash VS version and create empty solution and projects, with the same structure as the original but with the vs version on the name like:
- my.solution.sln
- my.project.csproj
- ...
- my.solution.vs2008.sln
- my.project.vs2008.csproj
- ...
- my.solution.vs2010.sln
- my.project.vs2010.csproj
- ...
Keep in mind that you have to manually open all the versions and add the new files and so on... they won't be automatically synchronized but it pretty much works.
Hope this helps, Cheers!
来源:https://stackoverflow.com/questions/13895479/open-visual-studio-2012-projects-in-visual-studio-2008