Created
March 13, 2025 16:44
-
-
Save rezanid/dfce9bcfb047c50583f5b58bd2a665d1 to your computer and use it in GitHub Desktop.
How to get a project property in a Visual Studio Custom Tool aka Single File Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ACustomCodeGenerator : BaseCodeGeneratorWithSite | |
| { | |
| private string? GetProjectProperty(string propertyName) | |
| { | |
| ThreadHelper.ThrowIfNotOnUIThread(); | |
| return GetService(typeof(IVsHierarchy)) is IVsHierarchy hierarchy ? hierarchy.GetProjectProperty(propertyName) : null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment