* Define convention to include analyzers in ref pack
Fixes https://github.com/dotnet/runtime/issues/61321
Until now we required source libraries to define ProjectReferences when
an analyzer should be part of the shared framework. That strategy causes
analyzer projects to leak into the ProjectReference closure and by that
into a solution file.
As an example:
When another library references the source library that references the
analyzer, the analyzer is part of the dependency closure even though it
might not be required.
This change makes it possible to define the shared framework analyzer
projects in the NetCoreAppLibrary.props file for both the .NETCoreApp,
and the AspNetCoreApp shared framework.
Out-of-band projects which ship analyzers inside their produced package,
continue to reference the analyzers via the `AnalyzerProject` item.
* Use AnalyzerReference consistently
* Don't reference analyzer when its packaged
* Fix P2P reference
* Fix multi target roslyn component target condition
* Only add placeholder pkg file if folder is empty
Originally reported in https://github.com/dotnet/runtime/issues/63413,
placeholder files are added unconditionally by the .NETStandard compat
error packaging infrastructure, even if the
buildTransitive/$(SupportedTFM) folder isn't empty.
That hinders our libraries to package their own set of buildTransitive
props and targets files for the supported set of tfms.
This change makes sure that placeholder files are added only if no None
or Content items are declared that point to the same package folder.
Adding documentation that explains the .NETStandard compatibility
packaging infrasturcture and how to correctly package hand-authored
msbuild files next to the generated targets files.
* Fix NETStandardCompatError empty cases
* Update packaging.targets
* Update coding-style to include target-typed new guideline
Similar to `var` usage, `new()` usage is only allowed when the Type can be understood from the same line.
Fix#53369
* Fix coding style violations
Split the build of shared framework and out-of-band projects so that
it's possible to just build the shard framework projects, which was
requested by the CLR teams. In the next infrastructure rollout, the
current "libs.ref+libs.src" subsets should be removed. Generate the
targeting pack with an incomplete (without shims) frameworklist as part
of the "libs.sfx" subset.
Build the shim projects after the shared framework and oob projects and
re-generate the targeting pack's frameworklist to include the shims.
Refactor the shims so that they aren't grouped anymore by generated &
manual. Instead group them by "ref" and "src" same as other libraries
in the tree which allows to reference the source project shims and read
from the ReferenceAssembly metadata.
Use ProjectReferences in traversal projects and shim projects instead
of named references that point to binplace directories (see graph below)
This allows to build parts of the product dynamically, i.e. the shim
projects, apicompat.proj, sfx.proj and oob.proj.
* 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.
* Remove .NETStandard runtime implementations
Remove the remaining ten .NETStandard runtime specific implementations.
For reasoning please see https://github.com/dotnet/runtime/issues/64536.
* Remove infra support for NS platform specific tfms
Also cleaning-up some logic and stop disabling AppendTargetFramework.
* Respond to feedback in GenerateMultiTargetRoslynComponentTargetsFile
Two small follow up changes from #58446
- Fix a type-o that breaks incremental build. Forgot to use MSBuild property syntax
- Instead of having the infrastructure hard-code removing 'Abstractions', packages can set their own Disable source gen property name.
* PR feedback
* Enable System.Text.Json tests on netfx
* use NETFRAMEWORK define
* disable another two test cases after rebase
* disable last test case which repros only on CI for me
* add p2p only on netfx
* Clarify P/Invoke shims guidance for OOB assemblies
The discussion in PR #63421 clarified that System.Native shims for UNIX
APIs aren't appropriate for assemblies that don't ship as part of the
Microsoft.NETCore.App framework.
Updating the interop guidelines to capture that clarification.
* Update docs/coding-guidelines/interop-guidelines.md
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Simplfy .NETFramework tfms
Libraries which target .NET Framework usually have rid agnostic tfms,
i.e. net461. If the library targets netstandard2.0-windows as well,
the .NET Framework tfm must be rid specific, as rid specific
.NET Framework apps would otherwise pick the .NETStandard asset over
the .NETFramework one (based on the RID compatibility rules)
There is yet another reason that requires .NETFramework tfms to be RID
specific, which is when a project P2Ps other projects which are
rid-specific. Without the RID specific .NETFramework tfm, a compatible
.NETStandard asset would be picked instead.
NuGet doesn't support setting a TargetPlatform in the TargetFramework
alias when targeting .NETFramework or .NETStandard. Any such tfms in
dotnet/runtime are currently leveraging a hack that strips the
TargetPlatform / TargetFrameworkSuffix away during restore and packaging
(as NuGet Pack uses the project.assets.json file).
As NuGet will likely never support RID specific .NETFramework tfm
aliases, the distinction between a RID specific and a RID agnostic
.NETFramework tfm is unnecessary.
Remove all "TargetFrameworkSuffixes" / TargetPlatforms / RIDs
(whatever you would like to call them) from .NETFramework tfms and let
the packaging targets handle the cases where a RID specific asset is
required in the package.
Explictly don't set TargetsWindows to true for .NETFramework builds as
the Targets* properties are infered from the platform / suffix and
many projects make the assumption that net461
(without the "-windows" part) doesn't set TargetsWindows=true.
Fixes https://github.com/dotnet/runtime/issues/58495
* Warn on .NETFramework duplicate runtime assets
* Ignore .NEtFramework non Windows and non empty RIDs
Also cleaning up the packaging.targets file and removing
the ExcludeFromPackage option which isn't needed anymore as
target frameworks aren't excluded from packages produced in
dotnet/runtime anymore.
* Remove EOL tfms and upgrade to net7.0
* Make linker tests net7 aware
Make installer tests run on net7.0
Don't attempt to use live apphost
Fix payloads
Regenerate test files
Fix package testing
* Rename transport packages to follow convention
As agreed on in https://github.com/dotnet/windowsdesktop/pull/1936, we
want to follow a common schema when naming our transport packages.
Also updating the docs to reflect the name changes and to also
accomodate for the WindowsDesktop transport package.
* Update src.proj
* Update src.proj
Use ProjectReferences to compose the aspnetcore tranport package.
Avoid binplacing and with that unnecessary copies which overall
simplifies the infrastructure and allows to add additional transport
packages without creating a binplace configuration for each.
This also makes sure that the dependencies are compatible with the
package's tfm.
* Clean-up pkgproj leftovers in libs and apply fixes
Remove any pkgproj infrastructure that was only used by src/libraries
(which is the majority). Delete the packageindex *YAY*.
Update the documentation that covered the packageindex and the pkgprojs.
Avoid any incremental builds during packaging by removing
libraries-packages.proj and use src.proj for packaging instead. Make use
of the `GeneratePackageOnBuild` property to build package during the
allconfigurations without requiring a different entry target.
Fix the addition of the DocumentationFile during packaging when
`GeneratePackageOnBuid` is used by hooking onto the
`DocumentationProjectOutputGroup` that NuGet uses and replacing the
generated documentation file with the one that comes via the
intellisense package.
Also introduce a property to choose the generated documentation file
over the one from the intellisense package:
<UseIntellisenseDocumentationFile>false</UseIntellisenseDocumentationFile>
Removing a few leftover PackageDescription properties from the projects'
Directory.Build.props file.
Cleaning up properties in Directory.Build.props & Directory.Build.targets
files.
* Actually run packaging during the allconfigurations build
* Update docs
* make runtime specific pkgs non packable
* io.ports native pkg fixes
* Expose missing refs from runtime in targeting pack
The platform analyzers warns for usages of APIs which aren't available
on specific platforms. Exposing the missing reference assemblies which
are already part of the runtime pack in the targeting pack.
The big benefit of doing so is that customers don't need to reference
the corresponding packages to target these APIs and that these five
packages can be dead-ended.
For more in-depth reasoning, see the detailed summary:
https://github.com/dotnet/runtime/issues/53892#issuecomment-858542280
Fixes https://github.com/dotnet/runtime/issues/53892
* Update dependents of dead-ended packages
Update depents by referencing the latest available package. Making sure
that packages are never used on NetCoreAppCurrent by applying
.NETCoreApp version conditions.
* Fixes
* Remove pkg validation suppression file
* Update Windows Compatibility pack
* Fix DirectoryServices pkg references
* Fix netfx Pkcs restore/build
* Fix version conflict
* Packageindex and nits
* nits
* Include NetCoreAppCurrent configs in packages
The NetCoreAppCurrent configurations were omitted from packages to avoid
ever growing packages. Now that we adhere to the support policy for
packages we don't need to exclude them anymore as the policy defines a
baseline for .NETCoreApp configurations.
This will remove an artificial difference when source building the
repository and also make it so that partner repositories which don't
depend on a transport package like windowsdesktop (winforms) receive
the very latest assets that are included in the shared framework as
well.
* Fix package validation for non exposed inbox libs
* Remove the use of IsPartialFacadeAssembly in refererences
This flag requires assembly-re-writing to replace type-defs in reference
assemblies with type forwards, when the same type exists in references.
We've pretty much exclusively used this on .NETFramework, since it's
not friendly to source build (CCI isn't part of source build).
.NETFramework isn't going to be changing so it doesn't save us much
to generate these typeforwards in the build.
We also used these to make sure the netstandard surface area was
compatible with .NETFramework facades (we'd use the pre-rewritten
reference assemblies for contract), but this need goes away now that we
have package validation based APICompat that compares netstandard refs
to net4x facades.
* Fix some projects I missed after changing naming convention
* Fixup another project
* Fix build of System.System.Threading.AccessControl
* Adding a section to ref-source docs on .NETFramework facades
* Address feedback
* Add Analyzer packaging support and packaging documentation
To package Microsoft.Extensions.Logging.Abstractions we needed support
for packing an Analyzer. This adds that support.
I wanted to document this addition, so I created the start of a doc that's
meant to describe the packaging options for libraries in dotnet/runtime.
* Address code review feedback.
* More feedback
* Address more feedback
* Remove src.proj build of generators
* Update to use Microsoft.DotNet.PackageTesting
* Fix typos
* Fix package testing on net46*
* Use [NotNullWhen(true)] in more places
Did a quick search/audit for methods that returned bool and took nullable object as the first input, and added [NotNullWhen(true)] where it was obviously correct.
* Address PR feedback
* renaming `clrcompression` --> `System.IO.Compression.Native`
* rename `clrcompression.def` file
* exclude `System.*.Native.dll` when creating managed shims
* static library should be `System.IO.Compression.Native.lib` on Windows. Same as Globalization - without `lib` prefix
* revert change to the resource string in tests
* move consts to src/Interop, remove `lib` prefix on Windows
* Delete what used to be System.IO.Compression.clrcompression package
* Preserve old PlatformManifestFileEntry for clrcompression.dll
* partially revert the src\Interop change
* Adjust projects for removal of `Interop\Interop.Libraries.cs`
revert 1
* Undo entire System.IO.Compression.csproj to get rid of an invisible edit.
* Trim trailing whitespaces
* Match raw with rendered
* Delete extra asterisks and |
* Update ELT Hooks - tail calls.md
Co-authored-by: Jan Kotas <jkotas@microsoft.com>