1 year ago

#318718

test-img

Trygve

Include assemblyBinding app.config additions in NuGet package

I'm trying to create a NuGet package from a WPF .Net Framework app and having trouble including the app.config file. I have this in my csproj file:

<ItemGroup>
  <None Update="App.config" Pack="true">
    <PackagePath>lib\net472\$(PackageId).exe.config</PackagePath>
  </None>
</ItemGroup>

Everything was working until I added a dependency (Microsoft.Extensions.Logging, I think), which inserts assemblyBinding tags into app.config before it is written out to [appName].exe.config in the bin folder. In the NuGet package I get the original app.config file, before the assemblyBinding items have been added. Is there something I can add to my csproj file to direct NuGet to include a file directly from the bin folder? (As I understand it, the above snippet tells it to copy from the source files, which never gets the assemblyBinding elements.)

Why this is necessary: I have a .Net Framework WPF app that I'm distributing using Squirrel. For Squirrel's use I need to create a NuGet package from my app.

c#

nuget

.net-4.7.2

0 Answers

Your Answer

Accepted video resources