Search code examples
.net-corenuget-packagevisual-studio-2022

The primary signature validity period has expired in visual studio 2022


When I'm updating packages in Visual Studio 2022, I get the following error :

NU3037  Package 'Microsoft.Extensions.Options 5.0.0' from source 'https://api.nuget.org/v3/index.json': The author primary signature validity period has expired.   

enter image description here

Please help me to solve it


Solution


  • 1. Open this file: "C:\Users{YourUsername}\AppData\Roaming\NuGet\NuGet.Config"


    2. First try changing content of this 'NuGet.Config' file to default state:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
      </packageSources>
    </configuration>
    
    • If everything is okay with Visual Studio's NuGet then dont continue.

    2.1. If same problem happens again try changing content of 'NuGet.Config' file with this:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <packageSources>
            <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        </packageSources>
        <config>
            <add key="signatureValidationMode" value="accept" />
        </config>
        <trustedSigners>
            <author name="Microsoft">
                <certificate fingerprint="3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <certificate fingerprint="AA12DA22A49BCE7D5C1AE64CC1F3D892F150DA76140F210ABD2CBFFCA2C18A27" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
            </author>
            <repository name="nuget.org" serviceIndex="https://api.nuget.org/v3/index.json">
                <certificate fingerprint="0E5F38F57DC1BCC806D8494F4F90FBCEDD988B46760709CBEEC6F4219AA6157D" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <certificate fingerprint="3E9099B5015E8F486C00BCEA9D111EE721FABA355A89BCF1DF69561E3DC6325C" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <certificate fingerprint="51044706BD237B91B89B781337E6D62656C69F0FCFFBE8E43741367948127862" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <certificate fingerprint="F3516DDCC8AFC808788BD8B0E840BDA2B5E23C6244252CA3000BB6C87170402A" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <certificate fingerprint="2399561127A57125DE8CEFEA610DDF2FA078B5C8067F4E828290BFB860E84B3C" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <certificate fingerprint="C474CE76007D02394E0DA5E4DE7C14C680F9E282013CFEF653EF5DB71FDF61F8" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <certificate fingerprint="CF7AC17AD047ECD5FDC36822031B12D4EF078B6F2B4C5E6BA41F8FF2CF4BAD67" hashAlgorithm="SHA256" allowUntrustedRoot="true" />
                <owners>microsoft;aspnet;nuget;domaindrivendev;dotnetframework</owners>
            </repository>
        </trustedSigners>
    </configuration>
    

    3. Or you can try/check this