a viable way would be to have a solution with several projects or even with several solutions that you open one by one in Visual Studio, but project files (C # or VB.NET) always point to the same file in the file system.
for example, several projects in the same solution, one project contains the file normally, and other projects have a link to the file, are added by right-clicking on the project, adding an existing item, selecting a file, and then click the down arrow Add button and select Add as Link .
of course, if the file contains code that belongs to certain frameworks, you should put an if or #ifdef and so on ...
source share