Open iamKunal opened 3 years ago
First remove these nuget packages:
<PackageReference Include="Microsoft.Build" Version="16.11.0" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="16.11.0" />
you do not want to both use the msbuild locator and then load your own version of msbuild assemblies.
Why am I receiving 7 projects instead of 5 in step 2, just by targetting 2 platforms and why is the split 5 and 2.
each TFM is represented as a separate project by MSBuild. This has always been the case. For every separate TFM your project is built an additional time. These projects are built twice.
Another issue is, doing the same under Windows (VS Version 17.0.0 Preview 4.0) I get 5 and 2 dependency sets instead, index 2 or 3 from A moves to B. Why this different behavior across different OS?
I will need to check but are there no errors or warnings written out by the workspace in either case? Have you done the following to your workspace?
workspace.WorkspaceFailed += (o, e) => Console.WriteLine(e.Diagnostic.Message);
I will need to check but are there no errors or warnings written out by the workspace in either case? Have you done the following to your workspace?
workspace.WorkspaceFailed += (o, e) => Console.WriteLine(e.Diagnostic.Message);
I get the following warnings:
Windows:
[19:46:10 WRN] MSBuild Diagnostic Warning: Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace, {"Diagnostic": {"ProjectId": {"Id": "596fd731-b340-44d3-b176-ebde27abd9ba", "$type": "ProjectId"}, "Kind": "Warning", "Message": "Found project reference without a matching metadata reference: H:\\dev\\structurizr\\Structurizr.Client\\Structurizr.Client.csproj", "$type": "ProjectDiagnostic"}, "$type": "WorkspaceDiagnosticEventArgs"}
Linux:
[23:03:52 WRN] MSBuild Diagnostic Warning: Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace, {"Diagnostic": {"Kind": "Failure", "Message": "Msbuild failed when processing the file '/tmp/code/structurizr-dotnet/Structurizr.Core/Structurizr.Core.csproj' with message: /usr/share/dotnet/sdk/5.0.101/Microsoft.Common.CurrentVersion.targets: (1180, 5): The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks", "$type": "WorkspaceDiagnostic"}, "$type": "WorkspaceDiagnosticEventArgs"}
[23:03:52 WRN] MSBuild Diagnostic Warning: Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace, {"Diagnostic": {"Kind": "Failure", "Message": "Msbuild failed when processing the file '/tmp/code/structurizr-dotnet/Structurizr.Core/Structurizr.Core.csproj' with message: /usr/share/dotnet/sdk/5.0.101/Microsoft.Common.CurrentVersion.targets: (1180, 5): The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks", "$type": "WorkspaceDiagnostic"}, "$type": "WorkspaceDiagnosticEventArgs"}
[23:03:54 WRN] MSBuild Diagnostic Warning: Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace, {"Diagnostic": {"Kind": "Failure", "Message": "Msbuild failed when processing the file '/tmp/code/structurizr-dotnet/Structurizr.Client/Structurizr.Client.csproj' with message: /usr/share/dotnet/sdk/5.0.101/Microsoft.Common.CurrentVersion.targets: (1180, 5): The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks", "$type": "WorkspaceDiagnostic"}, "$type": "WorkspaceDiagnosticEventArgs"}
[23:03:54 WRN] MSBuild Diagnostic Warning: Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace, {"Diagnostic": {"Kind": "Failure", "Message": "Msbuild failed when processing the file '/tmp/code/structurizr-dotnet/Structurizr.Client/Structurizr.Client.csproj' with message: /usr/share/dotnet/sdk/5.0.101/Microsoft.Common.CurrentVersion.targets: (1180, 5): The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks", "$type": "WorkspaceDiagnostic"}, "$type": "WorkspaceDiagnosticEventArgs"}
[23:03:54 WRN] MSBuild Diagnostic Warning: Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace, {"Diagnostic": {"ProjectId": {"Id": "f4951a2c-8fcf-4841-94e7-8962622ee1a3", "$type": "ProjectId"}, "Kind": "Warning", "Message": "Found project reference without a matching metadata reference: /tmp/code/structurizr-dotnet/Structurizr.Core/Structurizr.Core.csproj", "$type": "ProjectDiagnostic"}, "$type": "WorkspaceDiagnosticEventArgs"}
[23:03:54 WRN] MSBuild Diagnostic Warning: Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace, {"Diagnostic": {"ProjectId": {"Id": "5e774eae-50f2-4ad3-aec9-b38c47ac273c", "$type": "ProjectId"}, "Kind": "Warning", "Message": "Found project reference without a matching metadata reference: /tmp/code/structurizr-dotnet/Structurizr.Client/Structurizr.Client.csproj", "$type": "ProjectDiagnostic"}, "$type": "WorkspaceDiagnosticEventArgs"}
On linux 4/6 warnings were due to .NET v4.5
, 1 for Structurizr.Client.csproj
was common across linux and windows, but Structurizr.Core.csproj
was extra.
Do those linux build warnings show up of you do dotnet build
? MSBuildWorkspace needs the project to be buildable, and have dotnet restore
run on it.
Version Used:
Running on linux:
Steps to Reproduce:
Structurizr.sln
present at the root of the repo:Expected Behavior:
projectsList
in step 2:Actual Behavior:
projectsList
in total in step 2:Note that index 0,1 and 4,5 simply have two target platforms.
Secondly upon running step 3, I received 2 dependency sets: A.
B.
Q1. Why am I receiving 7 projects instead of 5 in step 2, just by targetting 2 platforms and why is the split 5 and 2.
Q2. Another issue is, doing the same under Windows (VS Version 17.0.0 Preview 4.0) I get 5 and 2 dependency sets instead, index 2 or 3 from A moves to B. Why this different behavior across different OS?