Open applejag opened 4 years ago
Suggested solution is to abuse the MSBuild Batching feature.
I successfully did a small sample in the jilleJr/Newstonsoft.Json-for-Unity.Converters repo to target multiple files after a build (https://github.com/jilleJr/Newtonsoft.Json-for-Unity.Converters/blob/880c3d350f1eb3832d553dd0003e245df5b1e520/Src/Newtonsoft.Json.UnityConverters.Tests/Newtonsoft.Json.UnityConverters.Tests.csproj).
I wonder if the same technique can be applied to force multiple builds of the same target framework, as the AOT, Standalone, and Editor builds all use .NET Standard 2.0.
Nah abusing the Platform targets seems much more appropriate. There should be no harm in defining a platform for AOT, one for Standalone, one for Editor, etc. Then rely on the "Batch Build" feature to build them all. Links:
To fix the TargetFramework issue, maybe that could be resolved with having platform-specific target frameworks? Something like:
<Project Sdk="Microsoft.NET.Sdk">
<Choose>
<When Condition="'$(Platform)'=='Tests'">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
</When>
<When Condition="'$(Platform)'=='Portable'">
<PropertyGroup>
<TargetFramework>portable-net45+win8+wpa81+wp8</TargetFramework>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Otherwise>
</Choose>
</Project>
(MSDN on the <Choose>
element: https://docs.microsoft.com/en-us/visualstudio/msbuild/choose-element-msbuild?view=vs-2019)
Expected behavior
Building with MSBuild either via
dotnet build
,MSBuild.exe
, or via Visual Studio 2019 results in all the different DLLs used in the package:Actual behavior
Only some build. Sometimes it even takes multiple builds to get the most builds. But never the full list.
The missing build DLLs are:
Steps to reproduce
/Src/Newtonsoft.Json.sln
in Visual Studio 2019Details
Host machine OS running Unity Editor π Windows
Unity build target π N/A
Newtonsoft.Json-for-Unity package version π 12.0.301
I was using Unity version π N/A
Checklist
Shutdown Unity, deleted the /Library folder, opened project again in Unity, and problem still remains.(irrelevant)