簡體   English   中英

.Net Standard項目中的資源未添加到DLL

[英]Resource in .Net Standard project is not added to DLL

添加到.NET標准項目的資源不會被編譯到DLL中。

我正在將.NET Framework項目移植到.NET Standard。 我的原始項目有一些資源,標記為“ Build Action:Resource”,正在被其他程序集使用。

.NET Standard項目文件。


  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup> *** not sure why this is added by VS2019 **
    <None Remove="Resources\ErrorLarge.png" />
  </ItemGroup>

  <ItemGroup>
    <Resource Include="Resources\ErrorLarge.png" />
  </ItemGroup>

</Project>

通過將“生成操作”屬性從“無”更改為“資源”,DLL的內容和大小不會更改。 自然,我的使用者程序集將返回IOException: Cannot locate resource 'resources/errorlarge.png'. 錯誤。

VS2019-16.2.4

聽起來您想在CSProj文件中使用EmbeddedResource而不是Resource

這似乎對描述添加和閱讀它們很有用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM