How do I install .NET Framework 4 SDK?

Windows Server 2019, configured with Ansible.

I have tried with

  • name: Install multiple packages
    win_chocolatey:
    name:

  • nuget.commandline

  • nunit-console-runner

  • visualstudio2017buildtools

  • dotnet

  • dotnetfx

  • netfx-4.8

  • netfx-4.8-devpack
    state: present

  • name: Install dotnet core SDK 1.1
    win_chocolatey:
    name: dotnetcore-sdk
    version: 1.1.14
    state: present
    allow_multiple: yes

  • name: Install dotnet core SDK 2.1
    win_chocolatey:
    name: dotnetcore-sdk
    version: 2.1.510
    state: present
    allow_multiple: yes

  • name: Install dotnet runtime
    win_chocolatey:
    name: dotnetcore-runtime.portable
    package_params: /ShimDotnetExe
    state: present

but when running dotnet build foo.sln I still get

C:\Program Files\dotnet\sdk\2.1.510\Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework “.NETFramework,Version=v4.0” were not found. To resolve this, install th
e SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from th
e Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

This doesn’t really sound like an Ansible question, dotnet build is complaining it can’t find the assembly and that’s just what Ansible is reporting. YOu need to figure out the correct install steps first then you can do the same with an Ansible task.

I don’t know how to figure out the correct install steps. My devs don’t want to help me, they dumped me on a web page with just a list of software they manually install with next-next-next-finish.

Ansible can automate the installation, but it doesn’t magically know what you want to automate. This is basically the effort that you have to put in.

I can’t make this more specific than that you need to write an ansible playbook with tasks to install that “list of software”.