PlatformAbstractions icon indicating copy to clipboard operation
PlatformAbstractions copied to clipboard

PlatformServices.Default.Runtime.RuntimeVersion is wrong.

Open jeffwudev opened this issue 10 years ago • 10 comments

The PlatformServices.Default.Runtime.RuntimeVersion is wrong, that value is 4.0.0.0. But infact,it shoud be 1.0.0-preview1-*.

The code is here

RuntimeVersion = typeof(object).GetTypeInfo().Assembly.GetName().Version.ToString();

jeffwudev avatar May 28 '16 01:05 jeffwudev

Thats probably because RuntimeVersion is referring to the CLR version. I.E. .NET Framework 4.0.0.0

BrennanConroy avatar May 28 '16 06:05 BrennanConroy

@jeff-wu Do you see that when you target net4* or netcoreapp? (i.e. desktop CLR or CoreCLR?)

muratg avatar Jun 01 '16 17:06 muratg

@muratg My target is netcoreapp, and run on Ubuntu14.04 that is a clean system. I used dotnet build -r ubuntu.14.04-x64 -c release to build, and dotnet publish -r ubuntu.14.04-x64 -c release to publish.

My code:

var env = Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default;
string str = env.Runtime.RuntimeType + "-" + env.Runtime.RuntimeVersion;

The str value is always CoreCLR-4.0.0.0 on my ubuntu and win10 computers.

project.json:

{
  "version": "1.0.0",

  "dependencies": {
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
    "Microsoft.NETCore.App": {
      "type": "default",
      "version": "1.0.0-rc2-*"
    }
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  },

  "runtimes": { 
    "win10-x64": { },
    "ubuntu.14.04-x64": { }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

jeffwudev avatar Jun 02 '16 00:06 jeffwudev

Thanks for the info. @BrennanConroy Was this part of the API moved over to dotnet?

muratg avatar Jun 02 '16 16:06 muratg

They have System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription which includes a version in the string it returns

BrennanConroy avatar Jun 02 '16 16:06 BrennanConroy

cc @pakrym

muratg avatar Jun 02 '16 16:06 muratg

@BrennanConroy Are we able to retire this repo now that we have the build time dependencies elsewhere?

muratg avatar Jun 09 '16 17:06 muratg

No, because the ApplicationEnvironment stuff is still used

BrennanConroy avatar Jun 09 '16 17:06 BrennanConroy

@BrennanConroy where? Those can't be moved to the common repo with a source package?

muratg avatar Jun 09 '16 20:06 muratg

Closing as this API was removed from platform abstractions and we have removed usages of this package from the rest of our stack.

natemcmaster avatar Apr 26 '17 19:04 natemcmaster