Let's say I have this structure of projects:
- AppRunner
| - Apprunner.csproj
| - wwwroot
- Tests
| - Tests.csproj
| - bin
| - debug
| - netcoreapp2.1
| - I want copy wwwroot here
I'd want to tell compiler to copy wwwroot
with all items and folders inside to output folder of tests
but I'd want it to work fine not only on Windows but also on Linux
I addedd to Tests.csproj this:
<ItemGroup>
<None Update="..\AppRunner\wwwroot\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
but it doesn't really work
In your Tests.csproj
you could set up a link to your wwwroot
folder:
<ItemGroup>
<Content Include="..\AppRunner\wwwroot\**" Link="wwwroot\%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="Always" />
</ItemGroup>
In Visual Studio this will look like a regular wwwroot
folder in your Tests
project, but it is actually just a link to the folder in AppRunner
. When you specify CopyToOutputDirectory
this folder and its contents will be copied to the bin folder when you build the Tests
project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With