-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
coreclr build failure: Unable to find package Microsoft.AspNetCore.App.Runtime.win-arm #185
Comments
I've seen this in the CoreCLR repo when I've had a 5.0.0 SDK installed on my machine when trying to build. Never quite figured out the underlying issue, but uninstalling the 5.0.0 SDK, deleting the artifacts folder, and deleting the |
Why do we depend on |
fwiw, I do have dotnet SDK version |
We don't actually depend on it AFAIK. If I remember from my last investigation, for some reason the 5.0.100-* SDK had been grabbed at some point (restore time maybe) and left artifacts around about which FrameworkReferences it had installed. When publishing crossgen2, the 3.0.100 SDK can't find those FrameworkReferences (rightly so) and gets confused (as shown above). |
I believe this is because the preview SDKs reference all KnownFrameworkReferences directly. Actually if you look at the docs in the dogfooding of the SDK they suggest adding some restore sources. https://github.com/dotnet/core-sdk#installers-and-binaries What we can do is remove the AspNetCore and WIndows.Desktop KnownFrameworkReferences. runtime/src/libraries/pkg/test/frameworkSettings/netcoreapp5.0/settings.targets Lines 32 to 33 in 6492892
Also, note that it is the recommendation that you set |
Shouldn't our build scripts do that? E.g., |
Yeah, they should. It seems like https://github.com/dotnet/runtime/blob/master/eng/common/tools.ps1#L107 So then there something else wrong here that we should investigate. @ericstj might have some ideas. |
/cc @dsplaisted I believe this behavior is expected. The CLI will download these if you don't have them installed and build a standalone app. @safern pointed out how we turn this off for our package testing. |
@safern I notice in
So that path to invoking dotnet CLI sets it also. So what is the fix? |
If you don't want the CLI to download these, you need to remove the |
@ericstj I guess I don't understand: why should my global SDK install have any impact whatsoever on my product build? And do you mean remove these lines from src\libraries\pkg\test\frameworkSettings\netcoreapp5.0\settings.targets?
because when you write "If you don't want the CLI to download these, you need to remove the KnownFrameworkReference items", it looks to me like those lines, already using "Remove=" syntax, is already going to "remove the KnownFrameworkReference items" -- but I really have no idea what I'm looking at or talking about here. |
No, I mean, if you want to restore a self-contained project like https://github.com/dotnet/runtime/blob/master/src/coreclr/tests/src/Common/test_dependencies/test_dependencies.csproj you need to remove the KnownFrameworkReference items yourself, just like we do in our own package testing to avoid the same problem. You'll probably hit this whenever you use a 3.0 or later SDK to restore a self-contained netcoreapp3.0 project, so even if it wasn't something you had to worry about before because you were using an old SDK, you should address it. The fix would be to add those remove items to that test_dependencies.csproj or some common targets file as appropriate. Specifically, copy the following and dump it in that project. <ItemGroup>
<KnownFrameworkReference Remove="Microsoft.AspNetCore.App" />
<KnownFrameworkReference Remove="Microsoft.WindowsDesktop.App" />
</ItemGroup> The fact that your build happens to be using the machine wide SDK is because you're launching the restore here: runtime/src/coreclr/build-test.cmd Lines 295 to 300 in 82d1049
Which uses the dotnet found by the arcade tools: Line 397 in 82d1049
I believe it is expected that the arcade tools choose either the local install or machine wide, depending on what satisfies the version listed in global.json. |
Also, the reason why this might appear to come and go is that the restore will only be necessary once. After the SDK successfully downloads those runtime packs, it will no longer complain. The version that it needs ends up being tied to the version of the SDK in the global.json. The right fix is to disable this part of the SDK's download using the snippet I shared above. You might do it here, just in case you restore any other projects in this way: https://github.com/dotnet/runtime/blob/64928927e67f48ade7cbb3fc972c3901a5f5696f/src/coreclr/tests/src/Common/Directory.Build.targets |
The restore for the projects under runtime/src/coreclr/tests/build.proj Lines 50 to 57 in 82d1049
|
This seems to be the root of the problem; why would we ever want the machine-wide install? tools.ps1 has:
shouldn't we force |
We specify the version of the dotnet that we want in global.json. So if arcade finds that version installed machine wide, in order to have a faster build, it doesn't install it under .dotnet, it just uses the global one. However, we also specify in the global.json to allow rolling forward of the sdk for a major version change, so that's why it is picking the new SDK in your machine. This is to allow people building on VS and having a newer SDK installed (without forcing them to install the exact version we depend, machine wide). Lines 3 to 5 in 82d1049
I think it makes sense to add the lines I shared to remove KnownFrameworkReferences into the common tests |
I also want to point out that machine wide vs local is red herring. That has nothing to do with the error you are seeing, other than the fact that the version of the SDK determines the version of the runtime packs it tries to install. |
After @BruceForstall and @safern and I chatted offline we agreed to do the following:
As part of looking into 2, I found that the SDK resolver should actually prefer the closest match: https://github.com/dotnet/core-setup/blob/27063871b42e5c4ee80b8953ebafecb98381d39e/src/corehost/cli/fxr/sdk_resolver.cpp#L376-L400 When I tried this I did observe that behavior. This was a recent change dotnet/core-setup#6953 (/cc @peterhuene @vitek-karas), so its possible the sdkresolver bits you had did not have this fix. Looking at the version of the SDK you had it is 5.0.0-alpha1.19470.6. I believe this build would have fallen in the window where the 5.0 SDK was lagging behind 3.0 and 3.1, I bet if you update to a newer 5.0 machine wide SDK you'll get @peterhuene's feature that handles rollForward and the issue will also go away. Net result: 2 and 3 should not be needed here. If other folks hit this for early builds of the 5.0 SDK then update to the latest 5.0 SDK to get a fix. |
Merge runtime/master into feature/NativeAOT
In a clean
runtime
clone, I runsrc\coreclr\build.cmd skipbuildpackages
(usingskipbuildpackages
to get around #181) and after the native test components build, the build fails with:@dotnet/runtime-infrastructure
The text was updated successfully, but these errors were encountered: