0

I have a cross-platform shared class library project in my solution. In the other projects (such as xamarin.android, xamarin.ios, uwp, etc.), I add reference to the shared project.

Now when I run build on a platform specific project, the shared project will build for all platform but not only the platform which I am building.

I was wondering if there is any variable I can use for determine the current building platform to avoid a complete build for the shared platfom?

Like:

<TargetFrameworks Condition=" '$(<THE_WONDERFUL_PLATFORM_VARIABLE>)' == 'android' ">MonoAndroidxx</TargetFrameworks>
<TargetFrameworks Condition=" '$(<THE_WONDERFUL_PLATFORM_VARIABLE>)' == 'ios' ">Xamarin.iOSxx</TargetFrameworks>
<TargetFrameworks Condition=" '$(<THE_WONDERFUL_PLATFORM_VARIABLE>)' == 'uwp' ">uapxx.x.xxxx</TargetFrameworks>

Edit:

My project structure is:

project struct

My expected:

enter image description here

Actual:

enter image description here

Link Hylia
  • 63
  • 6
  • Correct me if I am wrong here, You have referenced your shared projects from your native projects and you only want specific projects to be built when you build the native. So wouldn't VS only build the projects that your native project has referenced unless you build the solution? Am I misunderstanding something here? – FreakyAli Jan 28 '22 at 09:24
  • @FreakyAli let me draw some graphs to explain. – Link Hylia Jan 29 '22 at 04:15
  • You think this would work for you https://stackoverflow.com/questions/3842590/how-do-i-set-a-conditional-compile-variable – FreakyAli Jan 30 '22 at 08:39

0 Answers0