当前位置:网站首页>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
- halcon之区域:多种区域(Region)生成(3)
- great! Auto like, I use pyautogui!
- 为什么SQL语句命中索引比不命中索引要快?
- 计算学生成绩等级(虚函数和多态)
- 2.0springmvc uses restful
- 【FLink】access closed classloader classloader.check-leaked-classloader
- 【图像融合】基于matlab方向离散余弦变换和主成分分析图像融合【含Matlab源码 1907期】
- 为什么TCP握手刚刚好是3次呢?
- 深度学习——几种学习类型
猜你喜欢

JS arguments

【FLink】access closed classloader classloader.check-leaked-classloader

"Daily practice, happy water" 1108 IP address invalidation

JS, BOM, DOM (VI)

CTF_ Web: how to recognize and evaluate a regular expression

leetcode1221. 分割平衡字符串

File upload vulnerability shooting range upload labs learning (pass1-pass5)

为什么SQL语句命中索引比不命中索引要快?

Unity Quad culls shaders with back faces and transparent parts

js的arguments
随机推荐
js中的concat()
【FLink】access closed classloader classloader.check-leaked-classloader
Cascading deletion of gbase 8s
Web3 DApp用户体验最佳实践
Xiaobai learns MySQL - Statistical 'opportunism'
Upgrade PHP to php7 X (III) failure of wechat payment callback
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)
Codeforces Round #802 (Div. 2) C D
ASEMI三相整流桥的工作原理
Php7.2 add JPEG extension
At the age of 30, I began to learn programming by myself. Is it still time for me to have difficulties at home?
Codeforces Round #802 (Div. 2) C D
基于Cortex-M3、M4的精准延时(系统定时器SysTick延时,可用于STM32、ADuCM4050等)
halcon之区域:多种区域(Region)生成(3)
515. find the maximum value / Sword finger offer II 095 in each tree row Longest common subsequence
CTF_ Web: Advanced questions of attack and defense world expert zone WP (19-21)
unity Quad剔除背面并剔除透明部分的shader
大话云原生数据库中的存算分离
Solution of gbase 8s livelock and deadlock
Coordinate system left multiply right multiply