Skip to content
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

nuget-client fails to build due to missing dependencies in 9.0.0-preview.3 #4333

Closed
corngood opened this issue Apr 17, 2024 · 9 comments
Closed
Assignees
Labels
area-build Improvements in source-build's own build process untriaged

Comments

@corngood
Copy link

As discussed at NuGet/NuGet.Client#5673 (comment)

I'm trying to build VMR 9.0.0-preview.3, and I'm getting:

./build.sh --online --with-packages [artifacts] --clean-while-building --release-manifest [manifest] --source-build -- -p:PortableBuild=true -p:SkipErrorOnPrebuilts=true

artifacts/source-built-sdks/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj(12,3): error MSB4019: The imported project "src/nuget-client/artifacts/sb/package-cache/microsoft.dotnet.sourcebuild.tasks/9.0.0-beta.24165.6/build/Microsoft.DotNet.SourceBuild.Tasks.props" was not found. Confirm that the expression in the Import declaration "src/nuget-client/artifacts/sb/package-cache/microsoft.dotnet.sourcebuild.tasks/9.0.0-beta.24165.6/build/Microsoft.DotNet.SourceBuild.Tasks.props" is correct, and that the file exists on disk.

Which seems like it might be somehow related to this change. artifacts/sb/package-cache/microsoft.dotnet.sourcebuild.tasks has not been restored, and I'm currently trying to understand why.

As an experiment, if I do this:

--- a/src/nuget-client/eng/source-build/source-build.proj
+++ b/src/nuget-client/eng/source-build/source-build.proj
@@ -68,6 +68,11 @@
       <_AfterSourceBuildProperties Include="ArcadeInnerBuildFromSource=true"/>
     </ItemGroup>

+    <MSbuild Projects="$(ArcadeDir)/Build.proj"
+             Properties="@(_CommonProperties);Restore=true;Build=false;Pack=false;Publish=false;Rebuild=false;Test=false;IntegrationTest=false;PerformanceTest=false;PreventPrebuiltBuild=false;BaseInnerSourceBuildCommand=echo skipping internal build with args: "
+             Targets="Execute"
+            />
+
     <MSbuild Projects="$(ArcadeDir)/SourceBuild/AfterSourceBuild.proj"
              Properties="@(_AfterSourceBuildProperties)"
              Condition="'$(DotNetBuildOrchestrator)' == 'true'" />
@@ -113,4 +118,3 @@

It actually does restore the package, and it gets a bit further:

/home/david/src/nixpkgs/tmp/dotnet-9.0.0-preview.3.24172.9/artifacts/source-built-sdks/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj(68,3): error MSB4019: The imported project "/home/david/src/nixpkgs/tmp/dotnet-9.0.0-preview.3.24172.9/src/nuget-client/artifacts/sb/package-cache/microsoft.dotnet.build.tasks.feed/9.0.0-beta.24165.6/build/Microsoft.DotNet.Build.Tasks.Feed.targets" was not found. Confirm that the expression in the Import declaration "/home/david/src/nixpkgs/tmp/dotnet-9.0.0-preview.3.24172.9/src/nuget-client/artifacts/sb/package-cache/microsoft.dotnet.build.tasks.feed/9.0.0-beta.24165.6/build/Microsoft.DotNet.Build.Tasks.Feed.targets" is correct, and that the file exists on disk.

@MichaelSimons
Copy link
Member

@NikolaMilosavljevic, can you take a look? TIA

@NikolaMilosavljevic
Copy link
Member

@corngood I wanted to confirm the repro steps. According to the comment in the linked issue, you are doing P1 build. You should not be need --with-packages switch.

Has the same command worked before, i.e. with Preview 2 VMR?

@corngood
Copy link
Author

Has the same command worked before, i.e. with Preview 2 VMR?

Yeah, it works in 8.0 and 9.0 preview 2. If I leave it out, won't it pull all dependencies from nuget?

@NikolaMilosavljevic
Copy link
Member

Has the same command worked before, i.e. with Preview 2 VMR?

Yeah, it works in 8.0 and 9.0 preview 2. If I leave it out, won't it pull all dependencies from nuget?

OK, I see, you're using --online. Where are the packages in --with-packages switch coming from?

@corngood
Copy link
Author

OK, I see, you're using --online. Where are the packages in --with-packages switch coming from?

Borrowing what I posted in the other thread...

It's actually just unpacked Private.SourceBuilt.Artifacts.9.0.100-preview.3.24166.1.centos.8-x64.tgz, and I'm attempting to build for linux-x64.

I'm working on the nixpkgs derivation for the VMR, and we sort of do three phases:

  1. build using the binary sdk release, and --online in order to gather missing online dependencies (currently just portable versions of ilasm/dasm I believe)
  2. sandboxed (offline) build using the binary sdk, without --online, but with the dependencies gathered in (1)
  3. sandboxed build using only the output of (2)

In this case I'm working on (1).

@NikolaMilosavljevic
Copy link
Member

@corngood did you run ./prep-source-build.sh command first? If you run it without any switches, it will download packages and SDK - you would not need to specify --with-packages in your build command. You could also run prep command with --no-artifacts switch, and continue to use your build command as is.

I could not repro this issue locally when I used prep command and the exact command you used.

@corngood
Copy link
Author

@NikolaMilosavljevic

I think I might have found out why only I can reproduce this:

We have a patch to set NUGET_PACKAGES=$(ProjectDirectory)artifacts/sb/package-cache/ when building nuget-client, in order to keep dependencies in a consistent location with the other repos. This is something we've been using since 8.0.

I think that's actually the issue described in #4293. In fact, the comment in that thread:

this could result in build order issues with the now enabled parallel builds

is probably exactly what I'm seeing. NuGet/NuGet.Client#5756 may still be required once that issue is fixed.

This is specifically how I'm making the environment variable change:

            xmlstarlet ed \
              --inplace \
              -s //Project -t elem -n ItemGroup \
              -s \$prev -t elem -n EnvironmentVariables \
              -i \$prev -t attr -n Include -v 'NUGET_PACKAGES=$(ProjectDirectory)artifacts/sb/package-cache/' \
              repo-projects/nuget-client.proj

i.e. adding <ItemGroup><EnvironmentVariables Include="NUGET_PACKAGES=$(ProjectDirectory)artifacts/sb/package-cache/"... to repo-projects/nuget-client.proj.

Sorry for the confusion.

@NikolaMilosavljevic
Copy link
Member

Thanks @corngood - that makes sense. I'll play with this.

It would also be great to understand if you run any prep commands before the build command. Having an exact set of repro steps would definitely help.

@corngood
Copy link
Author

Oh, sorry. I can still reproduce the problem if I run ./prep-source-build.sh --no-artifacts --no-prebuilts --with-packages [artifacts] before the build.

I'm going to close this issue, since I seem to have caused it myself, and follow up on #4293.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-build Improvements in source-build's own build process untriaged
Projects
Archived in project
Development

No branches or pull requests

3 participants