How can i exclude specific target framework from nuspec (NuGet package) generation? #60230
Answered
by
huoyaoyuan
petarpetrovt
asked this question in
Q&A
-
There seems to be a way to pack only 1 tf - Example: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0;net5.0-windows</TargetFrameworks>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project> <?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ExampleLibrary</id>
<version>1.0.0</version>
<authors>ExampleLibrary</authors>
<description>Package Description</description>
<dependencies>
<group targetFramework="net5.0" />
<group targetFramework="net5.0-windows7.0" />
<group targetFramework=".NETStandard2.0" />
</dependencies>
</metadata>
<files>
<file src="C:\repos\ExampleLibrary\ExampleLibrary\bin\Debug\net5.0\ExampleLibrary.dll" target="lib\net5.0\ExampleLibrary.dll" />
<file src="C:\repos\ExampleLibrary\ExampleLibrary\bin\Debug\net5.0-windows\ExampleLibrary.dll" target="lib\net5.0-windows7.0\ExampleLibrary.dll" />
<file src="C:\repos\ExampleLibrary\ExampleLibrary\bin\Debug\netstandard2.0\ExampleLibrary.dll" target="lib\netstandard2.0\ExampleLibrary.dll" />
</files>
</package> |
Beta Was this translation helpful? Give feedback.
Answered by
huoyaoyuan
Oct 15, 2021
Replies: 1 comment
-
I don't know if there is a way to do this, but you can create a new csproj with less target frameworks, and pack with that csproj. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
petarpetrovt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know if there is a way to do this, but you can create a new csproj with less target frameworks, and pack with that csproj.