How to build nuget package from nuspec without platform version?

47 views Asked by At

I am trying to build a nuget package only for dependencies consisting of 3rd party packages. If I'd be starting from scratch probably adn empty project with reguired assemblies might be a better idea but I already have nuspec files available so I don't want to create my own projects for future safty. Here is one such nuspec file:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>MyCompany.TestPack</id>
    <tags>Test</tags>
    <version>1.0.0</version>
    <authors>Example Inc.</authors>
    <owners>Example Inc.</owners>
    <description>This package provides data.</description>
    <language>en-US</language>
    <licenseUrl>https://example.com</licenseUrl>
    <requireLicenseAcceptance>true</requireLicenseAcceptance>
    <dependencies>
      <group targetFramework="net6.0-windows">
        <dependency id="DevExpress.Data" version="[22.2.9]" />
      </group>
    </dependencies>
    <frameworkReferences />
    <developmentDependency>false</developmentDependency>
  </metadata>
</package>

And here is the nuget command to build package:

nuget pack my.package.nuspec

Problem is it fails with error:

NU1012: Some dependency group TFMs are missing a platform version: net6.0-windows

I also tried /p:WindowsTargetPlatformVersion=7 with nuget command without success.
But if I change targetFramework="net6.0-windows" to "net6.0-windows7.0" or 10 etc., it works.
My question is, how can I build package from above nuspec with out providing platform version? or if it is necesssary then how can I set it through nuget command?

0

There are 0 answers