我有這個nuspec文件:爲什麼nuget不添加我的文件?
<?xml version="1.0"?>
<package >
<metadata>
<id>My.Package</id>
<version>1.0.1.7</version>
<title>My Package</title>
<authors>My name</authors>
<owners>Mu author</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>My description</description>
<releaseNotes>Release note</releaseNotes>
<copyright>Copyright 2017</copyright>
<tags>tag1 tag2</tags>
<contentFiles>
<files include="myFile.config" copyToOutput="true" />
</contentFiles>
</metadata>
<files>
<file src="myFile.config" target=""/>
</files>
</package>
當我收拾這個nuspec文件,我nupkg文件被創建,並在NuGet包Explorer中我看到myFile.config包括在我的包。迄今爲止都很好。
但是,當我安裝此軟件包時,dll被添加到引用,但myFile.config未被添加到解決方案中。
事情我已經嘗試沒有成功: - 查看磁盤上的文件夾,看看是否myFile.config創建(不存在) - <file src="myFile.config" target="."/>
- <file src="myFile.config" target=".\"/>
我也想將文件設置Copy to Output Directory
: Copy always
。
我在這裏錯過了什麼?
PS:我正在使用私人nuget服務器。
謝謝,這個作品!我認爲'Content'是消費項目的物理目錄。你是否也知道爲什麼它不把'Copy to output directory'設置爲'Copy always'? – Martijn
因爲這是不受支持的。我推薦這個答案:https://stackoverflow.com/a/30386836/784387(應該適用於'packages.config'和'PackageReference'項目) –
啊,太糟糕了。不管怎麼說,還是要謝謝你! – Martijn