Update xmlserializergenerator-instructions.md

This commit is contained in:
Shin Mao 2017-11-15 12:58:43 -08:00 committed by GitHub
parent 330284d447
commit 71dde7e736
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@ 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)
* [.NET Core runtime Release/2.0.3](https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.3.md)
* [.NET Core runtime 2.0.3](https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.3.md)
## Instructions
@ -25,8 +25,7 @@ Here are the step by step instructions on how to use Xml Serializer Generator in
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
</packageSources>
</configuration>
   ```
```
3. 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,
@ -35,20 +34,17 @@ Here are the step by step instructions on how to use Xml Serializer Generator in
<DotNetCliToolReference Include="Microsoft.XmlSerializer.Generator" Version="1.0.0-preview1-25915-02" />
</ItemGroup>
```
4. Add a class in the application. For example, add the class below in Program.cs,
```c#
public class MyClass
{
public int Value;
}
```
Now you can create an `XmlSerializer` for MyClass.
```
Now you can create an `XmlSerializer` for MyClass.
```c#
var serializer = new System.Xml.Serialization.XmlSerializer(typeof(MyClass));
```
   
```
5. 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.