luuksommers / SevenZipSharp.Interop

Other
36 stars 10 forks source link

cant deploy on azure webapp #18

Open richardNieuwlandAlten opened 2 years ago

richardNieuwlandAlten commented 2 years ago

Hi, i like to run a command line app in the cloud, but the 7z.dll which is added by me to the project with 'always copy' doesn't end up in the target folder on the webapp after publish. That way, preventing the app to run. Any clue what i need to set in my vs project to use the 7dll that way ? Note: the same happend when i was trying to use the 7dll in an Azure Function.

luuksommers commented 2 years ago

The always copy flag copies files to the Bin folder, you can try to set the build action as content to have the file available during publish.

chucker commented 2 years ago

Try adding a section as follows to your csproj:

  <Target Name="CopySevenZipForPublish" BeforeTargets="PrepareForPublish">
    <Message Importance="high" Text="Copying 7-zip DLLs" />
    <Copy SourceFiles="@(SevenZipSharpInteropFiles)"
          DestinationFiles="@(SevenZipSharpInteropFiles -> '$(PublishDir)%(RecursiveDir)%(Filename)%(Extension)')" />
  </Target>