Update xmlserializergenerator-instructions.md

This commit is contained in:
Shin Mao 2017-11-15 15:12:12 -08:00 committed by GitHub
parent e06eae4787
commit e574b4277e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,9 @@ You can start using the tool today following the instructions below.
## Prerequisites
* [.Net Core SDK of version 2.0.2 or later](https://www.microsoft.com/net/download/windows)
The following is required for Microsoft.XmlSerializer.Generator to work. You can use command `dotnet --info` to check which versions of .NET Core SDK and runtime you may already have installed.
* [.Net Core SDK 2.0.2 or later](https://www.microsoft.com/net/download/windows)
* [.NET Core runtime 2.0.3 or later](https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.3.md)
## Instructions
@ -17,15 +19,17 @@ Here are the step by step instructions on how to use Xml Serializer Generator in
```
dotnet new console --name MyApp
```
2. Edit the .csproj and add a reference to the Microsoft.XmlSerializer.Generator package. For example,
* Run command: `dotnet add package Microsoft.XmlSerializer.Generator -v 1.0.0-preview1-25915-02`
* Add the following lines in MyApp.csproj,
1. Edit the .csproj and add a reference to the Microsoft.XmlSerializer.Generator package. For example,
1. Run command: `dotnet add package Microsoft.XmlSerializer.Generator -v 1.0.0-preview1-25915-02`
1. Add the following lines in MyApp.csproj,
```xml
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.XmlSerializer.Generator" Version="1.0.0-preview1-25915-02" />
</ItemGroup>
```
3. Add a class in the application. For example, add the class below in Program.cs,
1. Add a class in the application. For example, add the class below in Program.cs,
```c#
public class MyClass
{
@ -36,6 +40,6 @@ Here are the step by step instructions on how to use Xml Serializer Generator in
```c#
var serializer = new System.Xml.Serialization.XmlSerializer(typeof(MyClass));
```
4. Build the application by running `dotnet build`. If everything succeeds, an assembly named MyApp.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.
1. Build the application by running `dotnet build`. If everything succeeds, an assembly named MyApp.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.
Start the application and it will automatically load and use the pre-generated serializers at runtime.