[英]C# - why costura and fody doesn't work to me?
(使用了翻譯器。)我正在使用 Costura 和 Fody 制作一個 exe 文件。 但是,如果 dll 文件丟失,則無法運行。 我的 Visual Studio 中有一個警告。 警告: FodyPackageReference Fody: The package reference for Costura.Fody is missing the 'compile' part in the IncludeAssets setting; it's recommended to completely remove IncludeAssets
FodyPackageReference Fody: The package reference for Costura.Fody is missing the 'compile' part in the IncludeAssets setting; it's recommended to completely remove IncludeAssets
我也有這個警告。 但它對我來說很好。 因此,導致您的問題的不是警告。
在我看來,可能是因為 costura 版本不適合您的項目。 你可以試試舊版本。
至於我,我的項目使用的是 .net 框架 4.6,最新的 costura.fody 5.3 對我不起作用。 但是 5.2 工作正常。
以及如何刪除警告:(編輯 csproj 文件)
<ItemGroup>
<PackageReference Include="Costura.Fody">
<Version>5.2.0</Version>
<!--<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
看起來像以前的答案,我以這種方式擺脫了警告:
<IncludeAssets>runtime; compile; build;.....
實際上,錯誤消息告訴您該怎么做:“...建議完全刪除 IncludeAssets”。
更具體地說,在您的項目文件(.csproj 或 .vbprog)中找到它作為示例的位置:
<PackageReference Include="Fody">
<Version>6.3.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
並將其更改為:
<PackageReference Include="Fody">
<Version>6.3.0</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
(即完全刪除 <IncludeAssets.....> 行)。
為costura 和fody 執行此操作(如適用)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.