PlatformServices.Default.Runtime.RuntimeVersion is wrong.
The PlatformServices.Default.Runtime.RuntimeVersion is wrong, that value is 4.0.0.0. But infact,it shoud be 1.0.0-preview1-*.
RuntimeVersion = typeof(object).GetTypeInfo().Assembly.GetName().Version.ToString();
Thats probably because RuntimeVersion is referring to the CLR version. I.E. .NET Framework 4.0.0.0
@jeff-wu Do you see that when you target net4* or netcoreapp? (i.e. desktop CLR or CoreCLR?)
@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%" ]
}
}
Thanks for the info. @BrennanConroy Was this part of the API moved over to dotnet?
They have System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription which includes a version in the string it returns
cc @pakrym
@BrennanConroy Are we able to retire this repo now that we have the build time dependencies elsewhere?
No, because the ApplicationEnvironment stuff is still used
@BrennanConroy where? Those can't be moved to the common repo with a source package?
Closing as this API was removed from platform abstractions and we have removed usages of this package from the rest of our stack.