简体   繁体   English

.net核心软件包依赖项

[英].net core package dependencies

I'm wanting to build a native .NET Core executable that I can deploy but when I publish the project, the compiler exports all the dependencies into the same directory and the executable needs them to run on a system that doesn't have .NET Core runtime installed. 我想构建一个可以部署的本机.NET Core可执行文件,但是当我发布项目时,编译器会将所有依赖项导出到同一目录中,并且可执行文件需要它们在没有.NET的系统上运行已安装核心运行时。 Is there a way to compile/package the DLL's in with the project DLL or executable? 有没有一种方法可以将DLL与项目DLL或可执行文件一起编译/打包? Thanks. 谢谢。

For merging dependencies into the compiled assembly, check out Costura for Fody: 要将依赖项合并到已编译的程序集中,请查看Costura for Fody:

https://github.com/Fody/Fody https://github.com/Fody/Fody

https://github.com/Fody/Costura https://github.com/Fody/Costura

I've used it before, and it works well. 我以前用过,而且效果很好。 You can define certain dependencies to merge in a file called FodyWeavers.xml ( see the Costura-Fody link for examples ). 您可以定义某些依赖项以合并到名为FodyWeavers.xml的文件中( 有关示例,请参见 Costura -Fody链接 )。

So, for example ( taken from the Costura README.md ) you can have two dependencies 'Foo' and 'Bar' that can be merged into your target assembly as follows in the FodyWeavers.xml file. 因此,例如( 取自Costura README.md ),您可以具有两个依赖项“ Foo”和“ Bar”,可以将它们合并到目标组件中,如下所示(在FodyWeavers.xml文件中)。

<Costura>
    <IncludeAssemblies>
        Foo
        Bar
    </IncludeAssemblies>
</Costura>

Other than that, ILMerge is a fine way to go: https://www.nuget.org/packages/ilmerge 除此之外,ILMerge是一种不错的选择: https : //www.nuget.org/packages/ilmerge

EDIT: Found a link describing deploying required .NET core dependencies in a self-contained application: http://druss.co/2016/08/deploy-and-run-net-core-application-without-installed-runtime-self-contained-applications/ 编辑:找到了一个链接,该链接描述了在独立应用程序中部署所需的.NET核心依赖项的情况: http : //druss.co/2016/08/deploy-and-run-net-core-application-without-installed-runtime-self -包含应用程序/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM