Skip to content

[Bug] Generated source files can't be embedded by Source Link #2297

@bording

Description

@bording

When using Source Link with EmbedUntrackedSources set to true, any generated source files that aren't committed to the repo are supposed to be embedded in the PDB instead.

However, GitVersionInformation.g.cs is not being embedded despite being a generated file.

This is happening because the target that creates it is running too late for Source Link to know that it needs to embed it.

FYI this was also a problem for the AssemblyInfo.cs generated by the .NET Core SDK, and was fixed for that file in the 3.1.300 SDK.

Expected Behavior

Source files generated by GitVersion should be embedded in the PDB when using Source Link.

Actual Behavior

The files are not embedded in the PDB.

Fix

The UpdateAssemblyInfo and GenerateGitVersionInformation targets should have BeforeCompile added to their BeforeTargets attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions