admin管理员组文章数量:1024593
I create a nuget package for .Net 8 as well as with .Net Framework 4.7.2 containing .cs
files only. When installing the package with old .Net project, NuGet copies the content into the project folder, and changes csproj
file. Is it possible just to reference the files from the nuget cache like PackageReference
does? Here's my nuspec
file:
<?xml version="1.0"?>
<package>
<metadata minClientVersion="3.3.0">
<id>MyClient</id>
<version>1.0.0</version>
<authors>me</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>description</description>
<tags>myclient</tags>
<dependencies>
<group targetFramework="net8.0">
...
</group>
<group targetFramework="net472">
...
</group>
</dependencies>
<!-- Build actions for items in the contentFiles folder -->
<contentFiles>
<files include="cs/**/*.*" buildAction="Compile" />
</contentFiles>
</metadata>
<files>
<!-- this is for the new format -->
<file src="myproject/MyClient.cs" target="contentFiles\cs\any\Client" />
<!-- this is for the old format -->
<file src="myproject/MyClient.cs" target="content\Client" />
</files>
</package>
I create a nuget package for .Net 8 as well as with .Net Framework 4.7.2 containing .cs
files only. When installing the package with old .Net project, NuGet copies the content into the project folder, and changes csproj
file. Is it possible just to reference the files from the nuget cache like PackageReference
does? Here's my nuspec
file:
<?xml version="1.0"?>
<package>
<metadata minClientVersion="3.3.0">
<id>MyClient</id>
<version>1.0.0</version>
<authors>me</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>description</description>
<tags>myclient</tags>
<dependencies>
<group targetFramework="net8.0">
...
</group>
<group targetFramework="net472">
...
</group>
</dependencies>
<!-- Build actions for items in the contentFiles folder -->
<contentFiles>
<files include="cs/**/*.*" buildAction="Compile" />
</contentFiles>
</metadata>
<files>
<!-- this is for the new format -->
<file src="myproject/MyClient.cs" target="contentFiles\cs\any\Client" />
<!-- this is for the old format -->
<file src="myproject/MyClient.cs" target="content\Client" />
</files>
</package>
本文标签: cHow to reference NuGet content files instead of copying with packagesconfigStack Overflow
版权声明:本文标题:c# - How to reference NuGet content files instead of copying with packages.config? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745609334a2158910.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论