C# multi targeting project: skip generating binaries for one of frameworks

51 Views Asked by At

I have a solution containing a number of C# projects which builds for both .net framework 4.7.2 and net 7. Most of the projects target both frameworks, but some UI parts are net 4 only. All projects, including net 4-only ones are in a modern sdk-style format. The problem is that for these net 4-only projects I still need to copy content files to both output folders: common net 4 build folder and common net 7 one. These content files are used by server components. Clearly, I can resolve it by running a post-build command line step, copying files. But this would require to hardcode some output folders, not having net 7 as a build target I can't refer to its output folder. Somehow not elegant. Ideally I would like to add net 7 as a build target to that UI projects, but to block the generation of binaries, which is not possible anyway, they just won't compile. Just to copy content files. Is it possible? Some flag in an sdk-style project?

0

There are 0 best solutions below