当前位置:网站首页>dotnet-exec 0.4.0 released
dotnet-exec 0.4.0 released
2022-06-25 04:47:00 【Dotnet cross platform】
dotnet-exec 0.4.0 released
Intro
dotnet-exec It's a C# Program command line gadgets , 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-executeInstall the latest preview edition :
dotnet tool update -g dotnet-execute --prereleaseUpdates
Features
Custom Usings
stay 0.4.0 The version supports user-defined using The default will contain the default using quote , You can also customize what you want to add using
For example, the following example , Used a static using
dotnet-exec 'code:WriteLine(1+1);' --using "static System.Console"The output is as follows :

If this reference is not added, an error will be reported

We can also remove the default using quote , Just use “-” It's just the beginning , Like the following

The previous program that can be compiled and executed normally will fail to pass the compilation
Preview enhancement
A new version has been added --preview To simplify --lang-version=Preview Configuration of , except LangVersion Configuration , An assembly will also be added attribute [assembly:System.Runtime.Versioning.RequiresPreviewFeatures] To enable some features that are still in preview , from .NET 6 Start to support the functions with some preview features in the official release , You need to configure this for use attribute, So for preview Added this Attribute

Startup type
A new version has been added --startup-type The option to , By default, if there are multiple entries, the first one will be found ,startup-type It can help to find a more accurate entrance
Reference handling refactor
It was compiled directly before dll Loaded into the default AssemblyLoadContext, This is generally no problem
However, an error will be reported when there is an assembly version conflict , A separate... Will be used in the new version AssemblyLoadContext, And fixed the previous single use AssemblyLoadContext The problem of executing code , It is because of the above introduction Reference Assembly, Use reference assemblies at compile time , At execution time, the implementation assembly containing the implementation is replaced to execute the code , In this way, it will be easier for us to test different behaviors under the two versions

Executor refactor
0.4.0 The version of has added --executor-type, Similar to that in the previous version --compiler-type, But currently only one implementation is provided , Mainly to facilitate better expansion
Docker support
If you're not dotnet developer , Don't want to install dotnet sdk, You can also use docker To try it
docker run --rm weihanli/dotnet-exec:0.4.0 dotnet-exec "code:(1+1).Dump()"
Bug fix
Repair Linux On dotnet path The problem of
stay Linux Default in the environment
dotnetPath is not dotnet Executable file , It is a symbol link file , You need to find the corresponding real file path , Because of the code BUG As a result, it is not converted to the real file path , stay 0.4.0 Version has been fixed
More
at present dotnet-exec Depend on SDK Environmental Science , It needs to be improved later , It only needs Runtime The environment can , such docker Images can be much smaller , In addition, it is intended to support user-defined references , For example, quote your own dll Or designated Nuget package
References
https://github.com/WeihanLi/dotnet-exec
https://www.nuget.org/packages/dotnet-execute/
https://hub.docker.com/repository/docker/weihanli/dotnet-exec
边栏推荐
- Machine learning deep learning -- Vectorization
- Méthode de récupération des données d'ouverture du disque dur à l'état solide
- Coordinate system left multiply right multiply
- leetcode1221. Split balance string
- GBASE 8s存储过程流程控制
- Records of ros2/dds/qos/ topics
- 「 每日一练,快乐水题 」1108. IP 地址无效化
- Excel exports data to SQL and pictures to folder through macro | VBA
- ASEMI大功率场效应管和三极管的区别
- Bingbing's learning notes: implementation of circular queue
猜你喜欢

Mongodb cluster

Record small knowledge points

Code scanning payment flow chart of Alipay payment function developed by PHP

JS, BOM, DOM (VI)

dotnet-exec 0.4.0 released

「 每日一练,快乐水题 」1108. IP 地址无效化

Simple text analysis of malicious samples - Introduction

机器学习深度学习——向量化

Chapter IX app project test (2) test tools

olap分析引擎——Kylin4.0
随机推荐
Deep learning - several types of learning
How to apply for software
PHP encapsulates curl to send get and post request methods, and uses
多睡觉,能减肥,芝加哥大学最新研究:每天多睡1小时,等于少吃一根炸鸡腿...
Introduction to the isolation level of gbase 8s
Paper notes: multi label learning ESMC (I don't understand it, but I haven't written it yet, so I'll put it here for a place temporarily)
Method of opening data recovery of solid state disk
MySQL concept and operation (III)
【无标题】
GBASE 8s存储过程语法结构
ROS2/DDS/QoS/主题的记录
Trigger for gbase 8s
SOC验证环境的启动方式
Blob page in gbase 8s
CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep
Bingbing's learning notes: implementation of circular queue
My IC journey - the growth of senior chip design verification engineers - "Hu" said that IC engineers are perfect and advanced
融合CDN,为客户打造极致服务体验!
Multithreading structure of gbase 8s
Gbase 8s stored procedure syntax structure