Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant