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

SingleFileGenerator only works for old-style projects, not for SDK projects #290

Open
peter-sabath opened this issue Apr 19, 2024 · 0 comments

Comments

@peter-sabath
Copy link

Installed products

Visual Studio 2022 Community

Description

I have a SingleFile generator that works fine for old-style projects, but does not get executed for SDK-style projects (.NET 8)
The package has those CodeGenerator-related attributes:

[ProvideCodeGenerator(typeof(BuildTextConsts), BuildTextConsts.Name, BuildTextConsts.cCustomToolDescription, true, ProjectSystem = ProvideCodeGeneratorAttribute.CSharpProjectGuid, RegisterCodeBase = true)] [ProvideCodeGeneratorExtension(BuildTextConsts.Name, BuildTextConsts.cDefaultExtension)]

I also added the custom command from your Single-File Generator example to add/set the custom build tool entry.
The command gets executed for both project styles, but the generator is only used for old-style projects.

As the availability is only declared via Attributes I have no idea how to debug this and find a reason why it does not work for SDK-style projects.

Because the SDK style projects are projects that were migrated from older when migrating from .NET Framework to .NET 8 I also tried it with clean, empty projects of both styles with the same result.

Expected behavior

Should work with both types of projects

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