Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

c# - Is it possible to use dotnet new to create an ASP.NET Web Application Empty .Net Framework 4.7.2 project?

I've been trying to find a way to create a ASP.NET Web Application with .Net Framework v4.7.2 using dotnet new. But so far I couldn't find anything.

I checked dotnet new -l and it isn't on the list. So I tried several things.

Using:

dotnet new web --framework net472 -n ProjectName

It doesn't work and gives:

Error: Invalid parameter(s):
--framework net472
    'net472' is not a valid value for --framework (Framework).

Used:

dotnet new web --target-framework-override net472 -n ProjectName

It just goes to default and creates a ASP.NET Core project.

Is it actually possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The dotnet tool does not include a built in template for creating a new .NET Framework empty web application.

However, you can create your own templates compatible with the dotnet tool. I won't explain that how here as I've never done it, but a web search reveals documentation and blog articles about how to create your own.

I assume using dotnet isn't really necessary, you just want a quick and easy way to create a new .NET Framework ASP.NET Empty web app. You could use Visual Studio to create a new empty web app and then source control it, and when you want to make a new site you just clone the site and go from there. Or pick any other templating tool out there, such as T4.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...