Questions tagged [dotnet-new]
16 questions
5
votes
1 answer
How do I add a new resx file to my project using the dotnet CLI or VS Code?
How do I add a new .resx (plus .Designer.cs) file to my project using the dotnet CLI or VS Code?

bitbonk
- 48,890
- 37
- 186
- 278
3
votes
1 answer
ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY on dotnet core 3.1 react project
I started a new dotnet core with react project on my Windows 8.1 machine.
dotnet new react my-project
When I started debugging in chrome at https://localhost:5001/, I got the following error
ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY.
Where should I…

Maciek
- 161
- 11
2
votes
1 answer
How can I generate .csproj Project file only in C# Console App?
I already have a Program.cs in the folder/directory and no other files.
When I do dotnet new console, it won't let me create it unless I use --force to overwrite the Program.cs. I think I just need to create .csproj project file to build, run and…

zawhtut
- 229
- 2
- 14
1
vote
2 answers
Issues running program in Visual Studio Code
I'm attempting to run a WinExe with true , but it is not even running a simple Hello World program. I'm not sure what's wrong at this point, the only clue is this inner exception.
An unhandled exception of type…

ToyKid22
- 35
- 7
1
vote
1 answer
Exclude a project with a symbol switch for dotnet new template
I have a dotnet new template which I provide as a NuGet.
It normally contains/creates two projects (with common package references, .editorconfig,...):
A console application project
A unit test project
Now I want to add a --notests (or, if…

marce
- 781
- 1
- 10
- 20
1
vote
1 answer
Where does "dotnet new templatename" command stores the template?
I am following tutorial for Create an Item Template for dotnet new CLI
After running dotnet new stringext I get the message
The template "Example templates: string extensions" was created successfully.
I look up for the extension in my test folder…

El Sordo
- 165
- 2
- 14
1
vote
2 answers
how to detect namespace when creating a class through a custom template in dotnet cli
I'm making a custom class dotnet new template and below is my template.json. This works but I can't figure out how to detect current namespace and replace it.
template.json:
{
"$schema": "http://json.schemastore.org/template",
"author":…

zephyr202
- 11
- 1
1
vote
1 answer
dotnet new target windows specific framework
Is there any way to get the dotnet new to use a platform specific target such as net6.0-windows10.0.19041.0?
This is what I'd like to be able to do:
dotnet new console --name HelloWindowsApi --framework net6.0-windows10.0.19041.0
I'm attempting to…

sipsorcery
- 30,273
- 24
- 104
- 155
1
vote
1 answer
Create empty folder using dotnet template
I am using dotnet template to create template for my azure function using templates.config file. It works fine but unable to create empty folder and throws when it creates solution from this template. I have empty folders in my template and would…

Punit
- 1,347
- 3
- 20
- 39
1
vote
1 answer
How do I ship multiple `dotnet new` templates inside a single NuGet package?
I have a dotnet new template project that consists of three templates:
Library
Headless .NET Core service
ASP.NET Core Web Application
Project source can be found here (it's FOSS): https://github.com/petabridge/petabridge-dotnet-new/
I've followed…

Aaronontheweb
- 8,224
- 6
- 32
- 61
0
votes
0 answers
Dotnet new ASP.NET Core Web API reads current connectionString from appsettings.json, but sends web requests using a previous connectionString
Using the first-ever template that I created in dotnet new, I generated a solution in Visual Studio 2022 with an ASP.NET Core Web API project; this project contains an appsettings.json file and a controller with a GET action, which retrieves a…

jmagen
- 41
- 3
0
votes
0 answers
How to execute a postaction script from a dotnet new template
I'm trying to execute a simple script just after a project is generated from a dotnet template. The script will try to create a new file called new.txt in the generated project's root directory.
Some sample code I was referencing to make this comes…

billy bud
- 103
- 2
- 13
0
votes
0 answers
use visual studio templates to rename part of a class and file name
I want to be able to rename classes using dotnet new project templates like
these examples
I want to have files/classes that have the same name as the project with a suffix that automatically rename to match the project
eg [projectname]DbContext,…

Paul
- 693
- 1
- 10
- 25
0
votes
1 answer
Lowercase first letter of a parameter in the "dotnet new" template engine
I am building a template using the dotnet new template engine.
I have a parameter that looks like this:
"symbols": {
"rootEntity": {
"displayName": "Root Entity",
"type": "parameter",
"datatype": "string",
"replaces": "Notebook",
…

Vaccano
- 78,325
- 149
- 468
- 850
0
votes
1 answer
Create an image containing .net core sdk and install custom templates inside the image
I am creating a docker image using visual studio console application and the dockerfile looke like:
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS base
RUN dotnet new --install MyCustomTemplate::1.0.0
WORKDIR /app
FROM…

Satyajit
- 1,971
- 5
- 28
- 51