Microsoft framework net sdk




















It does not control the OS version that your app or library supports at run time. It's used to select the reference assemblies that your project compiles against, and to select assets from NuGet packages.

When an OS-specific TFM doesn't specify the platform version explicitly, it has an implied value that can be inferred from the base TFM and platform name. For example, the default platform value for iOS in. NET 6 is The implied platform version for a newer base TFM may be higher, for example, a future net7. The shorthand form is intended for use in project files only, and is expanded to the canonical form by the.

This enables you to access platform-specific functionality without waiting for a major release of. For example, if the iOS platform added iOS NET 6. Although a platform-specific app or library is compiled against APIs from a specific version of that OS, you can make it compatible with earlier OS versions by adding the SupportedOSPlatformVersion property to your project file.

If you don't explicitly specify this minimum run-time OS version in the project, it defaults to the platform version from the TFM. However, you can add guards around calls to newer APIs so they are only called when running on a version of the OS that supports them.

This pattern allows you to design your app or library to support running on older OS versions while taking advantage of newer OS functionality when running on newer OS versions. The SupportedOSPlatformVersion value whether explicit or default is used by the platform compatibility analyzer , which detects and warns about unguarded calls to newer APIs.

It's burned into the project's compiled assembly as an UnsupportedOSPlatformAttribute assembly attribute, so that the platform compatibility analyzer can detect unguarded calls to that assembly's APIs from projects with a lower SupportedOSPlatformVersion value. On some platforms, the SupportedOSPlatformVersion value affects platform-specific app packaging and build processes, which is covered in the documentation for those platforms.

Target frameworks are specified in a project file. When a single target framework is specified, use the TargetFramework element. The following console app project file demonstrates how to target. NET When you specify multiple target frameworks, you may conditionally reference assemblies for each target framework. In your code, you can conditionally compile against those assemblies by using preprocessor symbols with if-then-else logic.

The following library project targets APIs of. NET Standard netstandard1. NET Framework net40 and net Use the plural TargetFrameworks element with multiple target frameworks. The Condition attributes include implementation-specific packages when the library is compiled for the two.

The following table shows which elements and which globs are included and excluded in the. Excludes are represented by the DefaultItemExcludes property.

For more information, see WPF default includes and excludes. If you explicitly define any of these items in your project file, you're likely to get a "NETSDK" build error similar to the following:.

Duplicate 'Compile' items were included. You can either remove these items from your project file, or set the 'EnableDefaultCompileItems' property to 'false' if you want to explicitly include them in your project file.

Duplicate 'EmbeddedResource' items were included. You can either remove these items from your project file, or set the 'EnableDefaultEmbeddedResourceItems' property to 'false' if you want to explicitly include them in your project file. Remove the explicit Compile , EmbeddedResource , or None items that match the implicit ones listed on the previous table.

Set the EnableDefaultItems property to false to disable all implicit file inclusion:. If you want to specify files to be published with your app, you can still use the known MSBuild mechanisms for that, for example, the Content element.

Starting in. NET 6, implicit global using directives are added to new C projects. This means that you can use types defined in these namespaces without having to specify their fully qualified name or manually add a using directive. The implicit aspect refers to the fact that the global using directives are added to a generated file in the project's obj directory.

Implicit global using directives are added for projects that use one of the following SDKs:. A global using directive is added for each namespaces in a set of default namespaces that's based on the project's SDK. These default namespaces are shown in the following table.

If you want to disable this feature, or if you want to enable implicit global using directives in an existing C project, you can do so via the ImplicitUsings MSBuild property. You can specify additional implicit global using directives by adding Using items or Import items for Visual Basic projects to your project file, for example:. When targeting. NET Core 1. NET Standard 1. A metapackage is a framework-based package that consists only of dependencies on other packages.

Metapackages are implicitly referenced based on the target framework s specified in the TargetFramework or TargetFrameworks property of your project file. If needed, you can disable implicit package references using the DisableImplicitFrameworkReferences property, and add explicit references to just the frameworks or packages you need.

There are various ways to customize a build. You may want to override a property by passing it as an argument to an msbuild or dotnet command. You can also add the property to the project file or to a Directory. For a list of useful properties for. NET projects can package custom MSBuild targets and properties for use by projects that consume the package. Use this type of extensibility when you want to:. This release includes the.

NET Runtime; you don't need to install it separately. NET Runtime contains just the components needed to run a console app. Typically, you'd also install either the ASP. NET Core Runtime or. NET Desktop Runtime. Home Download. NET 6. Want to learn more about.

NET 6? Check out the announcement blog post. If using an older patch release, you should upgrade to get these fixes. Release notes Latest release date December 14, The software development kit SDK includes everything you need to build and run. NET applications, using command-line tools and any editor like Visual Studio. Run apps - Runtime Tooltip: Do you want to run apps?



0コメント

  • 1000 / 1000