Clean up project files (reduce conditionals and reference assemblies)#1468
Conversation
2f6b7ec to
7ecca18
Compare
cc477a0 to
049c08a
Compare
| <TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net452;net461;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks> | ||
| <TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks> | ||
| <TargetFrameworks Condition="$(MSBuildVersion) >= 16.8.0">$(TargetFrameworks);net5.0</TargetFrameworks> | ||
| <!-- only run .NET Framework tests on Windows --> |
There was a problem hiding this comment.
Note: keeping the '$(OS)' == 'Windows_NT' here to avoid running .NET Framework test on Linux/macOS. Otherwise dotnet test tries to find mono to run the tests.
| @@ -1,3 +0,0 @@ | |||
| <Project> | |||
| <Import Project="..\Directory.Build.props" /> | |||
There was a problem hiding this comment.
Note: removing redundant file, looking for Directory.Build.props up the folder hierarchy is already the default behavior.
| <TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net461;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks> | ||
| <!-- <TargetFrameworks Condition="'$(OS)' == 'Windows_NT' AND $(ApiVersion) < 6.0.0">$(TargetFrameworks);net452</TargetFrameworks> --> | ||
| <TargetFrameworks Condition="$(MSBuildVersion) >= 16.8.0 AND !$(TargetFrameworks.Contains('net5.0'))">$(TargetFrameworks);net5.0</TargetFrameworks> | ||
| <DefineConstants Condition="$(ApiVersion) >= 6.0.0">$(DefineConstants);RABBITMQ_6_0</DefineConstants> |
There was a problem hiding this comment.
Note: this <DefineConstants> was a duplicate of line 5 above.
9d914dd to
dffcf77
Compare
andrewlock
left a comment
There was a problem hiding this comment.
LGTM, just some minor comments
| <!-- override to remove net452 --> | ||
| <TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net461;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks> | ||
| <TargetFrameworks Condition="$(MSBuildVersion) >= 16.8.0 AND !$(TargetFrameworks.Contains('net5.0'))">$(TargetFrameworks);net5.0</TargetFrameworks> | ||
| <TargetFrameworks>net461;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0</TargetFrameworks> |
There was a problem hiding this comment.
#1477 is about not building samples unless we're going to use them in CI (to avoid waste). This change (and other samples changes) make these build in CI on Linux where previously they weren't. Is that a change we def want to make?
FWIW, I'd rather have the simpler project files, as we can do optimisations in the CI build itself for speed separately.
There was a problem hiding this comment.
TBH, #1477 was more about getting around build errors in one of those projects (i.e. kicking the can down the road 😅). Adding an extra target here on Linux/macOS only adds a few seconds to the build, and I'd rather have the simpler project files as well. It may even help Linux/macOS users find compiler errors that only happen when targeting .NET Framework.
zacharycmontoya
left a comment
There was a problem hiding this comment.
LGTM with some small comments
01565c4 to
badae75
Compare
522764f to
94de9af
Compare
94de9af to
2132ab3
Compare
This week on Cleaning up the old project files...
Remove most
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">Most checks for
'$(OS)' == 'Windows_NT'have been redundant since we added references toMicrosoft.NETFramework.ReferenceAssemblies. These references assemblies allow the .NET SDK to target .NET Framework (net45,net461, etc) even if the .NET Framework SDK is not installed (for example, on Linux and macOS).Remove
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies">.NET SDK 5.0 automatically includes the .NET Framework reference assemblies if needed, so we no longer need the explicit reference to
Microsoft.NETFramework.ReferenceAssemblies.Remove
<PublicSign Condition="...">true</...>.NET SDK 3.0 added support for signing assemblies on non-Windows OS. This public signing workaround to sign on Linux is a holdover from the 2.x era.
Remove
<TargetFrameworks Condition="...">$(TargetFrameworks);net5.0</...>We now support .NET 5 everywhere and require it to build the solution. No need to check the MSBuild version anymore.