如何将 Visual Studio .NET 2008 解决方案转换为 Visual Studio .NET 2005?

发布于 2024-07-19 05:28:38 字数 242 浏览 5 评论 0原文

假设解决方案仅包含类,并且这些类全部按照 .NET 2.0 规范编写。 如果要在 Visual Studio 2008 中打开、转换和保存该解决方案,是否可以稍后在 Visual Studio 2005 中重新打开该解决方案,并对 .SLN 文件进行一些最小的修改?

一个人会怎样做呢?

如果解决方案中包含的所有类都已写入 .NET 2.0 规范,是否有工具可以将 2008 年到 2005 年的 .SLN 文件“向下转换”?

Assume that a solution only contains classes and that those classes are all written to .NET 2.0 specifications. If that solution were to be opened, converted and saved in Visual Studio 2008, would it be possible to reopen the solution later in Visual Studio 2005 with some minimal modifications to the .SLN file?

How would one go about doing that?

Is there a tool that will "down convert" .SLN files from 2008 to 2005 if all of the classes contained within the solution are already written to .NET 2.0 specifications?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

时光倒影 2024-07-26 05:28:38

通常,您需要对 .SLN 文件执行的唯一操作是更改文件顶部的版本号。

您的 CS 项目文件也几乎没问题,如果不是,可以对其进行调整,以便它们在 2005 和 2008 中都可以。

我们使用共享相同内容的两个解决方案文件(05 和 08)运行了一段时间。 CS 项目文件集。

但请注意,您不能像这样在两个版本之间共享 VC 项目文件。

项目文件的“调整”如下:

在 VS2008 上创建的 CS 项目将包含以下行:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

VS2005 将对此感到窒息,您需要将其更改为以下内容:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

后者将适用于 2005 和 2008。

Uusally, the only thing you need to do with .SLN files is to change the version number at the top of the file.

Your CS project files will also be almost OK, and if they're not, it's possible to tweak them so that they are OK with both 2005 and 2008.

We ran for a while with two solution files (05 and 08) sharing the same set of CS project files.

Be aware though, that you can't share VC project files between the two versions like this.

The 'tweak' for the project files is as follows:

CS Projects created on VS2008 will contain the line:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

VS2005 will choke on this, and you need to change it to the following:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

The latter will work with both 2005 and 2008.

倾`听者〃 2024-07-26 05:28:38

如果您在 2008 年没有使用任何“奇特”功能,根据我的经验,唯一发生变化的是几个地方的版本号。 可以手动编辑它(位于文件 IIRC 的顶部)。 至少值得一试。 如果您使用 VS2008 特定的功能(设计器等),它可能不起作用,但对于简单的类库,我已经成功做到了这一点。

您可能对感兴趣我之前写的关于 VS2005 和 VS2008 共存的博文

If you're not using any "fancy" features in 2008, in my experience the only thing which changes is the version number in a couple of places. That can be manually edited (it's at the top of the file IIRC). It's at least worth a try. If you're used VS2008-specific features (designers etc) it may well not work but for simple class libraries I've had success doing this.

You may be interested in a blog post about VS2005 and VS2008 co-existing that I wrote a while ago.

帥小哥 2024-07-26 05:28:38

这里有一个转换器 http://www.emmet-gray.com/Articles/ProjectConverter .htm(也适用于 VS 2010)。

还有 http://www.dsmyth.net/wiki/Downloads_VS2008ToVS2005Patcher.ashx
(链接目前已损坏?)。

我还发现了这个 http://www.codeplex.com/Vs2008BackMigration 但我没有测试它。

Here there is a converter http://www.emmet-gray.com/Articles/ProjectConverter.htm (works with VS 2010 also).

There is also http://www.dsmyth.net/wiki/Downloads_VS2008ToVS2005Patcher.ashx
(link currently broken?).

I also found this http://www.codeplex.com/Vs2008BackMigration but I didn't test it.

梦萦几度 2024-07-26 05:28:38

是的,如果您“降级”解决方案文件,这是可能的。

不,据我所知,没有这样的工具,而且我也看过。

您有三个选择:

  1. 不打开 2008 年的解决方案文件,因此永远不会升级它
  2. 不针对相同文件混合客户端版本(即坚持 2005 年,或每个人都升级)
  3. 为 2005 年和 2008 年保留单独的解决方案文件,确保所有两个项目中都存在相同的项目,

感谢 @Will Dean 提醒我项目文件确实可以共享。 注意,它们是2008年编辑器触及的,但之后可以在2005年打开。

Yes, it is possible, if you "downgrade" the solution files.

No, there is no such tool that I know of, and I've looked.

You have three options:

  1. Not open the solution file in 2008, and thus never upgrade it
  2. Not mix client versions against the same files (ie. stick to 2005, or everyone upgrade)
  3. Keep separate solution files for 2005 and 2008, make sure all the same projects are present in both

Thanks to @Will Dean for reminding me that project files can indeed be shared. Note that they are touched by the 2008 editor, but they can be opened in 2005 afterwards.

神经暖 2024-07-26 05:28:38

你可以试试这个。 YMMV

http://www.emmet-gray.com/Articles/ProjectConverter.htm

我记得几个月前它被发布在 Jon Skeets 博客上,似乎得到了人们的竖起大拇指

You could try this. YMMV

http://www.emmet-gray.com/Articles/ProjectConverter.htm

I remember it was posted on Jon Skeets blog a few months back and seemed to get a thumbs up from people

囍笑 2024-07-26 05:28:38

没有直接的方法,如果你尝试的话,这是一个艰巨的任务。 最简单的方法是创建一个新的 2005 项目并添加您的类。

对于初学者:这些是您会看到的差异:

.csproj 文件:(这些基于 MSBuild 架构)

(编辑)

  • ToolsVersion
  • ProductVersion
  • ProjectVersion

(删除)

  • OldToolsVersion
  • TargetFramework

.sln 文件:(无架构)

  • 格式版本 10.0

等。

There's no direct way, and it's a tall order if you try. The simplest way would be to create a new 2005 project and add your classes.

For starters: these are the differences that you'd see:

.csproj files: (these are based on MSBuild schema)

(edit)

  • ToolsVersion
  • ProductVersion
  • ProjectVersion

(remove)

  • OldToolsVersion
  • TargetFramework

.sln files: (no schema)

  • Format Version 10.0

etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文