© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3mo ago•
5 replies
Infi

Csproj Content Include Behaviour

So i have a setup that requires me to build my C# project after a nodejs project has been built, i managed to get that done using

<Target Name="NodeJS Compile" BeforeTargets="BeforeCompile">
    <Exec Command="npm install" WorkingDirectory="Http\Frontend"/>
    <Exec Command="npm run build" WorkingDirectory="Http\Frontend"/>
</Target>
<Target Name="NodeJS Compile" BeforeTargets="BeforeCompile">
    <Exec Command="npm install" WorkingDirectory="Http\Frontend"/>
    <Exec Command="npm run build" WorkingDirectory="Http\Frontend"/>
</Target>


The resulting files from svelte are placed inside a "build" directory and need to be shipped with the C# project finally, but
<Content Include="Http\Frontend\build\**">
<Content Include="Http\Frontend\build\**">
does take its file-list before the compile occured so it tries to copy older files

Going with a
<Target Name="BeforeBuild" AfterTargets="Build">
    <ItemGroup>
        <Content Include="Http\Frontend\build\**">
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
    </ItemGroup>
</Target>
<Target Name="BeforeBuild" AfterTargets="Build">
    <ItemGroup>
        <Content Include="Http\Frontend\build\**">
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
    </ItemGroup>
</Target>

just copies nothing at all ...

Any idea how i can fix this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Inlcude content after run a command (.csproj)
C#CC# / help
2y ago
✅ Local csproj
C#CC# / help
11mo ago
Configure .csproj
C#CC# / help
11mo ago
.Csproj problems
C#CC# / help
2y ago