Feature Request: Make `SolutionFile.FullPath` a `public` property
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
Hello,
My team has an internal NuGet package that often modifies `.csproj` files. I'm trying to see if we can leverage `Microsoft.Build` there. During the investigation, I noticed that [`FullPath` is an `internal` property of `SolutionFile`](https://github.com/dotnet/msbuild/blob/main/src/Build/Construction/Solution/SolutionFile.cs#L201-L231). Although the consumer would know the path in order to instantiate a `SolutionFile` in the first place, it makes it very clunky to pass around solution information if a different part of the code also needs to know the solution path.
```cs
using Microsoft.Build.Construction;
// Currently, you can't figure out the solution path inside this method
public void DoSomethingWithSolution1(SolutionFile solutionFile) { }
// Clunky to pass both `SolutionFile` and `string`; indicates that encapsulation has been done poorly
public void DoSomethingWithSolution2(SolutionFile solutionFile, string solutionPath) { ... }
// The caller can also instantiate a `SolutionFile` from the path, but this isn't DRY
public void DoSomethingWithSolution3(string solutionPath)
{
// likely repeated
var solution = new SolutionFile(solutionPath);
...
}
```
I believe `FullPath` should be made `public` so that `SolutionFile` properly encapsulates all necessary data.
1. Why was `FullPath` not `public` in the first place?
2. Can it be made `public`?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/Build/Construction/Solution/SolutionFile.cs, at the FullPath property referenced by the issue. Check nearby API conventions and existing SolutionFile coverage before confirming the public surface change; done means consumers can read the solution's full path through the SolutionFile instance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100