3

I'm working on a cross-platform application using the Uno Platform. The app consists of 5 standard head projects for my App and a dozen of referenced cross-platform libraries projects (Uno-platform cross-platform library projects, MSBuild.Sdk.Extras, VStudio 2019). Referenced project libraries have multi-target frameworks specified like: netstandard2.0;xamarinios10;xamarinmac20;MonoAndroid90;monoandroid10.0. Solution structure looks like this:

- SolutionApp
    - App.Droid
    - App.iOS
    - App.macOS
    - App.UWP
    - App.Wasm
    - App.Shared
    - MultiTargetLibrary1
    ...
    - MultiTargetLibraryN

The problem is that each time I rebuild any of the head app projects, VStudio rebuilds referenced projects for all the target frameworks available.

How to avoid a compilation of unnecessary target platforms? How can a referenced project get which head project has triggered a build? Is there any possibility to pass which exact target framework is needed in referenced project building from VStudio?

Example: I choose to rebuild App.iOS and it triggered a rebuild of referenced projects. I want projects with only 'xamarinios10' TargetFramework to be built.

If there are only a few target frameworks or projects compilation isn't slow, but with an increasing amount of referenced projects time extremely grows.

As I've got from msbuild reference: VStudio calls msbuild for each project on solution separately, so msbuild doesn't know which head project has triggered the build of the referenced project and which target platform is required.

  • 1
    Hi,please check whether Jerome's answer help you handle this issue, and since it is a well-known issue on DC forum, you can add any comments or vote it on that dc link and the team will give you a reply. Due to it, I suggest you could [consider accepting the answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) so that it will help other community members handle similar issues. – Mr Qian Jun 18 '20 at 08:52
  • Hi, I've already voted for it. Using msbuild on CLI doesn't has such problem. It will be great to have same behavior in VStudio also I think. – Denis Homutovski Jun 19 '20 at 10:44

1 Answers1

3

This is a known Visual Studio 2019 issue, where all targets are built regardless of the actual head project being compiled.

In the meantime, you can manually exclude some target frameworks when building the application, and use the solution filter feature of Visual Studio so that nuget does not complain about invalid project references. That way, you can make 4 filters, with each excluding the projects that are not used for the platform you're currently working on.

Jérôme Laban
  • 5,224
  • 3
  • 20
  • 17