-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtimeconfig.json contains incorrect framework version #686
Comments
This one works for me:
Best documentation seems to be the comment by @dsplaisted |
Yes RuntimeFrameworkVersion is what gets put into runtimeconfig.json and it is inferred based on the TFM with the idea that hostpolicy would roll forward to the latest path version installed. |
runtimeconfig version should contain the resolved package version of Microsoft.NETCore.App. Inferring the version from TFM is too naïve: it doesn't account for:
|
Isn't 1.0.* correct here? The 1.1.0 NuGet package contains different references for |
If the intent is to preserve how project.json built and run, then no, current implementation is wrong. Ms.NETCore.App 1.1.0 + netcoreapp1.0 TFM in project.json produces 1.1.0 in the runtimeconfig.json file. If the intention is to change this behavior of project.json, then dotnet-migrate needs to be made aware of this or it should be an error to reference 1.1.0 package in the netcoreapp1.0 TFM. Otherwise, projects will start running on .NET Core 1.0 instead of 1.1 after upgrading. cc @piotrpMSFT @livarcocc |
So it possibly compiles against the 1.0.* assemblies and runs on 1.1.0? That seems weird.. especially when you can explicitly select .net core 1.0 from UI dialogs now.. |
…, not TFM Workaround dotnet/sdk#686
Removing 'Blocking partner' label. We unblocked ourselves by adding custom targets to set RuntimeFrameworkVersion based on the package version of Microsoft.NETCore.App instead of TFM, but IMO this is still a serious bug that we should fix by RTM. |
…, not TFM Workaround dotnet/sdk#686 Also, fix casing of the serviceable assembly attribute
Keeping blocking Partner label, as we'd like to remove workarounds for RTM. |
This causes some pretty awful side effects for semi-complex test projects. If you happen to utilize a type in a Microsoft.NETCore.App that doesn't match the one in runtimeconfig.json then
Overall horribad for end-users. For those curious, associated bug from vstest to flow error messages better: microsoft/vstest#281 |
The intent of how this works is:
The logic for how this works is described here. Basically:
I think this addresses most of the issues raised. From @natemcmaster's list:
If roll-forward is disabled, then you can specify a specific patch version with the
Some users understood what the
We would like to hide updates to the implicitly referenced packages from the NuGet UI, or not show them in that UI at all. I believe we are planning to do this for RTM.
This isn't well supported currently. Who outside of Microsoft would you expect to want to float the version of Microsoft.NETCore.App used?
Microsoft.NETCore.App should be (and I believe it is) authored so that if you are targeting netcoreapp1.0, then the 1.1.0 and 1.0.x versions of the package will give you get the same references, assets, etc. So I don't think there are side effects based on this.
We have dotnet/cli#5346 for dotnet-migrate to handle this correctly.
Generally this should be the other way around: Just set the RuntimeFrameworkVersion property and the package version will be implied from that. If you are trying to float the package version I can see that it's not that simple though.
If I'm understanding correctly, I think that this is improved with the current behavior. In RC1 or RC2, we had a bunch of people that upgraded the Microsoft.NETCore.App package to 1.1.0, and their project then failed to run because it now depended on the 1.1 runtime, which wasn't installed. They didn't realize that upgrading the package had that effect. This sounds similar to the test issue you linked to. Now people generally won't be accidentally taking a dependency on a new version of the runtime in their projects. It also helps that the tooling is now going to include both versions 1.0 and 1.1 of the runtime. |
I understand the rationale behind these changes, yet at the moment projects that ran without issues in RC2, simply do not, throwing this error:
The overall experience is not really satisfying... Consider this example, that worked fine in RC2: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.2.0-*" />
</ItemGroup>
</Project> I am creating a console application targeting some pre-release versions that require If we use the same approach now, no warning is issued and the application fails to run. Using <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<DisableImplicitFrameworkReferences>True</DisableImplicitFrameworkReferences>
</PropertyGroup>
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.2.0-*" />
</ItemGroup>
</Project> produces the following result:
Using the <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<NetCoreAppImplicitPackageVersion>1.2.0-*</NetCoreAppImplicitPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.2.0-*" />
</ItemGroup>
</Project> does not complain during compilation, but project still fails to run with aforementioned error. Finally, thanks to the details in these comments, I could produce a working solution: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeFrameworkVersion>1.2.0-beta-001304-00</RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.2.0-*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.2.0-*" />
</ItemGroup>
</Project> but this is definitely not intuitive, since I have no error to determine which runtime I should actually specify. Moreover, consider that RC3 still allows to update |
Re @dsplaisted: I'm on board with the UX goals you described. But the current implementation is buggy.
Anyone wanting to build nightlies on .NET Core. @BladeWise is at least one. I'm sure there are more.
Actually, we saw a real-life example of this side effect. We referenced Microsoft.NETCore.App 1.2.0-* on netcoreapp1.1 TFM. Because deps.json is trimmed from project.assets.json our tests failed to run with this error: " I expect this will continue to break in unexpected ways as deps.json dependency trimming is based on NuGet package resolution (...which is again, based on the resolved Microsoft.NETCore.App package version).
This will be an issue when we want to release Microsoft.NETCore.App 2.0.0-preview1. It is okay to infer PackageReference version from TFM, but not okay to infer runtimeconfig version from TFM. |
…604.23 (dotnet#686) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19304.23
…, not TFM Workaround dotnet/sdk#686 Also, fix casing of the serviceable assembly attribute
Repro:
dotnet restore
dotnet build
Expected
lib/Debug/netcoreapp2.0/myapp.runtimeconfig.json should contain
Actual
Details
Using CLI: 1.0.0-rc3-004517
Happens even when
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
is added.The text was updated successfully, but these errors were encountered: