Closed StevenTCramer closed 6 years ago
λ dotnet --version 2.1.402
@danroth27 @scottaddie can you guys help with this question?
@StevenTCramer Did you create a .template.config/template.json file? More details here: https://docs.microsoft.com/dotnet/core/tutorials/create-custom-template#create-a-template-from-a-project. The aforementioned JSON file stores the metadata which displays in the dotnet new experience.
Here's an example of the JSON file used by the ASP.NET Core Razor Pages project template: https://github.com/aspnet/Templating/blob/master/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/.template.config/template.json
@scottaddie Yes I created those and installing it locally works fine. The issue is I can't install the template from MyGet.
@scottaddie I went ahead and pushed to nuget and it works fine from there with
dotnet new --install TimeWarp.AspNetCore.Blazor.Templates
but I would perfer to test stuff from MyGet before pushing to Nuget.
@mlorbetske
@mlorbetske @seancpeters Does the directory containing template.json have to be named .template.config? Our docs reference that name; however, Steven's project uses a directory name of .template.config.src. See https://github.com/TimeWarpEngineering/blazor-state/tree/master/source/TimeWarp.AspNetCore.Blazor.Templates/content/TimeWarp.BlazorHosted-CSharp/.template.config.src.
Could you post the output of the first install command you tried please?
As a possible workaround, try adding the MyGet feed to your global NuGet config and try the first install command but without specifying --nuget-source
Here's what I get:
C:\Users\user>dotnet new --install TimeWarp.AspNetCore.Blazor.Templates::0.1.0-beta-229 --nuget-source https://www.myget.org/F/timewarp-enterprises/api/v3/index.json
Restoring packages for C:\Users\user\.templateengine\dotnetcli\v2.2.100-preview2-009404\scratch\restore.csproj...
Installing TimeWarp.AspNetCore.Blazor.Templates 0.1.0-beta-229.
Generating MSBuild file C:\Users\user\.templateengine\dotnetcli\v2.2.100-preview2-009404\scratch\obj\restore.csproj.nuget.g.props.
Generating MSBuild file C:\Users\user\.templateengine\dotnetcli\v2.2.100-preview2-009404\scratch\obj\restore.csproj.nuget.g.targets.
Restore completed in 4.47 sec for C:\Users\user\.templateengine\dotnetcli\v2.2.100-preview2-009404\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.
Templates Short Name Language Tags
-------------------------------------------------------------------------------------------------------------------------------
Console Application console [C#], F#, VB Common/Console
Class library classlib [C#], F#, VB Common/Library
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 Page page [C#] Web/ASP.NET
MVC ViewImports viewimports [C#] Web/ASP.NET
MVC ViewStart viewstart [C#] Web/ASP.NET
Blazor (hosted in ASP.NET server) blazorhosted [C#] Web/Blazor/Hosted
Blazor Library blazorlib [C#] Web/Blazor/Library
Blazor (Server-side in ASP.NET Core) blazorserverside [C#] Web/Blazor/ServerSide
Blazor (standalone) blazor [C#] Web/Blazor/Standalone
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 razor [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
global.json file globaljson Config
NuGet Config nugetconfig Config
Web Config webconfig Config
Solution File sln Solution
Examples:
dotnet new mvc --auth Individual
dotnet new razor --auth Individual
dotnet new --help
From the look of the output from @danroth27, it seems to have been successful - the output from @StevenTCramer will likely shed more light on the situation.
@mlorbetske Well, I don't see any new templates in the list and when I try to uninstall the templates it says that the templates were not installed.
C:\Users\user>dotnet new -u TimeWarp.AspNetCore.Blazor.Templates
Could not find something to uninstall called 'TimeWarp.AspNetCore.Blazor.Templates'.
Are these different than the Blazor templates that appeared in your list above? Also, what does dotnet new -u
list as the installed template packs?
Downloading and extracting the package, it doesn't appear that there are any template.json files at all. My guess is that there's something wrong with the build process that produces that package.
@mlorbetske The Blazor templates are unrelated to this issue. It's a separate template pack.
C:\Users\user>dotnet new -u
Template Instantiation Commands for .NET Core CLI
Currently installed items:
Microsoft.DotNet.Common.ItemTemplates
Templates:
global.json file (globaljson)
NuGet Config (nugetconfig)
Solution File (sln)
Web Config (webconfig)
Microsoft.DotNet.Common.ProjectTemplates.2.2
Templates:
Class library (classlib) C#
Class library (classlib) F#
Class library (classlib) VB
Console Application (console) C#
Console Application (console) F#
Console Application (console) VB
Microsoft.DotNet.Test.ProjectTemplates.2.2
Templates:
Unit Test Project (mstest) C#
Unit Test Project (mstest) F#
Unit Test Project (mstest) VB
xUnit Test Project (xunit) C#
xUnit Test Project (xunit) F#
xUnit Test Project (xunit) VB
Microsoft.DotNet.Web.ItemTemplates
Templates:
Razor Page (page) C#
MVC ViewImports (viewimports) C#
MVC ViewStart (viewstart) C#
Microsoft.DotNet.Web.ProjectTemplates.2.2
Templates:
ASP.NET Core Empty (web) C#
ASP.NET Core Empty (web) F#
Razor Class Library (razorclasslib) C#
ASP.NET Core Web App (razor) C#
ASP.NET Core Web App (Model-View-Controller) (mvc) C#
ASP.NET Core Web App (Model-View-Controller) (mvc) F#
ASP.NET Core Web API (webapi) C#
ASP.NET Core Web API (webapi) F#
Microsoft.DotNet.Web.Spa.ProjectTemplates
Templates:
ASP.NET Core with Angular (angular) C#
ASP.NET Core with React.js (react) C#
ASP.NET Core with React.js and Redux (reactredux) C#
NUnit3.DotNetNew.Template
Templates:
NUnit 3 Test Project (nunit) C#
NUnit 3 Test Item (nunit-test) C#
NUnit 3 Test Project (nunit) F#
NUnit 3 Test Item (nunit-test) F#
NUnit 3 Test Project (nunit) VB
NUnit 3 Test Item (nunit-test) VB
Microsoft.AspNetCore.Blazor.Templates
Templates:
Blazor (hosted in ASP.NET server) (blazorhosted) C#
Blazor Library (blazorlib) C#
Blazor (Server-side in ASP.NET Core) (blazorserverside) C#
Blazor (standalone) (blazor) C#
@danroth27 per my comment after the one asking for the output with -u, the nupkg in question doesn't contain any template.json files - so no new templates would appear from installing that package. The second command line that the original poster used did not include the version, which would install the latest stable from the feed, not the latest pre-release, so my assumption is that there is a stable version of that package on NuGet that does have the template.json files included. At a guess, I'd say something has changed in whatever build process produces that package.
@mlorbetske @danroth27 I added a global.js to control the sdk version. It seems to work for dotnet 2.1.401
C:\git\temp
λ dotnet --version
2.1.401
C:\git\temp
λ dotnet new -u
Template Instantiation Commands for .NET Core CLI
Currently installed items:
Microsoft.DotNet.Common.ItemTemplates
Microsoft.DotNet.Common.ProjectTemplates.2.1
Microsoft.DotNet.Test.ProjectTemplates.2.1
Microsoft.DotNet.Web.ItemTemplates
Microsoft.DotNet.Web.ProjectTemplates.2.1
Microsoft.DotNet.Web.Spa.ProjectTemplates
NUnit3.DotNetNew.Template
TimeWarp.AspNetCore.Blazor.Templates
C:\git\temp
But switching to 2.1.402 and it goes away.
C:\git\temp
λ dotnet --version
2.1.402
C:\git\temp
λ dotnet new -u
Template Instantiation Commands for .NET Core CLI
Currently installed items:
Microsoft.DotNet.Common.ItemTemplates
Microsoft.DotNet.Common.ProjectTemplates.2.1
Microsoft.DotNet.Test.ProjectTemplates.2.1
Microsoft.DotNet.Web.ItemTemplates
Microsoft.DotNet.Web.ProjectTemplates.2.1
Microsoft.DotNet.Web.Spa.ProjectTemplates
NUnit3.DotNetNew.Template
Microsoft.AspNetCore.Blazor.Templates
C:\git\temp
@mlorbetske Ok I see my problem now. And yes it is a yaml CI problem. I was copying the structure of blazor itself and using .template.config.src but CI wasn't copying that to .template.config
The installation that I thought was working was a manual local build. dotnet new -l doesn't tell us anything about the version or location so I didn't realize.
Now I gotta fix my CI yaml.
Thx much for the help.
Ok I have it working now on both nuget and MyGet. Thanks to @mlorbetske and @danroth27 If anyone wants to review the source feel free https://github.com/TimeWarpEngineering/blazor-state/
I want to install https://www.myget.org/feed/timewarp-enterprises/package/nuget/TimeWarp.AspNetCore.Blazor.Templates
I try the following command but it doesn't list the template.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.