如何将文件添加到Nuget软件包,而不会自动添加到项目参考中?

问题描述 投票:0回答:1
torying要制作一个

NuGet package

,但是当我安装时,即使项目只需要
NuGet package,剩下的就可以安装每个单个
,而其余的则只是为了正常工作。另一个不需要添加为项目参考,只有
dll.
我尝试的是什么,
使用
MetadataExtractor.dll
文件进行试验:
dll
result

:安装时说

dll

,因为

MetadataExtractor.dll

是不需要引用项目的
csproj

之一。
使用
<PropertyGroup Label="Globals"> <SccProjectName>SAK</SccProjectName> <SccProvider>SAK</SccProvider> <SccAuxPath>SAK</SccAuxPath> <SccLocalPath>SAK</SccLocalPath> </PropertyGroup> <PropertyGroup> <TargetFrameworks>net472;net8.0;</TargetFrameworks> </PropertyGroup> <ItemGroup> <PackageReference Include="IKVM" Version="8.11.2" /> </ItemGroup> <ItemGroup> <IkvmReference Include="../Tika/tika-app-2.9.3.jar"> <AssemblyName>tika-app</AssemblyName> </IkvmReference> <None Include="bin\Debug\net472\**" Pack="true" PackagePath="lib\net472\" /> <None Include="bin\Debug\net8.0\**" Pack="true" PackagePath="lib\net8.0\" /> <!--<Reference Include="MetadataExtractor"> <HintPath>lib\net472\MetadataExtractor.dll</HintPath> </Reference>--> </ItemGroup>

(我只是从Failed to add reference to 'awt'. Please make sure that the file is accessible, and that it is a valid assembly or COM component.文件生成的

awt
中复制了很多):
dll

result

:由于某种原因,我什至无法安装此版本:/

    
这是固定的,但我不是100%确定如何。
我更改了我在最高级别上包括所有文件,而曾经有问题的dll的所有文件都设置了
nuspec

现在看起来像这样。
nuspec

在nuget软件包lib文件夹中,它只会生成csprojdll,但由于某种原因,一切仍然有效,所以也许在后台的某个地方文件inthe文件

<?xml version="1.0" encoding="utf-8"?> <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <metadata> <id>yap</id> <version>0.0.0.8</version> <authors>yappathor</authors> <description>yap yap</description> <repository type="git" /> <dependencies> <group targetFramework=".NETFramework4.7.2"> <dependency id="IKVM" version="8.11.2" exclude="Build,Analyzers" /> </group> <group targetFramework="net8.0"> <dependency id="IKVM" version="8.11.2" exclude="Build,Analyzers" /> </group> </dependencies> <frameworkAssemblies> <frameworkAssembly assemblyName="System.Runtime.InteropServices.RuntimeInformation" targetFramework=".NETFramework4.7.2" /> </frameworkAssemblies> </metadata> <references> <reference file="bin\Debug\net472\MetadataExtractor.dll"/> <reference file="bin\Debug\net8.0\MetadataExtractor.dll"/> </references> <files> <file src="bin\Debug\net472\**" target="lib\net472" /> <file src="bin\Debug\net8.0\**" target="lib\net8.0" /> </files> </package>
c# .net azure-pipelines nuget-package nuspec
1个回答
0
投票
仍然包括在内,只是没有自动添加为项目参考。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.