0

In my codebase there's a utility project of type lib: MyCode.Utility with TargetPlatform set to AnyCPU in its *.csproj file.

The project is then referenced by an executable, which also targets AnyCPU.

Now I need to introduce a new exe project to my codebase and due to its dependencies it has to target x64 only instead of AnyCPU. I would also like the new project to reference MyCode.Utility.

How shall I configure my projects? In particular I'd like to ensure that my shared library is compiled to the right target, depending on which executable triggers the compilation.

LA.27
  • 1,888
  • 19
  • 35
  • 1
    Since `MyCode.Utility` still has no dependency to X64, but only the new executable (AFAICT), you can simply reference the AnyCPU `MyCode.Utility` form the X64 executable project. You can always reference AnyCPU from all other platforms. Just not the other way around. – Christian.K Apr 29 '22 at 05:58
  • Thanks. Yes, the shared library doesn't have any dependencies. Moreover, I noticed there's a property `Platforms` that I can set in my `*.csproj`. Do I need to use it as well or maybe setting `TargetPlatform` to `AnyCPU` or `x64` is enough? – LA.27 Apr 29 '22 at 08:42

0 Answers0