当前位置:网站首页>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
边栏推荐
- 以太网是什么要怎么连接电脑
- At the age of 30, I began to learn programming by myself. Is it still time for me to have difficulties at home?
- Unity Quad culls shaders with back faces and transparent parts
- Gbase 8s stored procedure execution and deletion
- 「 每日一练,快乐水题 」1108. IP 地址无效化
- 冰冰学习笔记:循环队列的实现
- Chapter IX app project test (2) test tools
- CTF_ Web: deserialization of learning notes (II) CTF classic test questions from shallow to deep
- LabVIEW development gas regulator
- leetcode1221. Split balance string
猜你喜欢

哪个编程语言实现hello world最烦琐?

Cnpm: unable to load file c:\users\administrator\appdata\roaming\npm\cnpm PS1 because running scripts is prohibited on this system.

Machine learning deep learning -- Vectorization

JS arguments

Method of opening data recovery of solid state disk

Gbase 8s index R tree

固態硬盤開盤數據恢複的方法

Xiaobai learns MySQL - Statistical 'opportunism'

固态硬盘开盘数据恢复的方法

绝了!自动点赞,我用 PyAutoGUI!
随机推荐
leetcode1221. 分割平衡字符串
Gbase 8s stored procedure flow control
Méthode de récupération des données d'ouverture du disque dur à l'état solide
第九章 APP项目测试(2) 测试工具
"Daily practice, happy water" 1108 IP address invalidation
2.0springmvc uses restful
Calculate student grade (virtual function and polymorphism)
Php7.2 add JPEG extension
Get to know the drawing component of flutter - custompaint
成功解决:selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from
Xiaobai learns MySQL - Statistical 'opportunism'
CTF_ Web: Learn flask template injection (SSTI) from 0
【FLink】access closed classloader classloader.check-leaked-classloader
Cascading deletion of gbase 8s
Coordinate system left multiply right multiply
Le chemin de l'apprentissage immutable - - Adieu à la copie traditionnelle
jsz中的join()
Vscode 设置clang-format
SOC验证环境的启动方式
【图像融合】基于matlab方向离散余弦变换和主成分分析图像融合【含Matlab源码 1907期】