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

Preprocessor directives within comments are also getting processed while invoking the dotnet new command #541

Open
egvijayanand opened this issue Aug 16, 2021 · 0 comments

Comments

@egvijayanand
Copy link

egvijayanand commented Aug 16, 2021

Preprocessor directives within comments are also getting processed while invoking the dotnet new command.

I have got a commented preprocessor directives available as part of the class, as documentation, to let the users know that they can segregate code that way to make it work cross-platform.

But it is not available as part of the output after running the dotnet new command.

Whatever portion that is commented out in the original source, should be retained as it is.

Sample code:

namespace MauiClassLib
{
    public class Class1
    {
        // Use the below block to segregate code that works cross-platform.
//#if ANDROID
        // Code block for Android
//elif IOS
        // Code block for iOS
//#elif MACCATALYST
        // Code block for Mac Catalyst
//#elif WINDOWS
        // Code block for Windows
//#endif
    }
}

Output after running the command:

namespace MauiClassLib
{
    public class Class1
    {
        // Use the below block to segregate code that works cross-platform.
    }
}
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