Skip to content

Add a reference to the Microsoft.XmlSerializer.Generator package in the MyApp project #36706

Open
@MulMic

Description

@MulMic

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 <assembly.dll> 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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnet-fundamentals/svcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions