Add a reference to the Microsoft.XmlSerializer.Generator package in the MyApp project
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
Following up on my previous post I found the line `dotnet add package Microsoft.XmlSerializer.Generator -v 1.0.0` to cause the problem.
According to 7 Note further down the page
```
7 Note
[dotnet run](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-run) calls [dotnet build](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build) to ensure that the build targets have been built, and then calls dotnet to run the target application.
```
dotnet run invokes dotnet build. So I ventured to issue dotnet build directly, which gave me advice to download a missing framework:
```
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.0.0&arch=x64&rid=win10-x64
```
Trying that, I get told, that framework 2 is out of service and deprecated. Downloading and installing the suggested replacement (v4) leaves me with...
To cut a long story short, I finally used version 7, as that seems to be the current one. Changing the line in question to:
`PackageReference Include="Microsoft.XmlSerializer.Generator" Version="7" `
Issuing dotnet run the umpteenth time now leaves me with:
```
C:\Users\MulMic\Documents\Personen\MulMic\Software\MyApp>dotnet run
C:\Users\MulMic\.nuget\packages\microsoft.xmlserializer.generator\7.0.0\build\Microsoft.XmlSerializer.Generator.
targets(52,5): warning : SGEN: Failed to generate the serializer for MyApp.dll. Please follow the instructions at https
://go.microsoft.com/fwlink/?linkid=858594 and try again. [C:\Users\MulMic\Documents\Personen\MulMic\Soft
ware\MyApp\MyApp.csproj]
Hello, World!
```
Checking the code in Program.cs once again, I pay attention to the top comment and visit
[https://learn.microsoft.com/de-de/dotnet/core/tutorials/top-level-templates](https://learn.microsoft.com/de-de/dotnet/core/tutorials/top-level-templates)
While this page tells me that the new and the old template style are equvalent, I copy the old example to Program.cs replacing what I had so far, modifying it again in accordance with the article.
Running dotnet run once more I now get:
```
C:\Users\MulMic\Documents\Personen\MulMic\Software\MyApp>dotnet run
Hello World!
```
Which is probably what was to be demonstrated in the first place.
I suggest the article to be subjected to a general overhaul.
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: cb8026b7-96b0-eab2-e6ec-93d9c61e95e6
* Version Independent ID: 1ed6e1bf-7228-608d-b3fa-fa517e55386e
* Content: [Microsoft XML Serializer Generator - .NET](https://learn.microsoft.com/en-us/dotnet/core/additional-tools/xml-serializer-generator)
* Content Source: [docs/core/additional-tools/xml-serializer-generator.md](https://github.com/dotnet/docs/blob/main/docs/core/additional-tools/xml-serializer-generator.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @HongGit
* Microsoft Alias: **dotnetcontent**
Contributor guide
Assessment
This issue has not been assessed yet.