Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 2 additions & 4 deletions .ghal.rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"(?i)dotnet-fsharp$": ":books: Area - F# Guide",
"(?i)dotnet-ml$": ":books: Area - ML.NET Guide",
"(?i)dotnet$": ":books: Area - .NET Guide",
"(?i)dotnet-api$": ":books: Area - API Reference,:file_folder: Repo - dotnet-api-docs"
"(?i)dotnet-ml-api$": ":books: Area - API Reference,:file_folder: Repo - ml-api-docs"
},
"contentsource": {
"(?i).*master\/docs\/core\/tools.*": ":card_file_box: Technology - CLI",
Expand All @@ -30,9 +30,7 @@
"(?i).*master\/docs\/standard\/modernize-with-azure-and-containers.*": ":card_file_box: Technology - .NET Architecture,:book: guide - Modernizing w/ Windows containers",
"(?i).*master\/docs\/standard\/security.*": ":card_file_box: Technology - Security",
"(?i).*master\/docs\/standard\/serverless-architecture.*": ":card_file_box: Technology - .NET Architecture,:book: guide - Serverless apps",
"(?i).*dotnet-api-docs\/blob\/master\/xml\/system\\.net.*": ":card_file_box: Technology - NCL",
"(?i).*dotnet-api-docs\/blob\/master\/xml\/system\\.windows\\.forms.*": ":card_file_box: Technology - WinForms",
"(?i).*dotnet-api-docs\/blob\/master\/xml\/system\\.security.*": ":card_file_box: Technology - Security"
"(?i).*master\/docs\/standard\/standard\/design-guidelines\/.*": ":book: guide - Framework Design Guidelines"
}
}
}
8 changes: 8 additions & 0 deletions .openpublishing.redirection.json
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,14 @@
"source_path": "docs/csharp/tutorials/microservices.md",
"redirect_url": "/dotnet/core/docker/",
"redirect_document_id": false
},
{
"source_path":"docs/csharp/language-reference/keywords/true-operator.md",
"redirect_url":"/dotnet/csharp/language-reference/keywords/true-false-operators"
},
{
"source_path":"docs/csharp/language-reference/keywords/false-operator.md",
"redirect_url":"/dotnet/csharp/language-reference/keywords/true-false-operators"
}
]
}
1 change: 0 additions & 1 deletion docs/core/additional-tools/dotnet-svcutil-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: WCF svcutil tool overview
description: An overview of the Microsoft WCF dotnet-svcutil tool that adds functionality for .NET Core and ASP.NET Core projects, similar to the WCF svcutil tool for .NET Framework projects.
author: mlacouture
ms.author: jralexander
ms.date: 08/20/2018
ms.custom: "seodec18"
---
Expand Down
79 changes: 50 additions & 29 deletions docs/core/additional-tools/dotnet-svcutil.xmlserializer-guide.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
---
title: Using dotnet-svcutil.xmlserializer on .NET Core
description: Learn how you can use the `dotnet-svcutil.xmlserializer` NuGet package to pre-generate a serialization assembly for .NET Core projects.
author: huanwu
ms.date: 11/27/2018
---
# Using dotnet-svcutil.xmlserializer on .NET Core

## Prerequisites
The `dotnet-svcutil.xmlserializer` NuGet package can pre-generate a serialization assembly for .NET Core projects. It pre-generates C# serialization code for the types in the client application that are used by the WCF Service Contract and that can be serialized by the XmlSerializer. This improves the startup performance of XML serialization when serializing or deserializing objects of those types.

The following is required for dotnet-svcutil.xmlserializer to work.
## Prerequisites

* [.NET Core 2.1 SDK or later](https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300)
* [.NET Core Runtime 2.1 or later](https://www.microsoft.com/net/download/dotnet-core/runtime-2.1.0)
* [.NET Core 2.1 SDK](https://www.microsoft.com/net/download) or later
* Your favorite code editor

You can use the command `dotnet --info` to check which versions of .NET Core SDK and runtime you already have installed.

To use dotnet-svcutil.xmlserializer in a .NET Core console application:
## Getting started

To use `dotnet-svcutil.xmlserializer` in a .NET Core console application:

1. Create a WCF Service named 'MyWCFService' using the default template 'WCF Service Application' in .NET Framework. Add ```[XmlSerializerFormat]``` attribute on the service method like the following
```c#
1. Create a WCF Service named 'MyWCFService' using the default template 'WCF Service Application' in .NET Framework. Add `[XmlSerializerFormat]` attribute on the service method like the following:

```csharp
[ServiceContract]
public interface IService1
{
Expand All @@ -21,34 +30,42 @@ To use dotnet-svcutil.xmlserializer in a .NET Core console application:
string GetData(int value);
}
```
2. Create a .NET Core console application as WCF client application that targets at netcoreapp 2.1, e.g. create an app named 'MyWCFClient' with the command,
```

2. Create a .NET Core console application as WCF client application that targets at .NET Core 2.1 or later versions. For example, create an app named 'MyWCFClient' with the following command:

```console
dotnet new console --name MyWCFClient
```
Make sure your csproj targets a netcoreapp 2.1. This is done using the following XML element in your .csproj file

To ensure your project is targeting .NET Core 2.1 or later, inspect the `TargetFramework` XML element in your project file:

```xml
<TargetFramework>netcoreapp2.1</TargetFramework>
```
3. Add a package reference to System.ServiceModel.Http by running the following command:

```dotnet add package System.ServiceModel.Http -v 4.5.0```

3. Add a package reference to `System.ServiceModel.Http` by running the following command:

```console
dotnet add package System.ServiceModel.Http
```

4. Add the WCF Client code:

```csharp
using System.ServiceModel;

class Program
{
static void Main(string[] args)

class Program
{
var myBinding = new BasicHttpBinding();
var myEndpoint = new EndpointAddress("http://localhost:2561/Service1.svc"); //Fill your service url here
var myChannelFactory = new ChannelFactory<IService1>(myBinding, myEndpoint);
IService1 client = myChannelFactory.CreateChannel();
string s = client.GetData(1);
((ICommunicationObject)client).Close();
static void Main(string[] args)
{
var myBinding = new BasicHttpBinding();
var myEndpoint = new EndpointAddress("http://localhost:2561/Service1.svc"); //Fill your service url here
var myChannelFactory = new ChannelFactory<IService1>(myBinding, myEndpoint);
IService1 client = myChannelFactory.CreateChannel();
string s = client.GetData(1);
((ICommunicationObject)client).Close();
}
}
}

[ServiceContract]
public interface IService1
Expand All @@ -58,17 +75,21 @@ To use dotnet-svcutil.xmlserializer in a .NET Core console application:
string GetData(int value);
}
```
5. Edit the .csproj file and add a reference to the dotnet-svcutil.xmlserializer package. For example:

i. Run command: `dotnet add package dotnet-svcutil.xmlserializer -v 1.0.0`
5. Add a reference to the `dotnet-svcutil.xmlserializer` package by running the following command:

```console
dotnet add package dotnet-svcutil.xmlserializer
```

ii. Add the following lines in MyWCFClient.csproj,
Running the command should add an entry to your project file similar to this:

```xml
<ItemGroup>
<DotNetCliToolReference Include="dotnet-svcutil.xmlserializer" Version="1.0.0" />
</ItemGroup>
```

6. Build the application by running `dotnet build`. If everything succeeds, an assembly named MyWCFClient.XmlSerializers.dll will be generated in the output folder. You will see warnings in the build output if the tool failed to generate the assembly.
6. Build the application by running `dotnet build`. If everything succeeds, an assembly named *MyWCFClient.XmlSerializers.dll* is generated in the output folder. If the tool failed to generate the assembly, you'll see warnings in the build output.

7. Start the WCF service e.g. by running http://localhost:2561/Service1.svc in the browser. Then start the client application, and it will automatically load and use the pre-generated serializers at runtime.
7. Start the WCF service by, for example, running `http://localhost:2561/Service1.svc` in the browser. Then start the client application, and it will automatically load and use the pre-generated serializers at runtime.
9 changes: 4 additions & 5 deletions docs/core/additional-tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
title: .NET Core additional CLI tools
description: An overview of the additional tools you can install that support and extend .NET Core functionality.
author: mlacouture
ms.author: johalex
ms.date: 01/19/2018
ms.custom: "seodec18"
ms.date: 11/27/2018
ms.custom: "mvc, seodec18"
---
# .NET Core additional tools overview

Expand All @@ -16,12 +15,12 @@ The WCF (Windows Communication Foundation) Web Service Reference is a Visual Stu

## [WCF dotnet-svcutil tool](dotnet-svcutil-guide.md)

The WCF (Windows Communication Foundation) dotnet-svcutil tool is a .NET Core CLI tool that retrieves metadata from a web service on a network location or from a WSDL file, and generates a source file compatible with .NET Core, defining a WCF proxy class with methods that you can use to access the web service operations.
The WCF (Windows Communication Foundation) dotnet-svcutil tool is a .NET Core CLI tool that retrieves metadata from a web service on a network location or from a WSDL file, and generates a source file compatible with .NET Core, defining a WCF proxy class with methods that you can use to access the web service operations.
The **dotnet-svcutil** tool is an alternative option to the [**WCF Web Service Reference**](wcf-web-service-reference-guide.md) Visual Studio connected service provider which first shipped with Visual Studio 2017 v15.5. The **dotnet-svcutil** tool as a .NET Core CLI tool, is available cross-platform on Linux, macOS, and Windows.

## [WCF dotnet-svcutil.xmlserializer tool](dotnet-svcutil.xmlserializer-guide.md)

On the .NET Framework, you can pre-generate a serialization assembly using the svcutil tool. The dotnet-svcutil.xmlserializer NuGet package provides similar functionality on .NET Core. It per-generates C# serialization code for the types in the client application that are used by the WCF Service Contract and that can be serialized by the <xref:System.Xml.Serialization.XmlSerializer>. This improves the startup performance of XML serialization when serializing or deserializing objects of those types.
On the .NET Framework, you can pre-generate a serialization assembly using the svcutil tool. The dotnet-svcutil.xmlserializer NuGet package provides similar functionality on .NET Core. It pre-generates C# serialization code for the types in the client application that are used by the WCF Service Contract and that can be serialized by the <xref:System.Xml.Serialization.XmlSerializer>. This improves the startup performance of XML serialization when serializing or deserializing objects of those types.

## [XML Serializer Generator](xml-serializer-generator.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: Add WCF Web Service Reference
description: An overview of the Microsoft WCF Web Service Reference Provider Tool that adds functionality for .NET Core and ASP.NET Core projects, similar to Add Service Reference for .NET Framework projects.
author: mlacouture
ms.author: johalex
ms.date: 04/19/2018
ms.custom: "mvc, seodec18"
---
Expand Down
42 changes: 20 additions & 22 deletions docs/core/additional-tools/xml-serializer-generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: "Microsoft XML Serializer Generator"
description: An overview of the Microsoft XML Serializer Generator. Use the XML Serializer Generator to generate an XML serialization assembly for the types contained in your project.
author: mlacouture
ms.author: johalex
ms.date: 01/19/2017
ms.topic: tutorial
ms.custom: "mvc, seodec18"
Expand All @@ -16,16 +15,16 @@ This tutorial teaches you how to use the Microsoft XML Serializer Generator in a
> * How to add a reference to the Microsoft.XmlSerializer.Generator package
> * How to edit your MyApp.csproj to add dependencies
> * How to add a class and an XmlSerializer
> * How to build and run the application
> * How to build and run the application

Like the [Xml Serializer Generator (sgen.exe)](../../standard/serialization/xml-serializer-generator-tool-sgen-exe.md) for the .NET Framework, the [Microsoft.XmlSerializer.Generator NuGet package](https://www.nuget.org/packages/Microsoft.XmlSerializer.Generator) is the equivalent for .NET Core and .NET Standard projects. It creates an XML serialization assembly for types contained in an assembly to improve the startup performance of XML serialization when serializing or de-serializing objects of those types using <xref:System.Xml.Serialization.XmlSerializer>.

## Prerequisites

To complete this tutorial:

* Install [.NET Core 2.1 SDK or later](https://www.microsoft.com/net/download).
* Install your favorite code editor, if you haven't already.
* [.NET Core 2.1 SDK](https://www.microsoft.com/net/download) or later
* Your favorite code editor.

> [!TIP]
> Need to install a code editor? Try [Visual Studio](https://aka.ms/vsdownload?utm_source=mscom&utm_campaign=msdocs)!
Expand All @@ -47,11 +46,11 @@ dotnet new console
Use the [`dotnet add package`](../tools//dotnet-add-package.md) command to add the reference in your project.

Type:
```console
dotnet add package Microsoft.XmlSerializer.Generator -v 1.0.0
```

```console
dotnet add package Microsoft.XmlSerializer.Generator -v 1.0.0
```

### Verify changes to MyApp.csproj after adding the package

Open your code editor and let's get started! We're still working from the *MyApp* directory we built the app in.
Expand All @@ -65,17 +64,17 @@ After running the [`dotnet add package`](../tools//dotnet-add-package.md) comman
<PackageReference Include="Microsoft.XmlSerializer.Generator" Version="1.0.0" />
</ItemGroup>
```

### Add another ItemGroup section for .NET Core CLI Tool support
Add the following lines after the `ItemGroup` section that we inspected:

Add the following lines after the `ItemGroup` section that we inspected:

```xml
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.XmlSerializer.Generator" Version="1.0.0" />
</ItemGroup>
```

### Add a class in the application

Open *Program.cs* in your text editor. Add the class named *MyClass* in *Program.cs*.
Expand All @@ -101,9 +100,10 @@ Still within the *MyApp* folder, run the application via [`dotnet run`](../tools

Type the following command in your console window:

```console
$ dotnet run
```
```console
$ dotnet run
```

> [!NOTE]
> [`dotnet run`](../tools/dotnet-run.md) calls [`dotnet build`](../tools/dotnet-build.md) to ensure that the build targets have been built, and then calls `dotnet <assembly.dll>` to run the target application.

Expand All @@ -112,18 +112,16 @@ Type the following command in your console window:

If everything succeeds, an assembly named *MyApp.XmlSerializers.dll* is generated in the output folder.



Congratulations! You have just:
> [!div class="checklist"]
> * Created a .NET Core app.
> * Added a reference to the Microsoft.XmlSerializer.Generator package.
> * Edited your MyApp.csproj to add dependencies.
> * Added a class and an XmlSerializer.
> * Built and ran the application.
> * Built and ran the application.

## Related Resources
## Related resources

* [Introducing XML Serialization](../../standard/serialization/introducing-xml-serialization.md)
* [How to: Serialize Using XmlSerializer (C#)](../../csharp/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md)
* [How to: Serialize Using XmlSerializer (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md)
* [How to: Serialize Using XmlSerializer (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md)
5 changes: 4 additions & 1 deletion docs/core/testing/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
title: Unit testing in .NET Core and .NET Standard
description: Unit testing in .NET Core and .NET Standard projects.
description: This article gives a brief overview of unit testing for .NET Core and .NET Standard projects.
author: ardalis
ms.author: wiwagn
ms.date: 08/30/2017
ms.custom: "seodec18"
---

# Unit testing in .NET Core and .NET Standard

.NET Core makes it easy to create unit tests. This article introduces unit tests and illustrates how they differ from other kinds of tests. The linked resources near the bottom of the page show you how to add a test project to your solution. After you set up your test project, you will be able to run your unit tests using the command line or Visual Studio.
Expand All @@ -25,6 +26,8 @@ Also, keep in mind there are best practices for writing tests. For example, [Tes

Try not to introduce dependencies on infrastructure when writing unit tests. These make the tests slow and brittle, and should be reserved for integration tests. You can avoid these dependencies in your application by following the [Explicit Dependencies Principle](https://deviq.com/explicit-dependencies-principle/) and using [Dependency Injection](/aspnet/core/fundamentals/dependency-injection). You can also keep your unit tests in a separate project from your integration tests. This ensures your unit test project doesn’t have references to or dependencies on infrastructure packages.

## Next steps

More information on unit testing in .NET Core projects:

.NET Core unit test projects are supported for:
Expand Down
3 changes: 2 additions & 1 deletion docs/core/testing/selective-unit-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ author: smadala
ms.date: 03/22/2017
ms.custom: seodec18
---

# Running selective unit tests

The following examples use `dotnet test`. If you're using `vstest.console.exe`, replace `--filter ` with `--testcasefilter:`.
With the `dotnet test` command in .NET Core, you can use a filter expression to run selective tests. This article demonstrates how to filter which test are run. The following examples use `dotnet test`. If you're using `vstest.console.exe`, replace `--filter ` with `--testcasefilter:`.

## MSTest

Expand Down
10 changes: 5 additions & 5 deletions docs/core/testing/unit-testing-best-practices.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
title: Best practices for writing unit tests
description: Learn best practices for writing unit tests that drive code quality and resilience
description: Learn best practices for writing unit tests that drive code quality and resilience for .NET Core and .NET Standard projects.
author: jpreese
ms.author: wiwagn
ms.date: 07/28/2018
ms.custom: "seodec18"
---

# Unit testing best practices
# Unit testing best practices with .NET Core and .NET Standard

By [John Reese](http://reesespieces.io) with special thanks to [Roy Osherove](http://osherove.com/)

There are numerous benefits to writing unit tests; they help with regression, provide documentation, and facilitate good design. However, hard to read and brittle unit tests can wreak havoc on your code base.
There are numerous benefits to writing unit tests; they help with regression, provide documentation, and facilitate good design. However, hard to read and brittle unit tests can wreak havoc on your code base. This article describes some best practices regarding unit test design for your .NET Core and .NET Standard projects.

In this guide, you'll learn some best practices when writing unit tests to keep your tests resilient and easy to understand.

By [John Reese](http://reesespieces.io) with special thanks to [Roy Osherove](http://osherove.com/)

## Why unit test?

### Less time performing functional tests
Expand Down
2 changes: 1 addition & 1 deletion docs/core/testing/unit-testing-fsharp-with-dotnet-test.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Unit testing F# libraries in .NET Core using dotnet test and xUnit
title: Unit testing F# in .NET Core with dotnet test and xUnit
description: Learn unit test concepts for F# in .NET Core through an interactive experience building a sample solution step-by-step using dotnet test and xUnit.
author: billwagner
ms.author: wiwagn
Expand Down
2 changes: 1 addition & 1 deletion docs/core/testing/unit-testing-fsharp-with-mstest.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Unit testing F# libraries in .NET Core using dotnet test and MSTest
title: Unit testing F# in .NET Core with dotnet test and MSTest
description: Learn unit test concepts for F# in .NET Core through an interactive experience building a sample solution step-by-step using dotnet test and MSTest.
author: billwagner
ms.author: wiwagn
Expand Down
Loading