【发布时间】:2018-12-01 07:30:33
【问题描述】:
我正在尝试创建一个 dotnet new 模板的 NuGet 包。我创建了一个 nuspec 文件来设置包的详细信息,它与我的内容文件夹相邻,其中包含我想要打包的所有内容:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<!-- The identifier that must be unique within the hosting gallery -->
<id>My.EpiserverCMS</id>
<!-- The package version number that is used when resolving dependencies -->
<version>1.0.0</version>
<!-- Authors contain text that appears directly on the gallery -->
<authors>Me</authors>
<description></description>
<!--
Owners are typically nuget.org identities that allow gallery
users to easily find other packages by the same owners.
-->
<owners>me</owners>
<!-- License and project URLs provide links for the gallery -->
<licenseUrl></licenseUrl>
<projectUrl></projectUrl>
<!-- The icon is used in Visual Studio's package manager UI -->
<iconUrl></iconUrl>
<!--
If true, this value prompts the user to accept the license when
installing the package.
-->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<!-- Any details about this particular release -->
<releaseNotes>First Release</releaseNotes>
<!--
The description can be used in package manager UI. Note that the
nuget.org gallery uses information you add in the portal.
-->
<description>dotnet new template for Episerver CMS</description>
<!-- Copyright information -->
<copyright>Copyright ©2018 Me</copyright>
<!-- Tags appear in the gallery and can be used for tag searches -->
<tags>web episerver cms</tags>
<!-- Dependencies are automatically installed when the package is installed -->
<dependencies>
</dependencies>
<packageTypes>
<packageType name="Template" />
</packageTypes>
</metadata>
<!-- A readme.txt to display when the package is installed -->
<files>
<file src="README.md" target="" />
<file src="**" exclude=".vs\*,packages\*,**\*.mdf,**\*.ldf,**\*.log"></file>
</files>
</package>
但是当我运行 dotnet pack 时出现错误:
error MSB4068: The element <package> is unrecognized, or not supported in this context.
我真的不明白。 package 不应该是 .nuspec 文件中的根元素吗?
【问题讨论】:
标签: dotnet-cli nuspec