当前位置:网站首页>dotnet-exec 0.6.0 released

dotnet-exec 0.6.0 released

2022-07-05 00:48:00 Dotnet cross platform

dotnet-exec 0.6.0 released

Intro

dotnet-exec It's a C# Widget for program , Can be used to run some simple C# Program without creating a project file , And you can customize the entry method of the project , Support but not limited to Main Method

Install/Update

dotnet-exec It's a dotnet tool, Can be installed using dotnet tool To install

install / Update the latest stable version :

dotnet tool update -g dotnet-execute

Install the latest preview edition :

dotnet tool update -g dotnet-execute --prerelease

Script

stay 0.6.0 The version introduces script Support , So as to simplify the use of some simple code , For example, this simple example

dotnet-exec "script:1+1"

682d47189fe1fe284bbf8800e32f59dd.png

stay 0.5.0 In version, users can customize reference, Now you can also aim at script Use -r/--reference Option to customize the local... Of the reference dll perhaps nuget package

For example, the following reference nuget Example of a package

dotnet-exec "script:typeof(CsvHelper).Assembly.Location" -r "nuget:WeihanLi.Npoi" -u "WeihanLi.Npoi"

a3e6d95af28ff45bc24ac5d411b36a08.png

Here's a quote from WeihanLi.Npoi This nuget package , If no version is specified, the latest stable version will be used by default , At present, it is 2.3.0 So the output we see will be 2.3.0

We can also specify specific NuGet Package version , such as :

dotnet-exec "script:typeof(CsvHelper).Assembly.Location" -r "nuget:WeihanLi.Npoi,2.1.0" -u "WeihanLi.Npoi"

5c94c8ba530d0693495063a254c0f461.png

We can also directly reference local dll, For example, we quote the above nuget Local... In the package dll

dotnet-exec "script:typeof(CsvHelper).FullName" -r "C:\Users\Weiha\.nuget\packages\weihanli.npoi\2.3.0\lib/net6.0/WeihanLi.Npoi.dll" -u "WeihanLi.Npoi"

5f10c9f5bae36340ed1cf1561fc3df2f.png

new docker The image has been released , It can also be done through docker Use  weihanli/dotnet-exec:0.6.0  Mirror to experience

73f4a1342d4a56d283f2f7f6041137e5.png

References

  • https://github.com/WeihanLi/dotnet-exec

  • https://www.nuget.org/packages/dotnet-execute/

  • https://hub.docker.com/r/weihanli/dotnet-exec

原网站

版权声明
本文为[Dotnet cross platform]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050037465196.html