Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include a Folder in ClickOnce Application

I've created a Windows C# project and made it as ClickOnce Application(Publish feature in Project properties) for Installation. I want to Include a folder which has Crystal Report (rpt) files in it. In my application I have given path of rpt file as my Installation location. How can I include this folder while publish. So that I need not copy the folder manually.

like image 900
itzArun Avatar asked Dec 01 '12 05:12

itzArun


People also ask

How do I add files to ClickOnce deployment?

To add a file to a groupClick the Publish tab. Click the Application Files button to open the Application Files dialog box. In the Application Files dialog box, select the Group field for a file that you wish to include in the new group. In the Download Group field, select a group from the drop-down list.

How do you add prerequisites to a ClickOnce application?

To specify prerequisites to install with a ClickOnce application. With a project selected in Solution Explorer, on the Project menu click Properties. Select the Publish pane. Click the Prerequisites button to open the Prerequisites dialog box.

Where are ClickOnce files stored?

Every ClickOnce application installed on a local computer has a data directory, stored in the user's Documents and Settings folder. Any file included in a ClickOnce application and marked as a "data" file is copied to this directory when an application is installed.

How do I manage updates for a ClickOnce application?

With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Publish tab. Click the Updates button to open the Application Updates dialog box. In the Application Updates dialog box, make sure that the The application should check for updates check box is cleared.


2 Answers

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.

like image 166
Barrie Avatar answered Sep 22 '22 12:09

Barrie


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).

like image 26
Tom Hunter Avatar answered Sep 18 '22 12:09

Tom Hunter