首页 > 解决方案 > Need I enable ReadyToRun in each of my dll whlie publish the exe file?

问题描述

As we know, there is ReadyToRun compilation option since .net core 3.0 .

There is several dll that made by .net core .

I created a WPF project and referenced all the dll above.

Now I am about to publish the project with ReadyToRun and there is a problem I am not so sure.

Whether the compiler will compile all the reference dll with ReadyToRun while I just compile the WPF project?

Or I have to compile with the ReadyToRun one by one in its project?

Why I asked the question it is so troublesome to compile so many dll with the different target times. I want to find a fast way to do it.

Thank you .

标签: c#wpf.net-core

解决方案


<PublishReadyToRun>设置添加到您正在发布的项目中就足够了。您也可以使用-p:PublishReadyToRun=true命令行选项:

dotnet publish ... -p:PublishReadyToRun=true

PublishReadyToRunExclude您可以使用项目组排除某些程序集被编译为 ReadyToRun 图像:

<ItemGroup>
    <PublishReadyToRunExclude Include="FilenameOfAssemblyToExclude.dll" />
</ItemGroup>

推荐阅读