Skip to content

add wpf class library template #1298

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
merged 3 commits into from
Jul 19, 2019

Conversation

jmarolf
Copy link
Contributor

@jmarolf jmarolf commented Jul 17, 2019

fixes #1297

@ghost ghost requested review from vatsan-madhavan, rladuca, ryalanms and stevenbrix July 17, 2019 18:15
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Jul 17, 2019
@ghost ghost requested a review from SamBent July 17, 2019 18:15
@jmarolf
Copy link
Contributor Author

jmarolf commented Jul 17, 2019

cc: @diverdan92

@vatsan-madhavan
Copy link
Member

/azp run

@vatsan-madhavan
Copy link
Member

  • The template package installs as expected, and shows teh wpflib template
  • Only C# is listed - VB is not listed.
λ dir
 Volume in drive C is Local Disk
 Volume Serial Number is F0A2-D98A

 Directory of C:\src\repos\wpf\artifacts\packages\Debug\Shipping

07/17/2019  05:33 PM    <DIR>          .
07/17/2019  05:33 PM    <DIR>          ..
07/17/2019  05:33 PM            15,786 Microsoft.DotNet.Wpf.ProjectTemplates.3.0.0-dev.nupkg
07/17/2019  05:33 PM         1,427,591 Microsoft.NET.Sdk.WindowsDesktop.3.0.0-dev.nupkg
               2 File(s)      1,443,377 bytes
               2 Dir(s)  596,732,702,720 bytes free

λ dotnet new -i Microsoft.DotNet.Wpf.ProjectTemplates::3.0.0-dev --nuget-source %cd%
  Restore completed in 156.34 ms for C:\Users\srivatsm\.templateengine\dotnetcli\v3.0.100-preview8-013119\scratch\restore.csproj.

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 Class library                                 wpflib                [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 gitignore
    dotnet new --help

Creating a new wpflib project seems to lay down VB related files even though it claims to create C# project.

λ dotnet new wpflib
The template "WPF Class library" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on C:\src\repos\wpf\artifacts\packages\Debug\Shipping\wpflib\wpflibnetcore\Company.ClassLibrary1.csproj...
MSBUILD : error MSB1009: Project file does not exist.
Switch: C:\src\repos\wpf\artifacts\packages\Debug\Shipping\wpflib\wpflibnetcore\Company.ClassLibrary1.csproj

Restore failed.
Post action failed.
Description: Restore NuGet packages required by this project.
Manual instructions: Run 'dotnet restore'

λ dir wpflibnetcore\
 Volume in drive C is Local Disk
 Volume Serial Number is F0A2-D98A

 Directory of C:\src\repos\wpf\artifacts\packages\Debug\Shipping\wpflib\wpflibnetcore

07/17/2019  05:34 PM    <DIR>          .
07/17/2019  05:34 PM    <DIR>          ..
07/17/2019  05:34 PM                34 Class1.vb
07/17/2019  05:34 PM               221 wpflibnetcore.vbproj
               2 File(s)            255 bytes
               2 Dir(s)  596,728,782,848 bytes free

Attempting to create a VB wpflib project doesn't work. This is consistent with the very first observation that VB is not recognized as an installed language for 'wpflib'.

λ dotnet new wpflib -lang VB
Couldn't find an installed template that matches the input, searching online for one that does...
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.


Unable to determine the desired template from the input template name: wpflib.
The following templates partially match the input. Be more specific with the template name and/or language.

Templates                                 Short Name      Language      Tags
--------------------------------------------------------------------------------------- Console Application                       console         VB            Common/Console
Class library                             classlib        VB            Common/Library
WPF Application                           wpf             VB            Common/WPF
WPF Class library                         wpflib          C#            Common/WPF
Windows Forms (WinForms) Application      winforms        VB            Common/WinForms Unit Test Project                         mstest          VB            Test/MSTest
NUnit 3 Test Project                      nunit           VB            Test/NUnit
NUnit 3 Test Item                         nunit-test      VB            Test/NUnit
xUnit Test Project                        xunit           VB            Test/xUnit

Examples:
    dotnet new wpflib
    dotnet new --help

@jmarolf jmarolf force-pushed the add-class-library-template branch from 65758ba to 1ed8e9b Compare July 18, 2019 18:45
@jmarolf
Copy link
Contributor Author

jmarolf commented Jul 18, 2019

@vatsan-madhavan thanks! I found the typo. testing this locally I believe that the latest changes have resolved this

@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be Microsoft.NET.Sdk.WindowsDesktop as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixing

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.

@jmarolf , C# looks good. the template seems to build ok etc. VB needs another iteration, I think.

@vatsan-madhavan vatsan-madhavan added this to the 3.0 milestone Jul 19, 2019
@jmarolf
Copy link
Contributor Author

jmarolf commented Jul 19, 2019

@vatsan-madhavan I believe I have addressed everything

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.

Looks good to me.

@jmarolf, does template.json postActions.actionId need to have unique GUID's in each project template? If so, we'd probably want to open an issue for this and do a fixup.

@vatsan-madhavan vatsan-madhavan merged commit 3e69101 into dotnet:master Jul 19, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR metadata: Label to tag PRs, to facilitate with triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Class Library project templates
2 participants