Skip to content

Add control library templates #1005

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

Merged
20 commits merged into from
Jul 22, 2019
Merged

Conversation

jmarolf
Copy link
Contributor

@jmarolf jmarolf commented Jun 18, 2019

@ghost ghost requested review from vatsan-madhavan, rladuca, ryalanms and stevenbrix June 18, 2019 21:50
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Jun 18, 2019
@vatsan-madhavan vatsan-madhavan added the * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) label Jun 19, 2019
@jmarolf
Copy link
Contributor Author

jmarolf commented Jun 19, 2019

@cartermp do we want to add new templates for WPF for 3.0 at this point? Who was the team member from XAML that asked for this?

@cartermp
Copy link

Yes. Control library templates are essential to getting to experience parity with desktop WPF. @vatsan-madhavan this work is critical to landing the full WPF experience, as there are customers who will need access to this library type for .NET Core.

@cartermp
Copy link

Or rather, people aren't technically blocked because they could:

  1. Create a .NET Core 3.0 library project
  2. Add the correct designators to their project file
  3. Add user controls

But this is not the norm for WPF users and certainly wouldn't be the expected experience.

@jmarolf
Copy link
Contributor Author

jmarolf commented Jun 19, 2019

@cartermp can you port dotnet/project-system#4715 to this repo as per their guidelines?

@cartermp
Copy link

I don't have permissions to move the issue. Is copy/paste sufficient?

@stevenbrix
Copy link
Contributor

@cartemp, copy/paste should be good, thank you!

Do these templates have the same expectation of user experience when opened in VS/Blend that is being discussed in #1007?

@jmarolf
Copy link
Contributor Author

jmarolf commented Jun 20, 2019

Moved the bug over here: #1036

This is about having the WPF experience being at parity between .NET Framework and .NET Core

@vatsan-madhavan
Copy link
Member

Were you able to validate that the resultant nuget packages for project tempaltes - both in its structure, and functionally within VS & Blend?

@vatsan-madhavan
Copy link
Member

Are these xcopy'd from .NET framework templates?

@vatsan-madhavan
Copy link
Member

Consider naming the paths WpfUserControLibrary-CSharp rather than WpfControlLibrary-CSharp etc.

@vatsan-madhavan vatsan-madhavan removed the * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) label Jun 27, 2019
@vatsan-madhavan
Copy link
Member

Removing NO MERGE since #1100 is completed and master has switched to Preview 8. This PR can continue on with usual due-diligence.

Copy link
Member

@vatsan-madhavan vatsan-madhavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is something the VS team would like to target for Preview8, we'd like to take this earlier rather than later in the milestone. Working through the changes in the next 1-2 weeks would be ideal.

@cartermp
Copy link

cartermp commented Jul 1, 2019

We definitely want this for Preview 8. Is there anything we can do to help?

@vatsan-madhavan
Copy link
Member

@jmarolf do you have an idea when you expect to have an update addressing feedback?

/cc @chabiss

@jmarolf jmarolf force-pushed the add-control-library-templates branch from c61a848 to c3c2767 Compare July 15, 2019 23:37
@jmarolf
Copy link
Contributor Author

jmarolf commented Jul 16, 2019

@vatsan-madhavan ready for review

@vatsan-madhavan
Copy link
Member

After installing the generated project template package (dotnet new -i Microsoft.DotNet.Wpf.ProjectTemplates::3.0.0-dev --nuget-source C:\src\repos\wpf\artifacts\packages\Debug\Shipping) , I see this, which is mostly good.

Note that WPF user control is missing VB.

`> dotnet new `
Usage: new [options]

Options:
  -h, --help          Displays help for this command.
  -l, --list          Lists templates containing the specified name. If no name is specified, lists all templates.
  -n, --name          The name for the output being created. If no name is specified, the name of the current directory is used.
  -o, --output        Location to place the generated output.
  -i, --install       Installs a source or a template pack.
  -u, --uninstall     Uninstalls a source or a template pack.
  --nuget-source      Specifies a NuGet source to use during install.
  --type              Filters templates based on available types. Predefined values are "project", "item" or "other".
  --dry-run           Displays a summary of what would happen if the given command line were run if it would result in a template creation.
  --force             Forces content to be generated even if it would change existing files.
  -lang, --language   Filters templates based on language and specifies the language of the template to create.
  --update-check      Check the currently installed template packs for updates.
  --update-apply      Check the currently installed template packs for update, and install the updates.


Templates                                         Short Name               Language          Tags                                 
----------------------------------------------------------------------------------------------------------------------------------
Console Application                               console                  [C#], F#, VB      Common/Console                       
Class library                                     classlib                 [C#], F#, VB      Common/Library                       
WPF Application                                   wpf                      [C#], VB          Common/WPF                           
WPF Custom Control Library                        wpfcustomcontrollib      [C#], VB          Common/WPF                           
WPF User Control Library                          wpfcontrollib            [C#]              Common/WPF                           
Windows Forms (WinForms) Application              winforms                 [C#], VB          Common/WinForms                      
Worker Service                                    worker                   [C#]              Common/Worker/Web                    
Unit Test Project                                 mstest                   [C#], F#, VB      Test/MSTest                          
NUnit 3 Test Project                              nunit                    [C#], F#, VB      Test/NUnit                           
NUnit 3 Test Item                                 nunit-test               [C#], F#, VB      Test/NUnit                           
xUnit Test Project                                xunit                    [C#], F#, VB      Test/xUnit                           
Razor Component                                   razorcomponent           [C#]              Web/ASP.NET                          
Razor Page                                        page                     [C#]              Web/ASP.NET                          
MVC ViewImports                                   viewimports              [C#]              Web/ASP.NET                          
MVC ViewStart                                     viewstart                [C#]              Web/ASP.NET                          
Blazor (server-side)                              blazorserverside         [C#]              Web/Blazor                           
ASP.NET Core Empty                                web                      [C#], F#          Web/Empty                            
ASP.NET Core Web App (Model-View-Controller)      mvc                      [C#], F#          Web/MVC                              
ASP.NET Core Web App                              webapp                   [C#]              Web/MVC/Razor Pages                  
ASP.NET Core with Angular                         angular                  [C#]              Web/MVC/SPA                          
ASP.NET Core with React.js                        react                    [C#]              Web/MVC/SPA                          
ASP.NET Core with React.js and Redux              reactredux               [C#]              Web/MVC/SPA                          
Razor Class Library                               razorclasslib            [C#]              Web/Razor/Library/Razor Class Library
ASP.NET Core Web API                              webapi                   [C#], F#          Web/WebAPI                           
ASP.NET Core gRPC Service                         grpc                     [C#]              Web/gRPC                             
dotnet gitignore file                             gitignore                                  Config                               
global.json file                                  globaljson                                 Config                               
NuGet Config                                      nugetconfig                                Config                               
Dotnet local tool manifest file                   tool-manifest                              Config                               
Web Config                                        webconfig                                  Config                               
Solution File                                     sln                                        Solution                             
Protocol Buffer File                              proto                                      Web/gRPC                             

Examples:
    dotnet new mvc --auth Individual
    dotnet new react --auth Individual
    dotnet new --help

When I try to create a control library, it doesn't work. Custom controls get created ok.

λ dotnet new controllib
Couldn't find an installed template that matches the input, searching online for one that does...
Usage: new [options]

The following templates partially match the input. Be more specific with the template name and/or language.

Templates                       Short Name               Language      Tags
---------------------------------------------------------------------------------
WPF Custom Control Library      wpfcustomcontrollib      [C#], VB      Common/WPF
WPF User Control Library        wpfcontrollib            [C#]          Common/WPF

Examples:
    dotnet new wpfcustomcontrollib
    dotnet new --help

λ dotnet new wpfcontrollib
Couldn't find an installed template that matches the input, searching online for one that does...
Usage: new [options]

...

WPF User Control Library (C#)
Author: Microsoft
Description: A project for creating a user control library for .NET Core WPF Applications
Options:
  -f|--framework  The target framework for the project.
                      netcoreapp3.0    - Target netcoreapp3.0
                  Default: netcoreapp3.0

  --langVersion   Sets langVersion in the created project file
                  text - Optional

  --no-restore    If specified, skips the automatic restore of the project on create.
                  bool - Optional
                  Default: false / (*) true


* Indicates the value used if the switch is provided without a value.

Comparing the files for the custom control template with those of .NET Framework (generated by Visual Studio Project->New), I see a few files missing.

image

==

  • Was this tested to validate that each of the new templates works for both C# and VB?
  • Were the templates compared against .NET Framework templates?
  • Any other validation/testing details?

@jmarolf jmarolf force-pushed the add-control-library-templates branch from c3c2767 to cd10804 Compare July 18, 2019 21:27
@jmarolf
Copy link
Contributor Author

jmarolf commented Jul 18, 2019

Comparing the files for the custom control template with those of .NET Framework (generated by Visual Studio Project->New), I see a few files missing.
image

Those files are blank on .NET Framework. We tend to try and have .NET Core templates only produce the minimal set of files needed now.

@jmarolf jmarolf force-pushed the add-control-library-templates branch from 7cc51f8 to 8239fe3 Compare July 20, 2019 11:53
@vatsan-madhavan
Copy link
Member

UserControl - C#:

  • UserControl template lays down two versions of C# files - UserControl.xaml.cs and UserControl1.xaml.cs
  • UserControl.xaml is still missing the namespace prefix
    • x:Class="UserControl1" should be x:Class="usercontrol.UserControl1"

@vatsan-madhavan
Copy link
Member

Looks good to me - thanks @jmarolf!

We have couple of outstanding things to puzzle out.

  • We had to test against 3.0.100-preview7-012821 because the latest sdk 3.0.100-preview8-013379 seems to have trouble building VB. Where should we open an issue for this?
  • This condition did not evaluate for you - so you had to drop the condition and make this unconditional. We need to chase this down.
    • <LangVersion Condition="'$(langVersion)' != ''">$(ProjectLanguageVersion)</LangVersion>

The rest looks good to me.

Marking for auto_merge as soon as the build completes successfully!

/cc @diverdan92, @chabiss

@vatsan-madhavan vatsan-madhavan added the auto_merge bot-command label Jul 22, 2019
@ghost
Copy link

ghost commented Jul 22, 2019

Hello @vatsan-madhavan!

Because this pull request has the auto_merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit c16a1af into dotnet:master Jul 22, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2022
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto_merge bot-command PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Control Library project templates
4 participants