Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmbedAllSources causes T4 sources to fail compliation #942

Open
yfital opened this issue Jan 25, 2023 · 0 comments
Open

EmbedAllSources causes T4 sources to fail compliation #942

yfital opened this issue Jan 25, 2023 · 0 comments

Comments

@yfital
Copy link

yfital commented Jan 25, 2023

I hope I'm reporting this in the correct repo.

We're running a project which contains TextTemplatingFilePreprocessor generations.
As we are generating a lot of code, I've added the EmbedAllSources flag to our projects and I began seeing this issue:

#line 1 "C:\Gitworkspace\S6_3\pc\Src\PressSDK\CodeGenerators\Press\Buzzerable\BuzzerableManagers\Templates\BuzzerableManagerInterfacesGenerator.tt"

For the generated files, for example:

/// <summary>
    /// Class to produce the template output
    /// </summary>
    
    #line 1 "C:\Gitworkspace\S6_3\pc\Src\PressSDK\CodeGenerators\Press\Buzzerable\BuzzerableManagers\Templates\BuzzerableManagerInterfacesGenerator.tt"
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
    public partial class BuzzerableManagerInterfacesGenerator : BuzzerableManagerInterfacesGeneratorBase
    {
#line hidden
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
    

(The issue appears for all generated files' line pragma)

The issue is, that we do NOT generate the files during build (as there are other bugs there :) ) meaning, we generate & TT's output generation in source control

So the problem is that the #line is pointing toward the last person who generated the generated file, meaning, I will not have it on my computer while building.

Without EmbedAllSources, there is no issue.

To reproduce, create any file with a #line pragma pointing toward an invalid path and activate the flag

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

No branches or pull requests

1 participant