Skip to content

Instantly share code, notes, and snippets.

@lawrence-laz
Last active March 17, 2025 19:00
Show Gist options
  • Save lawrence-laz/1d0cd639ffc6fb4814b5a4a7b01e67c5 to your computer and use it in GitHub Desktop.
Save lawrence-laz/1d0cd639ffc6fb4814b5a4a7b01e67c5 to your computer and use it in GitHub Desktop.
Examples for .csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<!-- Copies all content from wwwroot folder to output folder specified in LinkBase -->
<None Include="wwwroot\**" Exclude="wwwroot\**\*.cs" CopyToOutputDirectory="Always" LinkBase="wwwroot\" />
<!-- If above dosn't work, maybe non-SDK style project, or solution has some non-SDK style projects, try this -->
<None Include="wwwroot\**" CopyToOutputDirectory="Always" Link="wwwroot/%(RecursiveDir)%(Filename)%(Extension)" />
<!-- Seems like if item is part of .sln (as opposed to just some outside file) then this is needed -->
<None Include="wwwroot\**" Exclude="wwwroot\**\*.cs" CopyToOutputDirectory="PreserveNewest" Link="wwwroot\%(RecursiveDir)%(Filename)%(Extension)"/>
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment