is unrecognized"-6ren"> is unrecognized"-我正在尝试创建一个 dotnet 新模板的 NuGet 包。我创建了一个 nuspec 文件来设置包的详细信息,它位于我的内容文件夹旁边,其中包含我想要打包的所有内容: My.-6ren">
gpt4 book ai didi

dotnet-cli - dotnet 包 "The element is unrecognized"

转载 作者:行者123 更新时间:2023-12-04 01:54:17 37 4
gpt4 key购买 nike

我正在尝试创建一个 dotnet 新模板的 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.

我真的不明白。包不应该是 .nuspec 文件中的根元素吗?

最佳答案

dotnet pack不支持打包 nuspec 文件。它只支持包含 Pack 的 msbuild 项目。目标。

您可以创建一个 csproj 项目并使用 NuspecFile属性(property)或用途 nuget pack通过来自 http://nuget.org/downloads 的 nuget.exe 版本或通过 nuget非 Windows 平台上的 Mono 框架提供的可执行文件。

关于dotnet-cli - dotnet 包 "The element <package> is unrecognized",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50977456/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com