dotnet / dotnet/roslyn

Add GeneratedFilesOutputDirectory to Solution APIs

Open
#75,389 1 comment 0 reactions 1 assignee Claimed by @tmat View on GitHub
api-approved Area-IDE blocking Concept-API
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

## Background and Motivation

Add APIs to the Project and Solution that expose the value of `CompilerGeneratedFilesOutputPath` msbuild property from the solution snapshot.

See https://github.com/dotnet/roslyn/issues/75387

## Proposed API

```diff
public readonly struct CompilationOutputInfo
{
public string? AssemblyPath { get; }

+ public string? GeneratedFilesOutputDirectory { get; }
+ public CompilationOutputInfo WithGeneratedFilesOutputDirectory(string? path);
}
```

## Usage Examples

## Alternative Designs

```diff
namespace Microsoft.CodeAnalysis;

public class Project
{
+ ///
+ /// The path to the root directory of source generated files, or null if it is not known.
+ ///
+ public string? GeneratedFilesOutputDirectory { get; }
}

public class ProjectInfo
{
+ public string? GeneratedFilesOutputDirectory;
+ public ProjectInfo WithGeneratedFilesOutputDirectory(string? path);
}

public class Solution
{
+ public Solution WithProjectGeneratedFilesOutputDirectory(ProjectId projectId, string? path);
}

public class Workspace
{
+ protected internal void OnGeneratedFilesOutputDirectoryChanged(ProjectId projectId, string? outputFilePath);
}
```

## Risks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.