I created razor pages web app with Visual Studio 2022 (MSBuild version 17?) and added the following to csproj file:
<Target Name="BuildCss" BeforeTargets="Build"
Inputs="Pages/pages.css"
Outputs="wwwroot/css/styles.css">
<Copy SourceFiles="Pages/pages.css" DestinationFiles="wwwroot/css/styles.css" />
</Target>
I will transform Pages/pages.css file before copying it to wwwwroot/css, but for now to test MSBuild’s fast up-to-date-check feature, I just copy the file.
Now, the first time I ran the build, file copy succeeded as expected, but after that it doesn’t work, even if I edit pages.css file or even delete styles.css file. In outputs window I see
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
What am I doing wrong here?