I'm trying to find a way to scaffold a new ASP.NET Core site that runs on the full .NET Framework (net461) and contains a unit test project. Is this doable? All of the options for dotnet new mvc
don't seem to allow net461
as a framework. The same is true for the xunit
project type.
Asked
Active
Viewed 597 times
0

Brian Vallelunga
- 9,869
- 15
- 60
- 87
1 Answers
2
Build your own template which contains two projects. It's extremely easy. Create and setup several projects in Visual Studio and put .template.config\template.json
file to the root solution level:
template.json
contents:
{
"classifications": [ "Web" ],
"name": "ASP.NET Core project AND xUnit project both targeting .NET 461",
"identity": "fweb", // Unique name for this template
"shortName": "fweb", // Short name that can be used on the cli
"tags": {
"language": "C#" // Specify that this template is in C#.
},
"sourceName": "FullWebApp",
"preferNameDirectory": "true"
}
Then run dotnet new --install
with solution path as a parameter:
dotnet new --install "D:\YourFullPath\DotNetTemplates"
Template fweb
has been created! Go to target folder and try to create new projects from template:
dotnet new fweb
It's done. Read more about template packaging (NuGet) and name parametrization here:

Ilya Chumakov
- 23,161
- 9
- 86
- 114
-
I have a sample of a console project and unit test project at https://github.com/dotnet/dotnet-template-samples/tree/master/05-multi-project – Sayed Ibrahim Hashimi Apr 27 '17 at 15:52