Skip to content

Conversation

@paul-hammant
Copy link

… nuget packages

I'm simulating google's in-house monorepo and have made a rudimentary build system that doesn't rely on .sln or .csproj files. I've Java, Rust, Go and Kotlin in the trunk, and in a branch that I'll merge in when I can C# components and applications. Here's that running a hacky test-runner - https://github.com/paul-hammant/google-monorepo-sim/blob/dot_net_app_and_components_wip/csharptests/components/greek/GreekTests.cs

From that source:

#:package Shouldly 4.3.0
#:library ../../../target/components/greek/bin/components_greek.dll

The Shouldly package from nuget as the preview-4 supports
And a library from a relative (prior) build step.

This works for me in that solution. At least, I've other problems from juggling multiple versions of dotnet, but both of those acquisitions load OK.

I think proper tests go into test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs or
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs or both. I'll add those to the PR unless the team says "never happening"

@Copilot Copilot AI review requested due to automatic review settings May 31, 2025 18:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for referencing local libraries in dotnet CLI commands through a new "library" directive when building virtual projects.

  • Introduces filtering and handling for library directives in project file generation.
  • Adds a new Library class with parsing logic for validating the library path.
  • Updates the XML output to include library references.
Comments suppressed due to low confidence (1)

src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs:617

  • [nitpick] Consider reviewing and standardizing the indentation in the multi-line string literals to ensure that the resulting XML is formatted as intended.
writer.WriteLine("""

                  <ItemGroup>
                """);

@paul-hammant
Copy link
Author

@dotnet-policy-service agree [company="Currently unemployed"]

Yes, I'm happy to grant y'all copyright in respect of this PR

@paul-hammant
Copy link
Author

@dotnet-policy-service agree

@paul-hammant
Copy link
Author

OK, so test.sh seems to run and run - still gaining understanding of test-tech in repo.

@paul-hammant
Copy link
Author

OK, copilot (via the web UI) offers advice if I paste in a dumped .csproj file. I've been round and round in circles and can't get past

/path/to/my/source.cs(13,18): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.

I've tried everything it suggested: https://pastebinrichtext.com/paste/f5afd97c-0a54-490e-9218-037a8a6220a1

Some things being reported as errors make no sense. No, I'm not including GreekTests twice.

I've added a temp dump of the in-memory .csproj file
image, but interestingly for a dotnet run sourcefile.cs it is going through that twice. I could dump out stack traces I get. Apols for the old fashioned debugging.

And a recap on my proximate cause: If if only have #:package (per preview 4) it all works fine. If I ALSO add #:library all the core typedefs are gone, and my attempts to code around that are getting nowhere.

@jogibear9988
Copy link

I would love this to land....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants