nuget pack命令结果错误值不能为null或空字符串。参数名称:value
我正试图通过以下方式创建我的第一个nuget包。我已经在nuget pack命令结果错误值不能为null或空字符串。参数名称:value,nuget,Nuget,我正试图通过以下方式创建我的第一个nuget包。我已经在build子目录中生成了一个nuspec文件和一个MSBUILD目标文件,并且都包含在csrpoj的生成输出中。现在,我按照我的bin目录中的建议,在我的nuspec文件上运行nuget pack,得到以下错误 > nuget pack MyPackage.nuspec Value cannot be null or an empty string. Parameter name: value 错误似乎很清楚,但不能为null的值不
build
子目录中生成了一个nuspec文件和一个MSBUILD目标文件,并且都包含在csrpoj的生成输出中。现在,我按照我的bin
目录中的建议,在我的nuspec文件上运行nuget pack
,得到以下错误
> nuget pack MyPackage.nuspec
Value cannot be null or an empty string.
Parameter name: value
错误似乎很清楚,但不能为null的值不是。下面是我当前的nuspec文件的一个示例
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>Copyright 2016</copyright>
<tags>source version tfs git</tags>
<packageTypes>
<packageType type="Dependency" />
</packageTypes>
</metadata>
<files>
<!-- Include everything in \build -->
<file src="build\**"
target="build" />
</files>
</package>
$id$
$version$
$title$
$author$
$author$
http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE
http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE
http://ICON_URL_HERE_OR_DELETE_THIS_LINE
假的
$description$
此版本包中所做更改的摘要。
版权所有2016
源版本tfs git
在我的项目文件上运行nuget pack会得到更多有用的信息
The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd' has invalid child element 'packageTypes' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd'. List of possible elements expected: 'references, contentFiles, dependencies, developmentDependency, frameworkAssemblies, summary, language' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd'.
添加以下命名空间后,没有任何更改
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
填写了作者和描述,只给我留下了一个警告
WARNING: 1 issue(s) found with package 'SourceVersion'.
Issue: Remove sample nuspec values.
Description: The value "Summary of changes made in this release of the package." for ReleaseNotes is a sample value and should be removed.
Solution: Replace with an appropriate value or remove and it and rebuild your package.
填写ReleaseNotes内容,然后创建包时不会出错
注意:直接在nuspec文件上运行nuget pack在上述更改之后仍然会出现相同的错误。但是运行nuget pack MyPackage.csproj现在对我来说已经很好了,这对我来说已经足够了。从上面@MichaelPuckettII我什么都做不了。在2017年春季中期之前,我没有尝试发布任何内容,我遵循了与上述相同的步骤,因为我现在已经将它们作为构建过程的一部分编写了脚本。我也遇到了同样的问题。当.nuspec文件包含变量(如$id$)时,必须将nuget.exe指向.csproj。否则nuget不知道从哪里提取变量。
WARNING: 1 issue(s) found with package 'SourceVersion'.
Issue: Remove sample nuspec values.
Description: The value "Summary of changes made in this release of the package." for ReleaseNotes is a sample value and should be removed.
Solution: Replace with an appropriate value or remove and it and rebuild your package.