简体   繁体   English

“版本”属性未在 nuspec 文件中声明

[英]The 'Version' attribute is not declared in nuspec file

When I try to pack a .net core solution using VSTS, I get The 'Version' attribute is not declared error.当我尝试使用 VSTS 打包 .net 核心解决方案时,我得到The 'Version' attribute is not declared错误。 My nuspec file looks like this:我的 nuspec 文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata minClientVersion="3.3.0">
    <id>YYY.AspNetCore.CustomMapper</id>
    <version>0.0.1</version>
    <authors>build@YYYYYY.com</authors>
    <owners>YYY YYY</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>YYY.AspNetCore</description>
    <tags>YYY</tags>
    <contentFiles>
        <files include="wwwroot\**" buildAction="EmbeddedResource" copyToOutput="true" />
        <files include="Areas\CustomMapper\readme.txt" buildAction="EmbeddedResource" copyToOutput="true" />
    </contentFiles>
    <dependencies>
    <group>
        <dependency id="EntityFramework" Version="6.1.0" />
        <dependency id="Microsoft.AspNetCore" Version="1.1.0" />
        <dependency id="Microsoft.AspNetCore.Mvc" version="1.1.0" />
        <dependency id="Microsoft.AspNetCore.StaticFiles" version="1.1.0" />
        <dependency id="Microsoft.Extensions.Logging.Debug" version="1.1.0" />
        <dependency id="YYY.Web.AspNetCore" version="1.0.1" />
        <dependency id="SimpleInjector.Integration.AspNetCore" version="4.0.10" />
        <dependency id="SimpleInjector.Integration.AspNetCore.Mvc" version="4.0.10" />
    </group>
  </dependencies>
  </metadata>
  <files>
    <file src="wwwroot\**" target="content\wwwroot" />
    <file src="Areas\CustomMapper\readme.txt" target="" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Data.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Provider.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Services.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.WebApi.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Backend.WebApi.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Provider.Common.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.AspNetCore.CustomMapper.dll" target="lib\net452" />
  </files>
</package>

Can anyone please help me why this error is happening?任何人都可以帮助我为什么会发生此错误?

Actually, the problem was "Version" attribute of the dependency element is case sensitive.实际上,问题是依赖元素的“版本”属性区分大小写。 I changed the Version attributes to version for EntityFramework and Microsoft.AspNetCore and it's fixed now.我将 EntityFramework 和 Microsoft.AspNetCore 的版本属性更改为版本,现在已修复。 The nuspec looks like below now: nuspec 现在如下所示:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata minClientVersion="3.3.0">
    <id>YYY.AspNetCore.CustomMapper</id>
    <version>0.0.1</version>
    <authors>build@YYYYYY.com</authors>
    <owners>YYY YYY</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>YYY.AspNetCore</description>
    <tags>YYY</tags>
    <contentFiles>
        <files include="wwwroot\**" buildAction="EmbeddedResource" copyToOutput="true" />
        <files include="Areas\CustomMapper\readme.txt" buildAction="EmbeddedResource" copyToOutput="true" />
    </contentFiles>
    <dependencies>
    <group>
        <dependency id="EntityFramework" version="6.1.0" />
        <dependency id="Microsoft.AspNetCore" version="1.1.0" />
        <dependency id="Microsoft.AspNetCore.Mvc" version="1.1.0" />
        <dependency id="Microsoft.AspNetCore.StaticFiles" version="1.1.0" />
        <dependency id="Microsoft.Extensions.Logging.Debug" version="1.1.0" />
        <dependency id="YYY.Web.AspNetCore" version="1.0.1" />
        <dependency id="SimpleInjector.Integration.AspNetCore" version="4.0.10" />
        <dependency id="SimpleInjector.Integration.AspNetCore.Mvc" version="4.0.10" />
    </group>
  </dependencies>
  </metadata>
  <files>
    <file src="wwwroot\**" target="content\wwwroot" />
    <file src="Areas\CustomMapper\readme.txt" target="" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Data.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Provider.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Services.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.WebApi.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Backend.WebApi.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.CustomMapper.Provider.Common.dll" target="lib\net452" />
    <file src="bin\Release\net452\win7-x86\YYY.AspNetCore.CustomMapper.dll" target="lib\net452" />
  </files>
</package>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NuGet - NU5131:在 nuspec 文件中声明的引用没有被打包 - NuGet - NU5131: References declared in the nuspec file are not being packaged nuspec和csproj软件包版本标签 - nuspec and csproj package version tags 当 nuget 打包程序集时,nuspec 文件中的 $version$ 令牌未从 AssemblyInfo.cs 读取 - $version$ token in nuspec file not reading from AssemblyInfo.cs when nuget packaging an assembly 如何在nuspec中指定特定的依赖版本? - How to specify specific dependency version in nuspec? dotnet pack命令以及不包含项目DLL的nuspec文件 - dotnet pack command along with nuspec file not including project's DLL 如何仅使用Nuget和nuspec文件添加文件(如果尚不存在) - How to only add a file if it doesn't already exist using Nuget and the nuspec file 当使用nuspec文件时,dotnet包会创建与.Net Core项目不兼容的软件包 - dotnet pack creates package that is not compatible with .Net Core project when using nuspec file 从nuspec文件的不同文件夹中包含的多个csproj创建多目标nuget包 - Create multi-target nuget package from several csproj contained in different folders from nuspec file 生成正确的nuspec文件…使用引用TFS程序集的程序集时,出现NullReference异常 - Generating correct nuspec file… NullReference exception when using assembly that's referencing TFS assemblies 如何在没有任何nuspec文件的情况下将多个项目中的产品打包到一个nuget中? - How to pack the products from multiple projects into one nuget without any nuspec file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM