mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-08 03:27:04 +09:00
![]() * Don't use Targets* helper properties in libs projs This change makes it possible to migrate 200+ (ref+src) projects to use TargetFramework instead of TargetFrameworks which avoids the additional outer build evaluation and invocation which ultimately makes the overall build faster. Targets* properties (i.e. TargetsWindows, TargetsAnyOS, TargetsUnix, etc.) rely on the TargetFramework property which usually are set inside a project. The TargetFramework property is only available before a project specifies it if it's explicitly set in a props file or if the project is cross-targeting and the outer-build dispatches into the inner-build. During the dispatch, the TargetFramework property is passed in as a global property. Until now that behavior wasn't a problem because every libraries project cross-targeted (by setting the TargetFrameworks property) even though many only include a single TargetFramework (i.e. NetCoreAppCurrent). To allow projects to use the TargetFramework property instead of TargetFrameworks, the Targets* helper properties can't be calculated anymore early in a props file as the TargetFramework property isn't set at that time. In general, the guidance by the SDK/msbuild team is to not read from the TargetFramework property before the project sets it (in a property group). That effectively means that the TargetFramework property shouldn't be used in props files at all. Therefore these helper properties can't be used anymore for property conditions and I'm replacing their usage with TargetPlatformIdentifier comparisons for both properties and items. In nearly all cases, the Targets* helper properties can be replaced with TargetPlatformIdentifier checks on items and in the few cases where TargetsUnix or TargetsLinux marks multiple tfms as compatible, the exact tfms must be used instead for the TargetPlatformIdentifier comparison. Whenever a project needs to condition properties on the platform, I'm first setting the TargetPlatformIdentifier the same way the SDK sets it so that the SDK later doesn't need to set it again to avoid the additional expensive msbuild function call. * Use TargetFramework singular to avoid outer builds Use TargetFramework instead of TargetFrameworks property whenever a projects only targets a single target framework. This avoid unnecessary outer builds and evaluations and makes the build faster. |
||
---|---|---|
.. | ||
api-guidelines | ||
adding-api-guidelines.md | ||
breaking-change-definitions.md | ||
breaking-change-rules.md | ||
breaking-changes.md | ||
clr-code-guide.md | ||
clr-jit-coding-conventions.md | ||
code-formatting-tools.md | ||
coding-style.md | ||
cross-platform-guidelines.md | ||
cross-platform-performance-and-eventing.md | ||
EventLogging.md | ||
framework-design-guidelines-digest.md | ||
interop-guidelines.md | ||
libraries-packaging.md | ||
performance-guidelines.md | ||
project-guidelines.md | ||
updating-ref-source.md | ||
vs-cpp-formatting.png | ||
vs-csharp-formatting.png |