我是靠谱客的博主 漂亮面包,最近开发中收集的这篇文章主要介绍dotnet 命令的使用dotnet --infodotnet new dotnet restore异常处理dotnet rundotnet --version-v|--verbosity ,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

dotnet --info

PS E:GitHubKerryJiangSuperSocket> dotnet --info
.NET Command Line Tools (2.1.4)

Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190

Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk2.1.4

Microsoft .NET Core Shared Framework Host

Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54

 

 

dotnet new console -o hwapp

dotnet restore

dotnet run

 

 

dotnet new 

        Creates a new project, configuration file, or solution based on the specified template.

Description

The dotnet new command provides a convenient way to initialize a valid .NET Core project.

The command calls the template engine to create the artifacts on disk based on the specified template and options.

 

 

dotnet restore

       Restores the dependencies and tools of a project.

Description

The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file. By default, the restoration of dependencies and tools are performed in parallel.

 

In order to restore the dependencies, NuGet needs the feeds where the packages are located.

Feeds are usually provided via the NuGet.config configuration file.

A default configuration file is provided when the CLI tools are installed.

You specify additional feeds by creating your own NuGet.config file in the project directory.

You also specify additional feeds per invocation at a command prompt.

 

For dependencies, you specify where the restored packages are placed during the restore operation using the --packages argument.

If not specified, the default NuGet package cache is used, which is found in the .nuget/packages directory in the user's home directory on all operating systems (for example, /home/user1 on Linux or C:Usersuser1 on Windows).

 

For project-specific tooling, dotnet restore first restores the package in which the tool is packed, and then proceeds to restore the tool's dependencies as specified in its project file.

 

The behavior of the dotnet restore command is affected by some of the settings in the Nuget.Config file, if present.

For example, setting the globalPackagesFolder in NuGet.Config places the restored NuGet packages in the specified folder.

This is an alternative to specifying the --packages option on the dotnet restore command.

For more information, see the NuGet.Config reference.

 

异常处理

PS D:ChuckLuGitGitHubKerryJiangIrvineCSharpCourses> dotnet restore
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

这个命令需要在项目或者解决方案下运行才有效

 

dotnet run

     Runs source code without any explicit compile or launch commands.

Description

The dotnet run command provides a convenient option to run your application from the source code with one command.

It's useful for fast iterative development from the command line.

The command depends on the dotnet build command to build the code.

Any requirements for the build, such as that the project must be restored first, apply to dotnet run as well.

 

Output files are written into the default location, which is bin/<configuration>/<target>.

For example if you have a netcoreapp1.0 application and you run dotnet run, the output is placed in bin/Debug/netcoreapp1.0.

Files are overwritten as needed.

Temporary files are placed in the obj directory.

 

If the project specifies multiple frameworks, executing dotnet run results in an error unless the -f|--framework <FRAMEWORK> option is used to specify the framework.

 

The dotnet run command is used in the context of projects, not built assemblies. If you're trying to run a framework-dependent application DLL instead, you must use dotnet without a command. For example, to run myapp.dll, use:

 
dotnet myapp.dll

For more information on the dotnet driver, see the .NET Core Command Line Tools (CLI) topic.

 

In order to run the application, the dotnet run command resolves the dependencies of the application that are outside of the shared runtime from the NuGet cache. Because it uses cached dependencies, it's not recommended to use dotnet run to run applications in production. Instead, create a deployment using the dotnet publish command and deploy the published output. 

 

 

dotnet --version

PS E:GitHubKerryJiangSuperSocket> dotnet sln .SuperSocket.sln list
Project reference(s)
--------------------
srcSuperSocket.PrimitivesSuperSocket.Primitives.csproj
srcSuperSocket.ProtoBaseSuperSocket.ProtoBase.csproj
srcSuperSocket.NetSocketSuperSocket.NetSocket.csproj
srcSuperSocket.LibuvSuperSocket.Libuv.csproj
test
testTestTest.csproj
srcSuperSocket.ServerSuperSocket.Server.csproj
srcSuperSocket.ChannelSuperSocket.Channel.csproj

 

-v|--verbosity <LEVEL>

Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].

 

 

 

 

 

转载于:https://www.cnblogs.com/chucklu/p/7095919.html

最后

以上就是漂亮面包为你收集整理的dotnet 命令的使用dotnet --infodotnet new dotnet restore异常处理dotnet rundotnet --version-v|--verbosity 的全部内容,希望文章能够帮你解决dotnet 命令的使用dotnet --infodotnet new dotnet restore异常处理dotnet rundotnet --version-v|--verbosity 所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部