Last active
March 5, 2021 11:17
-
-
Save wallymathieu/80fa79d0f5e7b5107cbc7e025df2eeaf to your computer and use it in GitHub Desktop.
Recursive include of c# files in a project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp2.0</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<Compile Include="..\SomeOtherProject\SomeFolder\*.cs"> | |
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link> | |
</Compile> | |
</ItemGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<!-- ... | |
based on https://stackoverflow.com/questions/7643615/how-can-i-get-msbuild-to-copy-all-files-marked-as-content-to-a-folder-preservin | |
--> | |
<WWWRoot>$(ProjectDir)wwwroot</WWWRoot> | |
</PropertyGroup> | |
<ItemGroup> | |
<!-- Specify a file collection WWWRootFiles: --> | |
<WWWRootFiles Include="..\wwwroot\**\*.*"></WWWRootFiles> | |
</ItemGroup> | |
<Target Name="CopyContentFiles" AfterTargets="Build"> | |
<!-- Copy files into the relative folder: --> | |
<Copy SourceFiles="@(WWWRootFiles)" | |
DestinationFiles="@(WWWRootFiles->'$(WWWRoot)\%(RelativeDir)\%(Filename)%(Extension)')" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://blog.samstephens.co.nz/2010/10/18/msbuild-including-extra-files-multiple-builds/