The reference assemblies for framework “.NETFramework,Version=v4.6.2” were not found

后端 未结 7 1456
情深已故
情深已故 2020-12-13 17:03

When trying to compile a solution, I get the following build error:

Error MSB3644 The reference assemblies for framework \".NETFramework,Version=v4.

相关标签:
7条回答
  • 2020-12-13 17:09

    I was getting the exact same error when building except it was for ".NETFramework,Version=v4.7.1".

    I downloaded the Developer pack for 4.7.1 from here: https://www.microsoft.com/en-us/download/confirmation.aspx?id=56119

    The pack installed these programs on the target machine (my build server).

    • Microsoft .NET Framework 4.7.1 SDK
    • Microsoft .NET Framework 4.7.1 Targeting Pack
    • Microsoft .NET Framework 4.7.1 Targeting Pack (ENU)

    When I tried building again, I didn't get the error anymore and the build succeeded.

    0 讨论(0)
  • 2020-12-13 17:14

    Windows -> Search -> Visual Studio Installer -> Modify -> Individual Components and check the right version

    0 讨论(0)
  • 2020-12-13 17:19

    Installing the 4.6.2 Developer Pack did not work for me.

    I had to install .NET Framework 4.6 Targeting Pack

    0 讨论(0)
  • 2020-12-13 17:26

    It turns out that I had installed the .NET Framework v4.6.2, not the Developer Pack for 4.6.2. Doh!

    https://www.microsoft.com/en-us/download/details.aspx?id=53321

    0 讨论(0)
  • 2020-12-13 17:26

    Starting May, 2019 you can build your project on net20 up to net48 (including ne461) any machine with at least MSBuild or the .NET Core SDK installed without the need of Developer Pack installed.

    If .NET Core SDK installed in you machine, Add the nuget package Microsoft.NETFramework.ReferenceAssemblies to your project

        <ItemGroup>
            <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2">
                <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
                <PrivateAssets>all</PrivateAssets>
            </PackageReference>     
        </ItemGroup>
    

    The package include all ReferenceAssemblies starting net20 up to net48

    These packages enable building .NET Framework projects on any machine with at least MSBuild or the .NET Core SDK installed plus other scenarios.

    For more details: https://github.com/Microsoft/dotnet/tree/master/releases/reference-assemblies

    0 讨论(0)
  • 2020-12-13 17:31

    I was using ubuntu and faced the same problem. Even after I've downloaded latest vscode and mono for ubuntu it was not working. Then I found this.
    Basically if you've installed mono then go to settings and set

    "omnisharp.useGlobalMono": "always".

    hope it fix your issue.

    0 讨论(0)
提交回复
热议问题