Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for using MSBuild project SDKs #487

Merged
merged 9 commits into from
Jan 25, 2018
Merged

Add documentation for using MSBuild project SDKs #487

merged 9 commits into from
Jan 25, 2018

Conversation

jeffkl
Copy link
Contributor

@jeffkl jeffkl commented Jan 24, 2018

Fix casing of Sdk attribute in Project element reference and include an example

@opbldsb2
Copy link

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/how-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

@jeffkl
Copy link
Contributor Author

jeffkl commented Jan 24, 2018

Please review @AndyGerlicher and @rainersigwald

Copy link
Contributor

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mikejo5000 can you take a look too?

@@ -57,7 +58,7 @@ Required root element of an [!INCLUDE[vstecmsbuild](../extensibility/internals/i
|---------------|-----------------|
|`DefaultTargets`|Optional attribute.<br /><br /> The default target or targets to be the entry point of the build if no target has been specified. Multiple targets are semi-colon (;) delimited.<br /><br /> If no default target is specified in either the `DefaultTargets` attribute or the [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] command line, the engine executes the first target in the project file after the [Import](../msbuild/import-element-msbuild.md) elements have been evaluated.|
|`InitialTargets`|Optional attribute.<br /><br /> The initial target or targets to be run before the targets specified in the `DefaultTargets` attribute or on the command line. Multiple targets are semi-colon (;) delimited.|
|`SDK`|Optional attribute. (Available only for .NET Core projects in Visual Studio 2017 or later.)<br /><br /> The SDK version to use to create implicit Import statements that are added to the .proj file. For example, `<Project Sdk="Microsoft.NET.Sdk/1.0.0-RC" />`.|
|`Sdk`|Optional attribute. <br /><br /> The SDK name and optional version to use to create implicit Import statements that are added to the .proj file. If no version is specified, a default SDK will be looked for. Example, `<Project Sdk="Microsoft.NET.Sdk" />` or `<Project Sdk="My.Custom.Sdk/1.0.0" />`.|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a default SDK will be looked for doesn't read right to me. If no version is specified, the toolset will attempt to resolve a default version of that SDK, if it exists?

2. Use the `<Sdk/>` element for implicit imports:
```xml
<Project>
<Sdk Name="Microsoft.NET.Sdk" Version="1.2.3" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not use Microsoft.NET.Sdk for examples with versions, since we expect to not want people to specify versions for that. Make up an example SDK?

```
An implicit import is added to the top and bottom of the project as discussed above. The format of the `Sdk` attribute is `Name[/Version]` where Version is optional. For example, you can specify `Microsoft.NET.Sdk/1.2.3`.

2. Use the `<Sdk/>` element for implicit imports:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the top-level Sdk element . . .

When using the `<Import/>` element, you can specify an optional `Version` attribute as well. For example, you can specify `<Import Project="Sdk.props" Sdk="My.Custom.Sdk" Version="1.2.3" />`.

## How Project SDKs are Resolved
When evaluating the import, [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] dynamically resolves the path to the project SDK based on the name and version you specified. [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] also has a list of registered SDK resolvers which are plug-ins that locate project SDKs on your machine. These plug-ins include:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"also"?

- "MSBuild, SDKs"
- "MSBuild, overriding DependsOn properties"
- "MSBuild, extending Visual Studio builds"
- "MSBuild, DependsOn properties"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not all of these?

- "multiple"
---
# How to: Use MSBuild Project SDKs
In [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] 15.0 a new concept was introduced called project software development kits (SDKs).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSBuild 15.0 introduced the concept of the "project Sdk", which simplifies using software development kits that require properties and targets to be imported.

```
An implicit import is added to the top and bottom of the project as discussed above. The format of the `Sdk` attribute is `Name[/Version]` where Version is optional. For example, you can specify `Microsoft.NET.Sdk/1.2.3`.

2. Use the `<Sdk/>` element for implicit imports:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add the Sdk element in the schema documentation.

This resolver is only active if you specified an optional version and can be used for any custom project SDK.
2. A .NET CLI resolver that resolves SDKs that are installed with .NET CLI.<br/>
This resolver locates project SDKs such as `Microsoft.NET.Sdk` and `Microsoft.NET.Sdk.Web` which are part of the product.
3. A default resolver that resolves SDKs that installed with MSBuild.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that were installed with msbuild

"My.Other.Sdk": "1.0.0-beta"
}
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After defining a version for an Sdk in global.json, reference it with no version in individual project files.

@opbld10
Copy link

opbld10 commented Jan 24, 2018

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/how-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

@opbld10
Copy link

opbld10 commented Jan 24, 2018

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/how-to-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded
docs/msbuild/sdk-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

@opbld11
Copy link

opbld11 commented Jan 25, 2018

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/how-to-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded
docs/msbuild/sdk-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

Copy link
Collaborator

@Mikejo5000 Mikejo5000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffkl @rainersigwald Jeff, Would you add nav links to the new topics in docs/extensibility/TOC.md? Thx!

@Mikejo5000 Mikejo5000 self-assigned this Jan 25, 2018
@opbldsb3
Copy link

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/TOC.md ✅Succeeded
docs/msbuild/how-to-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded
docs/msbuild/sdk-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

@jeffkl
Copy link
Contributor Author

jeffkl commented Jan 25, 2018

@Mikejo5000 I didn't see any relevant sections in docs/extensibility/TOC.md but I did just update docs/msbuild/TOC.md, thanks for pointing that out. Do you have any other specific TOC areas you think I should update?

@Mikejo5000
Copy link
Collaborator

@jeffkl docs/msbuild/TOC.md is the correct file. Thanks!

@opbld13
Copy link

opbld13 commented Jan 25, 2018

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/TOC.md ✅Succeeded
docs/msbuild/how-to-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded
docs/msbuild/sdk-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

@opbldsb9
Copy link

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/TOC.md ✅Succeeded
docs/msbuild/how-to-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded
docs/msbuild/sdk-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

Copy link
Collaborator

@Mikejo5000 Mikejo5000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffkl @rainersigwald Looks good. Made a few minor edits.

@opbld10
Copy link

opbld10 commented Jan 25, 2018

✅ Validation status: passed

File Status Preview URL Details
docs/msbuild/TOC.md ✅Succeeded
docs/msbuild/how-to-use-project-sdk.md ✅Succeeded
docs/msbuild/project-element-msbuild.md ✅Succeeded
docs/msbuild/sdk-element-msbuild.md ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

@Mikejo5000 Mikejo5000 merged commit 5290854 into MicrosoftDocs:master Jan 25, 2018
@jeffkl jeffkl deleted the sdks branch January 25, 2018 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants