How to add an external file to Web Deploy Package

282 views Asked by At

I have two projects in a VS solution, a class library "Project A" and a web api "Project B". Project A is not referenced by project B, but project A puts it's build output into build directory of project B. When I publish project B to the web server via a Web Deploy Package I want to have the file "instancesettings.json" of project A in it as well. Since building of my solution already puts the instancesettings.json into ProjectB\bin\Release\net6.0 I thought following ProjectB.csproj edit could help:

<ItemGroup>
      <Content Include="$(OutputPath)instancesettings.json">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        <CopyToPublishDirectory>Always</CopyToPublishDirectory>
      </Content>
 </ItemGroup>

But it doesn't. Instancesettings.json isn't copied neither to ProjectB\obj\Release\net6.0 nor to the package temp ProjectB\obj\Release\net6.0\PubTmp\Out. So it isn't deployed to the web server. What settings do I need to do so?

Edit: I've also tried the way suggested on https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-extra-files#update-the-publish-profile-file but with no success...

0

There are 0 answers