如何修复明显无效的NU1002依赖项不支持框架.NetStandard,Version = v1.5

时间:2016-05-23 00:17:33

标签: nuget .net-core

谷歌和stackexchange发现在dll不兼容的情况下命中。这一次,他们是。这是我的DLL。我完全了解它的兼容性。

dll文件放在lib / netstandard1.5

Nuspec文件读取:

<?xml version="1.0" encoding="windows-1252" ?>
<package >
  <metadata>
    <id>redacted.dll</id>
    <version>1.0.0-alpha</version>
    <authors>joshudson</authors>
    <owners>joshudson</owners>
    <projectUrl>https://sourcecontrol.internal.lan<projectUrl>
    <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance&gt
    <description>Redacted</description>
    <copyright>Redacted</copyright>
    <releaseNotes>TEST</releaseNotes>
    <tags>Redacted</tags>
    <dependencies>
      <group targetFramework=".NETStandard1.5">
        <dependency id="System.Runtime" version="4.1.0-rc2-24027" >
        <dependency id="System.ComponentModel" version="4.1.0-rc2-24027" />
        <dependency id="System.Diagnostics.Tools" version="4.1.0-rc2-24027" />
        <dependency id="System.Diagnostisc.Debug" version="4.1.0-rc2-24027" />
        <dependency id="System.Text.Encoding" version="4.1.0-rc2-24027" />
        <dependency id="System.Text.Encoding.Extensions" version="4.1.0-   rc2-24027" />
        <dependency id="System.Collections" version="4.1.0-rc2-24027" />
        <dependency id="System.Globalization" version="4.1.0-rc2-24027" />
      </group>
    </dependencies>
  </metadata>
</package>

用手验证ildasm中的参考文献:

// Metadata version: v4.0.30319
.assembly extern System.Runtime
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:1:0:0
}
.assembly extern System.Collections
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:10:0
}
.assembly extern System.Text.Encoding
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:10:0
}
.assembly extern System.Diagnostics.Debug
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:10:0
}
.assembly extern System.Diagnostics.Tools
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:0:0
}
.assembly extern System.Text.Encoding.Extensions
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:10:0
}
.assembly extern System.Globalization
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:10:0
}
.assembly Redacted
{
  .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
  .custom instance void [System.Runtime]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
                                                                                                                   63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.

  // --- The following custom attribute is added automatically, do not uncomment -------
  //  .custom instance void [System.Runtime]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) 

  .hash algorithm 0x00008004
  .ver 0:0:0:0
}
.module Redacted.dll
// MVID: {REDACTED}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY
// Image base: 0x024A0000


</code>

For reference we get on System.Collections:
<code>
// Metadata version: v4.0.30319
.assembly extern System.Runtime
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:0:0
}
.assembly noplatform System.Collections
{
  .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) 
  .custom instance void [System.Runtime]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
                                                                                                                   63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       // ceptionThrows.

  // --- The following custom attribute is added automatically, do not uncomment -------
  //  .custom instance void [System.Runtime]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 02 00 00 00 00 00 ) 

  .custom instance void [System.Runtime]System.Security.AllowPartiallyTrustedCallersAttribute::.ctor() = ( 01 00 00 00 ) 
  .custom instance void [System.Runtime]System.Runtime.CompilerServices.ReferenceAssemblyAttribute::.ctor() = ( 01 00 00 00 ) 
  .custom instance void [System.Runtime]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 12 53 79 73 74 65 6D 2E 43 6F 6C 6C 65 63   // ...System.Collec
                                                                                                    74 69 6F 6E 73 00 00 )                            // tions..
  .custom instance void [System.Runtime]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 12 53 79 73 74 65 6D 2E 43 6F 6C 6C 65 63   // ...System.Collec
                                                                                                          74 69 6F 6E 73 00 00 )                            // tions..
  .custom instance void [System.Runtime]System.Reflection.AssemblyDefaultAliasAttribute::.ctor(string) = ( 01 00 12 53 79 73 74 65 6D 2E 43 6F 6C 6C 65 63   // ...System.Collec
                                                                                                           74 69 6F 6E 73 00 00 )                            // tions..
  .custom instance void [System.Runtime]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 15 4D 69 63 72 6F 73 6F 66 74 20 43 6F 72   // ...Microsoft Cor
                                                                                                      70 6F 72 61 74 69 6F 6E 00 00 )                   // poration..
  .custom instance void [System.Runtime]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 1A 4D 69 63 72 6F 73 6F 66 74 C2 AE 20 2E   // ...Microsoft.. .
                                                                                                      4E 45 54 20 46 72 61 6D 65 77 6F 72 6B 00 00 )    // NET Framework..
  .custom instance void [System.Runtime]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 2F C2 A9 20 4D 69 63 72 6F 73 6F 66 74 20   // ../.. Microsoft 
                                                                                                        43 6F 72 70 6F 72 61 74 69 6F 6E 2E 20 20 41 6C   // Corporation.  Al
                                                                                                        6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65   // l rights reserve
                                                                                                        64 2E 00 00 )                                     // d...
  .custom instance void [System.Runtime]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 0C 34 2E 36 2E 32 34 30 32 37 2E 30 30 00   // ...4.6.24027.00.
                                                                                                          00 ) 
  .custom instance void [System.Runtime]System.Reflection.AssemblyInformationalVersionAttribute::.ctor(string) = ( 01 00 25 34 2E 36 2E 32 34 30 32 37 2E 30 30 20   // ..%4.6.24027.00 
                                                                                                                   62 75 69 6C 74 20 62 79 3A 20 44 44 42 4C 44 31   // built by: DDBLD1
                                                                                                                   30 33 31 2D 64 6C 61 62 00 00 )                   // 031-dlab..
  .custom instance void [System.Runtime]System.CLSCompliantAttribute::.ctor(bool) = ( 01 00 01 00 00 ) 
  .custom instance void [System.Runtime]System.Reflection.AssemblyMetadataAttribute::.ctor(string,
                                                                                           string) = ( 01 00 00 00 00 00 ) 
  .publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00   // .$..............
                00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00   // .$..RSA1........
                07 D1 FA 57 C4 AE D9 F0 A3 2E 84 AA 0F AE FD 0D   // ...W............
                E9 E8 FD 6A EC 8F 87 FB 03 76 6C 83 4C 99 92 1E   // ...j.....vl.L...
                B2 3B E7 9A D9 D5 DC C1 DD 9A D2 36 13 21 02 90   // .;.........6.!..
                0B 72 3C F9 80 95 7F C4 E1 77 10 8F C6 07 77 4F   // .r<......w....wO
                29 E8 32 0E 92 EA 05 EC E4 E8 21 C0 A5 EF E8 F1   // ).2.......!.....
                64 5C 4C 0C 93 C1 AB 99 28 5D 62 2C AA 65 2C 1D   // d\L.....(]b,.e,.
                FA D6 3D 74 5D 6F 2D E5 F1 7E 5E AF 0F C4 96 3D   // ..=t]o-..~^....=
                26 1C 8A 12 43 65 18 20 6D C0 93 34 4D 5A D2 93 ) // @amp;...Ce. m..4MZ..
  .hash algorithm 0x00008004
  .ver 4:0:10:0
}
.module System.Collections.dll
// MVID: {8000E3BE-214B-42D9-AE78-1C0D678A64BB}
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000009    //  ILONLY
// Image base: 0x02520000

1 个答案:

答案 0 :(得分:0)

我终于搞清楚了。 .ver 0.0.0.0但是包版本1.0.0-alpha;应该是0.0.0-alpha。的Bleh!