Skip to content

gsdll32.dll isn't included when project is published (WebDeploy) #22

Description

@snebjorn

Hi, I'm using GhostScriptSharp v1.3.1.4 and I've run into an issue when publishing a ASP.NET project.

The post-build event script only works locally.

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "ls '$(SolutionDir)\packages\GhostScriptSharp.*\Tools\gsdll32.dll' | Sort -Descending | Select -First 1 | cp -Destination '$(TargetDir)'; exit 0"

So when the project is published the gsdll32.dll is missing on the server :(

However I found a solution. Inspired from https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-extra-files

You can add the following to the publish profile.

<Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="..\packages\GhostScriptSharp.*\Tools\gsdll32.dll" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>
  <PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>

    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>
  </PropertyGroup>

And now the gsdll32.dll file is published along the other files. 🎉

Not sure if this somehow can be improved upon so this manual edit isn't necessary.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions