0

I have two dotnet core projects. One of them uses dotnet 1.0 (Preview 2 build 3131 and 3133) and other uses dotnet 1.1.1. As far as I know, I cannot run a project.json & xproj based projects with dotnet 1.1.1 and I also cannot run csproj based projects with dotnet 1.0.

I can migrate the legacy dotnet core project to csproj. But I am looking for a solution that I can work on both projects in Windows or Linux.

I checked using docker when compiling projects in Visual Studio and could not find any sufficient resource.

Thanks.

svick
  • 236,525
  • 50
  • 385
  • 514
skynyrd
  • 942
  • 4
  • 14
  • 34
  • So as we're clear: what happens if you use dotnet 1.1 (i.e. "current") and cproj for both? that should be the default thing to do, so: why can't you do that? (I guess it should be fine to use 1.1.1 if you need it) – Marc Gravell May 08 '17 at 09:26
  • All versions of .Net Core work on both Windows and Linux. What's preventing you from using the latest version of .Net Core everywhere? – svick May 08 '17 at 18:49

2 Answers2

1

The csproj based tooling works with both .NET Core 1.0 and 1.1. There also is a tooling preview2 (project.json/xproj) build that has .NET Core 1.1 support (1.0.0-preview2-1-003177).

The point is that the versioning of the tools is independent of the the version of the .net core runtime at the moment, though the upcoming 2.0 releases will be csproj only, with both runtime and tooling having a 2.0 version.

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217
  • Thanks for your answer, although my dotnet cli version is `1.0.3` and dotnet core version is `1.1.0`, I can't use `dotnet restore` in a project with `xsproj` and `project.json`, the error is `error MSB4019` and when I checked Github issue for that I could't fix the problem. However `dotnet restore` works great for my other project which has a `csproj`. It is not related to my question but also I can't open my legacy project in VS2017, and can't open my updated project in VS2015. What should be the exact versions of dotnet cli and core to run them without an error? – skynyrd May 08 '17 at 11:31
  • 1
    The supported version of the tooling (!) is 1.0+ (currently 1.0.3), which is a part of VS 2017. VS 2015 (and 1.0.0-preview*) is no longer supported. – Martin Ullrich May 08 '17 at 11:33
1

First, you seem to be confusing the version of .Net Core, with the version of .Net Core SDK.

The version of .Net Core (e.g. 1.0.4 or 1.1.1) is not directly related the the difference between project.json and csproj. That is the version of the runtime itself. You can easily switch between different versions of .Net Core on the same machine, just by editing your project file.

The version of .Net Core SDK (e.g. Preview 2 build 3131 or 1.0.3) is what decides what project format you can use. SDK Preview 2 only supports project.json, SDK 1.0.x only supports csproj. You can have multiple versions of SDK installed on the same machine, and thus have support for both project formats at the same time. But if you want to do that, you need to specify the version of SDK for each project using global.json.

As for Visual Studio, VS 2015 only supports project.json and VS 2017 only supports csproj (but should be able to migrate project.json projects).

That being said, I don't see any reason why you should keep using project.json, .Net Core SDK 1.0.x, which supports csproj, works fine on both Linux and Windows.

svick
  • 236,525
  • 50
  • 385
  • 514