Skcussm
Skcussm

Reputation: 698

How do I include an externally maintained directory as a VisualStudio 2008 C# Project Resource?

I have a directory which contains externally maintained html help files for a Visual Studio 2008 project. The directory could potentially contain an arbitrary number of files from build to build. I know how to add a directory and files to a project including them through the Solution Explorer as required output (content), but in this case I want to always automatically include the specified html directory, all of its subfolders, and all of its files without having to set properties each time a file is added.

I do not want to set the "Build Action" and "Copy to Output Directory" properties each time each time there are changes in the help files. Another constraint is I am using both an installation project (part of the same solution) and a ClickOnce install depending on the deployment environment. This seems like it should be incredibly simple, but I have been unable to find an answer so far.

Thanks for the help!

Upvotes: 0

Views: 85

Answers (1)

Jeremy Wiebe
Jeremy Wiebe

Reputation: 3953

One method you might look into is to tweak the .csproj file and add a post build target to do the copying. This should be close to what you need:

<ItemGroup>
    <DocumentationFiles Include="DocsDirectory\**\*"/>
</ItemGroup>

<Target Name="AfterBuild">
    <Copy
        SourceFiles="@(DocumentationFiles)"
        DestinationFolder="Output\Docs\"
    />
</Target>

Upvotes: 1

Related Questions