I have a visual studio solution that has, amongst other project the following three:
- NamespacePrefix.NancyFX.csproj: Some Nancy modules
- NamespacePrefix.NancyFX.IISHosting.csproj: A web solution to host the nancy modules
- NamespacePrefix.NancyFX.Selfhost.csproj: An exe to host the nancy modules
In addition to rest services there is some html javascript and css in the Views/, Scripts/, and Content/ folders. I want this content in both the IIS Hosting and the Self hosting project. Currently I store the files in the Web project, and copy them over to the self hosting project bu editing the csproj xml like so:
<Target Name="BeforeBuild">
<ItemGroup>
<ContentItems Include="..\NamespacePrefix.NancyFX.IISHosting\Content\**\*.*" />
<ScriptItems Include="..\NamespacePrefix.NancyFX.IISHosting\Scripts\**\*.*" />
<ViewItems Include="..\NamespacePrefix.NancyFX.IISHosting\Views\*.*" />
</ItemGroup>
<Copy SourceFiles="@(ContentItems)" DestinationFiles="$(TargetDir)\Content\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(ScriptItems)" DestinationFiles="$(TargetDir)\Scripts\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(ViewItems)" DestinationFolder="$(TargetDir)\Views" />
</Target>
This works fine, but is there a better way? This seems to give me the best intellisense, etc.
Add->Existing item...option? – Konrad Kokosa Jan 20 '14 at 16:18