Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. My nuspec file looks like this:

<?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>[email protected]</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?

like image 503
Sharif Mamun Avatar asked Aug 14 '17 16:08

Sharif Mamun


1 Answers

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. The nuspec looks like below now:

<?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>[email protected]</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>
like image 162
Sharif Mamun Avatar answered Oct 12 '22 20:10

Sharif Mamun