Why doesn't ClickOnce in Visual Studio deploy content files from dependent assemblies?

I seemed to have found an evolution of the answer from @John Hunter that is much simpler, add this to the csproj.

<ItemGroup>
    <Content Include="Bin\**\*.rpt" />
</ItemGroup>

This will then make visual studio automatically view all *.rpt files in that folder as part of the solution. You could go with *.* to accumulate everything. This makes more sense if you have a container folder like bin\MyDeployables\**\*.*

We followed a similar usage for using Cassette MSBuild to combine and minifiy our JS at publish time, and be able to publish the created files through the built in VS publish tooling.


I think my answer from this post answers your question.

Summary
Either...
Add your content files to your project using the "Add as link" feature.
Or...
Create a post-build event to copy your content files to the main output folder.


Ok I still don't know why Visual studio cannot display referenced content files with its publish ui but I found a work around to force the publish to include these files.

As suggested by this MSDN article, put this in the project file.

<ItemGroup>
<AdditionalPublishFile Include="$(OutputPath)\**\*.rpt">
  <Visible>False</Visible>
</AdditionalPublishFile>
</ItemGroup>
<Target Name="BeforePublish">
  <Touch Files="@(IntermediateAssembly)" />
  <CreateItem Include="@(AdditionalPublishFile)" AdditionalMetadata="TargetPath=%(RecursiveDir)%(Filename)%(extension);IsDataFile=false">
    <Output TaskParameter="Include" ItemName="_DeploymentManifestFiles" />
  </CreateItem>
</Target>

Note that in some circumstances restarting Visual Studio (not just reloading the project) may be required for these changes to take effect.

Tags:

.Net

Clickonce