How to disable Costura.Fody resources embedding in Debug mode?

前端 未结 3 1935
醉话见心
醉话见心 2021-02-07 19:49

I\'m using Costura.Fody to embed all dlls into my application assembly.

Is there any way to disable Costura.Fody in Debug build mode? How to make Costura.Fody to work o

相关标签:
3条回答
  • 2021-02-07 20:07

    According to Costura Github, a better possiblity is to open the .csproj and insert following line into the first <PropertyGroup>:

    <DisableFody Condition="'$(Configuration)' == 'Debug'">true</DisableFody>
    

    This way you don't have to modify the file again if there is a package update

    0 讨论(0)
  • 2021-02-07 20:08

    One solution might be to check your .csproj file and add a condition to the Fody-related lines. Something like this:

    <Content Include="FodyWeavers.xml" Condition=" '$(Configuration)' == 'Release' " />
    
    <Import Project="..\..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\..\packages\Fody.1.29.4\build\dotnet\Fody.targets') And '$(Configuration)' == 'Release' " />
    

    Of course, this is mainly for simple use cases where you don't want any Fody extension to run in certain build environments.

    0 讨论(0)
  • 2021-02-07 20:31

    By default Costura.Fody package only adds one line into your *.csproj file:

      <Import Project="Fody.targets" />
    

    Replace it with

      <Import Project="Fody.targets" Condition=" '$(Configuration)' == 'Release' " />
    
    0 讨论(0)
提交回复
热议问题