Comments (6)
Can static graph restore pass the list of ProjectReferences from the metaproj to the restore task?
Yes, its technically possible to pass all of the necessary information along. I'm hesitant to implement it that way because we already have issues streaming global properties to the other process. I'd feel a lot more comfortable just passing the full path to the SLNF to the process instead.
from home.
Team Triage: @jeffkl what would be the cost of fixing this?
from home.
Unfortunately, MSBuild does not expose the path to the solution filter during the build (dotnet/msbuild#6162). The way it currently works for regular restore is that MSBuild generates an in-memory .metaproj
that contains a <ProjectReference />
to just the projects to build. Regular restore then walks those projects.
For static graph-based restore, MSBuild only passes along the path to the solution file and the path to the in-memory .metaproj
:
For regular restore, since its running in the same process it has access to the in-memory .metaproj
. Since static graph-based restore runs out-of-proc, it would need to either write the .metaproj
to disk or pass along the path to the solution filter instead. It could also use reflection to get the path to the solution filter:
object buildRequest = BuildEngine.GetType().GetField("_requestEntry", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(BuildEngine);
object buildRequestConfiguration = buildRequest.GetType().GetProperty("RequestConfiguration", BindingFlags.Public | BindingFlags.Instance).GetValue(buildRequest);
string solutionFilterFileFullPath = buildRequestConfiguration.GetType().GetProperty("ProjectFullPath", BindingFlags.Public | BindingFlags.Instance).GetValue(buildRequestConfiguration) as string;
So we need to either:
- Update MSBuild to indicate the path to the solution filter being restored
- Use reflection to get the path to the solution filter being restored
from home.
We use reflection in nuget.exe, but the bar is arguably lower there: https://github.com/NuGet/NuGet.Client/blob/d7607e2f08721498801ace7fe47933d4e6dfeffd/src/NuGet.Clients/NuGet.CommandLine/Common/Solution.cs#L120.
from home.
Can static graph restore pass the list of ProjectReferences from the metaproj to the restore task?
It's not perfect, because:
- sln based restore will pass the full list of projects, and then waste CPU time filtering the list to what ends up being the full list of projects
- slnf based restore will have MSBuild evaluate the full solution, but then NuGet will ignore all the projects not part of the filter
but at least there will be fewer projects that need to resolve the package graph, hopefully fewer packages to download, etc.
from home.
I agree getting the slnf path is the ideal solution.
I'm just a bit worried about using reflection to get a non-public property. If MSBuild makes a change that breaks static restore, it might take us a while to notice. After all, our dev branch will be inserted into the 8.0.3xx SDK, but our build scripts are still testing against a pre-release 8.0.1xx SDK build. Therefore, our own CI pipeline wouldn't even detect the break.
Sending the long list of projects feels like a lower risk temporary solution, while we wait for MSBuild to make the request, and slnf path, a public API.
from home.
Related Issues (20)
- MSB4018 When using central package managing and package is not specified in Directory.Packages.props HOT 6
- `dotnet list package` does not work if project is using central package management system, after upgrading to `.NET 8.0` HOT 4
- Add opt-in warning/error to require a package readme file
- Bubble-up Known Vulnerability Indicators in Solution Explorer for Transitive Packages
- [Bug Bash] Punctuation located incorrectly in the bottom-text of the “License Acceptance” dialog HOT 7
- Make 'why' command available in NuGet.Commands HOT 1
- [Localization] Revert latest changes from 6.11.x branch HOT 1
- Error NU1301 instead of "TLS validation failed" displays when running ‘dotnet restore’ before TLS certificate validation is disabled HOT 9
- dotnet add package stops checking sources on the first failure http code HOT 2
- Can not install signed package with certificate chain building issue HOT 2
- Fetching Vulnerability Resources doesn't respect cancellation HOT 1
- Improve the PM UI (especially update) experience for CPM transitively pinned packages
- PERF: NuGet Cloning operations are showing heavily in allocations during VS solution load
- Consider offering snapshot functionality as an alternative to lock files HOT 2
- Machine readable output for 'why' command
- [Cross-platform Dotnet NuGet Sign] Adding trust for a certificate leads to an error SYSLIB5007 for .NET SDK 9.0.1xx HOT 1
- [Cross-platform Dotnet NuGet Sign] The error “invalid value for’--certificate-fingerprint’ option” displays instead of error NU3001 when signing with certificate search criteria yields no certificate matches HOT 1
- Publish error: `Found multiple publish output files with the same relative path` for `packages.loc.json` files. HOT 1
- Coud you reference a bug in the docs, please?
- [Tech Debt] Improve test for XPlatHelpOutputTests.cs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from home.