Skip to content
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

Custom Template auto restore not working no matter what #8524

Open
TheExiledCat opened this issue Nov 8, 2024 · 0 comments
Open

Custom Template auto restore not working no matter what #8524

TheExiledCat opened this issue Nov 8, 2024 · 0 comments

Comments

@TheExiledCat
Copy link

Product

dotnet CLI (dotnet new)

Describe The Bug

the dotnet restore post action in template.json is not being called, causing the user to have to manually restore after using dotnet new

To Reproduce

Steps:

  1. create a simple console app
  2. add a template.json like this:
{
  "$schema": "http://json.schemastore.org/template",
  "author": "TheExiledCat",
  "classifications": [ "Common", "Console" ],
  "identity": "SimpleRestApi.Empty",
  "name": "SimpleRestApi Empty project",
  "shortName": "simplerest.empty",
  "sourceName": "SimpleRestApp",
  "tags": {
    "language": "C#",
    "type": "project",  
    "frameworkType": "api"
  },

"postActions": [{
  "condition": "(!skipRestore)",
  "description": "Restore NuGet packages required by this project.",
  "manualInstructions": [{
    "text": "Run 'dotnet restore'"
  }],
  "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
  "continueOnError": false
}]
}
  1. install the template and create a new app with dotnet new simplerest.empty

dotnet Info

output .NET SDK: Version: 8.0.108 Commit: 665a05cea7 Workload version: 8.0.100-manifests.109ff937

Runtime Environment:
OS Name: linuxmint
OS Version: 21.3
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/lib/dotnet/sdk/8.0.108/

.NET workloads installed:
Workload version: 8.0.100-manifests.109ff937
There are no installed workloads to display.

Host:
Version: 8.0.8
Architecture: x64
Commit: 08338fcaa5

.NET SDKs installed:
8.0.108 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.8 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Version

N/A

Additional context

The dotnet new command doesnt create any errors, it just created the project as expected but it doesnt restore anything, meaning the references dont get installed and the used has to manually restore.

i tried multiple template.jsons including one with primaryOutputs but it didnt work either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant