Include a Folder in ClickOnce Application

You have to add the items to the project and mark them as 'Content' (select the item in solution explorer, right click, properties, set Build Action).


So Tom has explained how to add a file. You specifically say you would like to add a folder to your ClickOnce application once you publish it. Lets assume you have a folder sitting in the root of your solution named Dependencies which contains a folder Reports which contains all of your RPT files. Here is how you would make sure your deployed app contains all of the contents of the Dependencies folder:

  1. Right click your project in Visual Studio and select "unload project".

  2. Right click and select to edit the csproj file.

  3. Before the closing </Project> tag add this:

    <ItemGroup>
    <Content Include="$(SolutionDir)Dependencies\**\*">
    <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
    <Visible>false</Visible>
    </Content>
    </ItemGroup>

  4. That will add everything from the Dependencies folder into the project. We are using the \**\* syntax at the end of the Include and %(RecursiveDir) to ensure the Reports folder will be present in the published version as well as the report files. Having set <Visible>false</Visible> you won't see the items cluttering up the solution explorer.