取决于VS版本,如何具有多个.csproj文件的同一VS项目? [英] How to have the same VS project with multiple .csproj files depending on the VS version?

查看:86
本文介绍了取决于VS版本,如何具有多个.csproj文件的同一VS项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,我看到一个解决方案,该解决方案中的每个项目最多包含三个.csproj文件。像这样的东西:

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

并与 .sln 文件相同:

ProjectSolution.2005.sln

ProjectSolution.2008.sln

ProjectSolution.2010.sln

因此,如果您复制解决方案并想使用 VS2005 打开它,需要打开 Project.UI.2005.csproj ProjectSolution.2005.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.

为了能够在多个版本的Visual Studio中打开相同的解决方案,创建这3个(或2个)文件的最佳方法是什么?

也许唯一的方法是手动修改 .sln / .csproj 。如果是这样的话:

Maybe the only way of doing this is modifying manually the .sln/.csproj. If so:

如何正确修改这些文件,以免使解决方案崩溃?

我想这样做是因为有时我会使用 VS2010 开发应用程序,并且在将源代码部署给客户时,他们无法在 VS2008 中打开它。 ,然后必须做一些调整。

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.

注意

我知道会有引用和编译问题如果我仅使用.NET Framework v4.0或类似版本中包含的功能。假设解决方案中的所有项目都在.NET Framework 2.0(项目属性中指定的 )下进行编译。

推荐答案

我终于结束了为此开发一个小型应用程序的工作。
我仍​​在测试它,但到目前为止它运行良好。

I finally ended developing a small application do to this. I'm still testing it, but it is working good so far.

您需要做的就是选择。 sln 您要转换的文件,并指定转换涉及的版本,它将为您完成所有工作。

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.

如果有一个 VS 2010 项目:


  • 解决方案( Solution.sln

    • Project_1( Project_1.csproj

    • Project_2( Project_2.csproj

    • Solution (Solution.sln)
      • Project_1 (Project_1.csproj)
      • Project_2 (Project_2.csproj)

      ,并且您想将版本降级(到2008年),它将保留这些文件并创建:

      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

        • Solution.2008.sln
          • Project_1.2008.csproj
          • Project_2.2008.csproj

          您将能够使用 Visual Studio 2008 轻松打开 Solution.2008.sln

          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.

          这篇关于取决于VS版本,如何具有多个.csproj文件的同一VS项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆