简体   繁体   English

并排在同一位置使用VS2017和VS2015 C#项目

[英]Using VS2017 and VS2015 C# projects in the same location, side-by-side

Is anyone out there using Visual Studio 2015 and 2017 .CSPROJ files alongside each other in the same folder? 是否有人在同一文件夹中同时使用Visual Studio 2015和2017 .CSPROJ文件? Are there any other incompatibilites, besides the solution and project files that I should worry about? 除了我应该担心的解决方案和项目文件之外,还有其他不兼容之处吗?

Basically what I want to do is allow our developers to continue to use VS2015 and those projects -- just for a while -- while all still working on exact same set of same code files. 基本上,我想做的是允许我们的开发人员继续使用VS2015和那些项目(仅一会儿),而所有这些人仍在使用完全相同的同一组代码文件。 I don't want to move/change anything else. 我不想移动/更改其他任何东西。

I've already created all the new project files and solution file. 我已经创建了所有新的项目文件和解决方案文件。 But 'm wondering if I can just put them in the same physical disk folder alongside each other and have everyone go merrily about their development tasks with either VS2015 or VS2017. 但是,我想知道是否可以将它们彼此并排放置在同一物理磁盘文件夹中,并让每个人都对VS2015或VS2017的开发任务感到满意。

The duplication of work synchronizing the project files themselves is not a concern. 同步项目文件本身的工作重复不是问题。 I just want to make sure there aren't any OTHER format differences that might cause some sort of build/run problem for me. 我只想确保没有其他格式差异,这可能会给我造成某种构建/运行问题。

Is anyone else out out there doing this? 外面有人在这样做吗? Is this workable? 这可行吗?

There is not any incompatibility, but you should check when you are creating a new project in VS2017 the kind of project, you should have two things in mind, first, when you are creating .net projects, you have to keep using the old .net framework instead of .net core, and second (only if you are going to create desktop/libraries/console projects), you need to use the Common option instead the new option (check on the dropdown to select the .net framework version that allows you to select versions lower than 4.5), cause if not, then you have the incorrect kind of project selected and this kind of project doesn't work in VS2015 as they change the structure of the .csproj file. 没有任何不兼容性,但是您应该检查在VS2017中创建新项目时的项目类型,应牢记两点,首先,当您创建.net项目时,必须继续使用旧版本。 net框架而不是.net core,第二个(仅当您要创建桌面/库/控制台项目时),您需要使用Common选项而不是new选项(在下拉菜单中选中以选择适用于.net框架的版本允许您选择低于4.5的版本,如果没有,则您选择的项目类型不正确,并且这种项目在VS2015中不起作用,因为它们更改了.csproj文件的结构。 Hope this little explanation helps you. 希望这个解释能对您有所帮助。

Update 更新资料

What I wanted to say with this explanation is that every projects that comes from VS2015 or 2017 if they have the same structure (same old kind of .net framework), then you can do what you want to do, but if for some reason you need to make a .net core, then this will not work. 我想用这种解释说的是,来自VS2015或2017的每个项目,如果它们具有相同的结构(相同的旧式.net框架),那么您可以做您想做的事情,但是如果出于某种原因,需要建立一个.net核心,那么这将无法工作。

Cheers. 干杯。

Just be aware that VS2017 supports C# language version features that 2015 does not. 请注意,VS2017支持2015年不支持的C#语言版本功能。 If anyone uses those features you will not be able to build the projects in VS 2015. 如果有人使用这些功能,则您将无法在VS 2015中构建项目。

You can enforce language version in the .csproj files but this is done per BuildConfiguration and can be tedious to configure for larger solutions with many projects. 您可以在.csproj文件中强制使用语言版本,但这是根据BuildConfiguration进行的,因此对于具有许多项目的大型解决方案进行配置很繁琐。

To make the changes 进行更改

  • Right click the Project and select Properties 右键单击项目,然后选择属性
  • Then Build Then 然后建立然后
  • Advanced (Bottom Right corner) General > Language Version 高级(右下角)常规>语言版本
  • Change to C#6.0 更改为C#6.0

Overall it is possible but you may need to retain VS2015 if you have any SSIS or SSRS packages as the tooling is still not available for general release (Oct 17) and is still in preview. 总体上可以,但是如果您有任何SSIS或SSRS软件包,则可能需要保留VS2015,因为该工具仍无法用于一般版本(10月17日),并且仍在预览中。

You should be able to run Visual Studio 2015 and Visual Studio 2017 side by side without any issues. 您应该能够并行运行Visual Studio 2015和Visual Studio 2017。 Our application ran on both Visual Studio 2015 and Visual Studio 2017 before every developer migrated to VS 2017. 在每个开发人员迁移到VS 2017之前,我们的应用程序都在Visual Studio 2015和Visual Studio 2017上运行。

You do need to keep in mind few things though: 不过,您确实需要记住以下几点:

  1. Visual Studio 2017 by supports C# 7.0. Visual Studio 2017 by支持C#7.0。 Make sure that you use same language version in both the IDEs. 确保在两个IDE中使用相同的语言版本。
  2. VS 2017 also supports stuff like editor.config. VS 2017还支持诸如editor.config之类的东西。 I would suggest to avoid using it (though I feel it should not be an issue) 我建议避免使用它(尽管我认为这不应该成为问题)

  3. If you are using on .NET Core project without csproj . 如果在不带csproj .NET Core项目上使用。 Do not think you would be able to upgrade it. 不要以为您可以升级它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM