'nuget.config how to specify NuGet package dependency version

I am trying to make a Visual Studio 2019 project which will automatically download a specific version of a NuGet package, and if a new user opens that project, it will automatically restore/download that version of the package.

I'm trying to acomplish this using a nuget.config file at the base of my VS2019 repo, my nuget.config includes one source (Artifactory),

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <config>
        <clear />
        <add key="repositoryPath" value="packages" />
    </config>
    <packageSources>
        <!-- When <clear /> is present, previously defined sources are ignored -->
        <!-- Remove this tag or un-comment the nuget.org source below to restore packages from nuget.org -->
        <!-- For more info, see https://docs.nuget.org/consume/nuget-config-file -->
        <clear />
        <add key="Artifactory" value="https://my-artifactory-url/artifactory/api/nuget/ult-testware-nuget" />
    </packageSources>

    <packageRestore>
        <add key="enabled" value="True" />
        <add key="automatic" value="True" />
    </packageRestore>

    <activePackageSource>
        <add key="All" value="(Aggregate source)" />
    </activePackageSource>
</configuration>

But what is the syntax to include a section that specifies the need to download version 1.0.0 of the package "MartinTestPkgXYZ" ? Can I include that in my nuget.config file so the package and version get downloaded when you open or build?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source