See the question and my original answer on StackOverflow

The original PixelShaderCompile task was declared like this in a .csproj:

<Target Name="EffectCompile" Condition="'@(Effect)' != '' ">
  <PixelShaderCompile Sources="@(Effect)">
    <Output TaskParameter="Outputs" ItemName="Resource" />

What this did is 1) compile the .fx files as .ps files (compiled effects) and 2) declare them as Resource for the MSBuild system (same as Visual Studio Build Action Resource) which is understood by WPF project types as WPF resources:

enter image description here

So, when you're building for WPF, you want to emulate that behavior, which you can do like this (my original answer initially only had the Exec command):

<Target Name="EffectCompile" Condition="'@(Effect)' != '' ">
  <Exec Command="&quot;$(MSBuildProgramFiles32)\Windows Kits\10\bin\10.0.22621.0\x64\fxc.exe&quot; /T ps_3_0 /Fo %(Effect.RelativeDir)%(Effect.FileName).ps %(Effect.Identity)"/>

  <!-- Add this if you need to embed the file as WPF resources -->
    <Resource Include="%(Effect.RelativeDir)%(Effect.FileName).ps" />