1
votes

I usually work with Java and therefore have little experience with .Net. I have a working .Net Core app which I would like to upgrade to the newest Version of .Net Core. I'm still using VS2015 cause if I want to migrate the project for VS2017 I get tons of errors which I wasn't able to solve even after trying different attempts.

In theory I should just update the version in my global.json. Then update the dependencies in the project.json (and update them with NuGet). Then change all the deps in the code and it should be fine right? So what I'm I missing out here. I tried too long and feel very stupid and frustrated by now^^ Any help would be appreciated a lot :)

If I change the SDK version to "1.0.0-rc2-final" I get: Error

If I change it to "1.0.3" I get:

Error 2

In C:\Program Files\dotnet\sdk i have installed the following SDK Versions:

  • 1.0.0-preview2-003131
  • 1.0.3
  • 2.0.0-preview2-005905

My global.json:

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.3"
  }
}

My project.json:

{
  "userSecretsId": "aspnet5-WfW_Pay-c80bb5ad-ca9c-425b-9b06-db313f855797",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "AutoMapper": "4.1.1",
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1-update4",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.AspNet.WebApi.Client": "5.2.3",
    "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "Newtonsoft.Json": "8.0.1-beta3",
    "xunit": "2.1.0",
    "xunit.runner.dnx": "2.1.0-rc1-build204"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands",
    "test": "xunit.runner.dnx"
  },

  "frameworks": {
    "dnx451": {
      "dependencies": {
        "Microsoft.ApplicationInsights.Web": "2.1.0",
        "xunit.runner.visualstudio": "2.1.0"
      }
    },
    "dnxcore50": {}
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install" ],
    "prepare": [ "gulp clean", "gulp min" ]
  },
  "webroot": "wwwroot"
}

DNVM list: PS C:\Users\Dennis> dnvm list

Active Version           Runtime Architecture Location                      Alias
------ -------           ------- ------------ --------                      -----
       1.0.0-beta8       clr     x64          C:\Users\Dennis\.dnx\runtimes
       1.0.0-beta8       clr     x86          C:\Users\Dennis\.dnx\runtimes
       1.0.0-beta8       coreclr x64          C:\Users\Dennis\.dnx\runtimes
       1.0.0-beta8       coreclr x86          C:\Users\Dennis\.dnx\runtimes
       1.0.0-rc1-final   clr     x86          C:\Users\Dennis\.dnx\runtimes
       1.0.0-rc1-update2 clr     x64          C:\Users\Dennis\.dnx\runtimes
       1.0.0-rc1-update2 clr     x86          C:\Users\Dennis\.dnx\runtimes default

Migration Logs:
First one: http://hashcookie.ch/dennis/UpgradeLog.htm
After some googling: http://hashcookie.ch/dennis/UpgradeLog3.htm
More googling: http://hashcookie.ch/dennis/UpgradeLog5.htm

2
You will have to use VS2017, or at least VSCode with latest .NET Core SDK from dot.net and start a new project.Lex Li
@LexLi well that's for sure. Problem is I am unable to migrate the project to VS2017. Loads of different errors. Tried it with VS and with the command line tool. So my strategy is to update the project to the newest possible version and then migrate the project files to the new layout (without problems hopefully). I just don't know to what version and how I should upgrade (I'm looking for a migration path or similar)themenace
start from scratch in VS2017 and fight each of the errors you get when cut and paste. That's the price you have to pay if you really started from a preview version, while most of the smart ones wait.Lex Li
wasn't my decision. I would have gone with spring boot^^themenace
your decision or not, if you stick with the preview build you are out of luck and nobody can help.Lex Li

2 Answers

0
votes

Denis,

The components you are using are extremely outdated. DNVM is no longer around, it has been replaced with the dotnet cli.

You can navigate to this link for the new cli. https://www.microsoft.com/net/download

The next possible problem is also that many of the newer packages will not work correctly when running from VS '15, the tooling for .net core is up to date on VS '17.

Maybe grab the community edition to start with. https://www.visualstudio.com/downloads/

Lastly the fact that you are using global.json and project.json still, means you are going to run into compatibility issues with newer .net sdk's and VS '15.

The xproj project format has been made redundant and has been replaced by the csproj structure again.

VS '17, in my experience has done a great job in migrating projects from xproj to csproj.

In summary, I think the components you are trying to use are incompatible and you should look at updating to the latest bits.

0
votes

I had been developing we applications on .Net Core for a while on VS2015, upgrading referencing and config files along the way with some serious trial and error when upgrading to newer versions.

I recently installed VS2017, created a new project, with all the latest defaults and ensured the web application was using the latest .net standard framework. The project files and some configuration has changed, so its worth upgrading to sort that out, it also seemes to have simplified all the versioning issue.

After creating the default project, I re-constructed the application into the new structure which works well.

I has also implemented some work-arounds to getting EF migrations working in a library, but the tools seems to cater for this better now (i.e. using --startup-project command)