Automatically add links to class source files under a specified directory of an another project in V
- by Binary255
I want to share some class source files between two projects in Visual Studio 2008. I can't create a project for the common parts and reference it (see my comment if you are curious to why).
I've managed to share some source files, but it could be a lot more neat. I've created a test solution called Commonality.
The Solution Explorer of the Commonality solution which contains project One and Two:
What I like:
All class files under the Common folder of project One are automatically added to project Two by linking. It's mostly the same as if I would have chosen Add / Existing Item... : Add As Link on each new class source file.
It's clear that these files have been linked in. The shortcut arrow symbol is marking each file icon.
What I do not like:
The file and folder tree structure under Common of project One isn't included. It's all flat.
The linked source files are shown under the project root of project Two. It would look much less cluttered if they were located under Common like in project One.
The file tree structure of the Commonality solution which contains project One and Two:
$ tree /F /A
Folder PATH listing for volume Cystem
Volume serial number is 0713370 1337:F6A4
C:.
| Commonality.sln
|
+---One
| | One.cs
| | One.csproj
| |
| +---bin
| | \---Debug
| | One.vshost.exe
| | One.vshost.exe.manifest
| |
| +---Common
| | | Common.cs
| | | CommonTwo.cs
| | |
| | \---SubCommon
| | CommonThree.cs
| |
| +---obj
| | \---Debug
| | +---Refactor
| | \---TempPE
| \---Properties
| AssemblyInfo.cs
|
\---Two
| Two.cs
| Two.csproj
| Two.csproj.user
| Two.csproj~
|
+---bin
| \---Debug
+---obj
| \---Debug
| +---Refactor
| \---TempPE
\---Properties
AssemblyInfo.cs
And the relevant part of project Two's project file Two.csproj:
<ItemGroup>
<Compile Include="..\One\Common\**\*.cs">
</Compile>
<Compile Include="Two.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
How do I address what I do not like, while keeping what I like?