Tried with Visual Studio 2010:
1) Create your external .proj file (or .target) and add your files (I used a different element name, but that doesn't matter)
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <ExternalCompile Include="Program.cs" /> <ExternalCompile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> </Project>
2) Import your external .proj file to the top of the Visual Studio project file :
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="MyExternalSources.proj" /> <PropertyGroup> ...
and change the Compile ItemGroup as follows:
... <ItemGroup> <Compile Include="@(ExternalCompile)" /> </ItemGroup> ...
Warning: You will need to add new elements / files to your external .proj file - all elements / files added from Visual Studio will look like this:
... <ItemGroup> <Compile Include="@(ExternalCompile)" /> <Compile Include="MyNewClass.cs" /> </ItemGroup> ...
Filburt
source share