Reputation: 16724
I want to add a directory and its files to visual studio keeping the root dir. I did this with the below piece of XML on my .csproj
file but this does add all its files to solution explorer but exclude the root. The file are variable and I don't want to hard code them add manually. That's why I'm looking for an automated solution.
How do I fix this?
<ItemGroup>
<Content Include="bin\x86\release\myFolder\**\*">
<Visible>true</Visible>
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Content>
I would like to include this directory (and not only its files) in ClickOnce publishing.
Upvotes: 0
Views: 495
Reputation: 16724
I couldn't think of any automatic way to created the folder and make the solutin explorer aware of this files. So I created the folder on right click on project -> add folder. Unloaded the project and edited the piece of XML which add the directory I've created to solution explorer to this:
<ItemGroup>
<Content Include="foo\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<Visible>True</Visible>
</Content>
</ItemGroup>
Now solution explorer is aware of that files and so does clickonce. The files get properly in the app.publish
folder
NOTE: On this project, the foo files came from another folder (external C++'s binary output folder). They're copyed at post-build time. The folder name is sort of hard-coded (I need to chage them manually on the VS solution explorer, on the .csproj file and in the xcopy command-line on post-build) cause I didn't find any other way to do that.
Upvotes: 3
Reputation: 132
<Target Name="AddGeneratedFiles" AfterTargets="SOMETASK">
<CreateItem Include="*.cpp">
<Output TaskParameter="Include" ItemName="ClCompile" />
</CreateItem>
</Target>
Upvotes: 0