CommunityToolkit / Tooling-Windows-Submodule

Community Toolkit infrastructure for use as a submodule 'tooling' directory in other repositories.
Other
30 stars 10 forks source link

Investigate Template Parameters #65

Open michael-hawker opened 2 years ago

michael-hawker commented 2 years ago

Investigate if the https://github.com/dotnet/templating system allows us to pass in parameters to modify the generation.

Default would still be everything included.

We'd want to have a flag which can either:

Arlodotexe commented 2 years ago

(remove PackageIdVariant and MultiTarget lines from csproj)

note that removing PackageIdVariant complete will result in a package name CommunityToolkit.Labs..ProjectName.

If we're removing it instead of replacing, that will need to be fixed in the .csproj. Should be doable with built-in msbuild string checks.

michael-hawker commented 2 years ago

@Arlodotexe yes, I mean we'd modify the csproj file to remove that and the dot vs. trying to do it automatically.

I imagine in the template we'd have something like:

#if <template parameter for dotnet project in whatever special syntax this is>
<PackageId>CommunityToolkit.Labs.ProjectTemplate</PackageId>
#else
<PackageId>CommunityToolkit.Labs.$(PackageIdVariant).ProjectTemplate</PackageId>
#endif
mrlacey commented 2 years ago

This should be fairly straightforward. Just need to determine what needs to be optional.

Is there an issue related to the work that will necessitate this?:

generate a .NET Standard source library/unit test project instead (remove PackageIdVariant and MultiTarget lines from csproj)

For reference:

michael-hawker commented 2 years ago

Cool, so doesn't look like we could do an explicit directive in a csproj file, but there is config in the json to swap out specific files or directories based on the condition, so that's good to know.

The .NET Standard stuff came out of the meeting this morning and talking more about how the repo could support general .NET helpers vs. WinUI specific stuff. It's definitely a more future facing part of this, but certainly something that would need to be more clearly defined.

I think the main changes would be when enabled:

@Arlodotexe I know shared projects aren't ideal, but I think we'd still want to have it setup that way for consistency with other experiments? Anything else I miss?