Excel-DNA / ExcelDna

Excel-DNA - Free and easy .NET for Excel. This repository contains the core Excel-DNA library.
https://excel-dna.net
zlib License
1.26k stars 270 forks source link

PackExcelAddIn error DNA-818471385 #700

Open innominateAtWork opened 2 weeks ago

innominateAtWork commented 2 weeks ago

After updating to the latest version of visual studio (17.10.2) I started getting the error below on build.

1>MSBUILD : PackExcelAddIn error DNA-818471385: Assembly at bin\Debug\net6.0-windows\System.Threading.Channels.dll could not be packed. Possibly a mixed assembly? (These are not supported yet.)
1>MSBUILD : PackExcelAddIn error DNA-818471385: Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Threading.Channels, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Cannot specify assembly evidence under MultiDomain after non-GAC assemblies with default evidence have been loaded in appdomain. (Exception from HRESULT: 0x8013101D)
1>MSBUILD : PackExcelAddIn error DNA-818471385: File name: 'System.Threading.Channels, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.Runtime.InteropServices.COMException (0x8013101D): Cannot specify assembly evidence under MultiDomain after non-GAC assemblies with default evidence have been loaded in appdomain. (Exception from HRESULT: 0x8013101D)
1>MSBUILD : PackExcelAddIn error DNA-818471385:    at System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, Boolean fSkipIntegrityCheck, SecurityContextSource securityContextSource)
1>MSBUILD : PackExcelAddIn error DNA-818471385:    at System.Reflection.Assembly.Load(Byte[] rawAssembly)
1>MSBUILD : PackExcelAddIn error DNA-818471385:    at ResourceHelper.ResourceUpdater.AddAssembly(String path, String source, Boolean compress, Boolean multithreading, Boolean includePdb)
1>MSBUILD : PackExcelAddIn error DNA-818471385: 
1>MSBUILD : PackExcelAddIn error DNA-818471385:

I am able to reproduce this with this minimal project file (no code needed)

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>    
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="ExcelDna.AddIn" Version="1.8.0" />
    <PackageReference Include="System.Threading.Channels" Version="7.0.0" />
  </ItemGroup>

</Project>

The error only happens when building with-in visual studio, not when building via dotnet build.

govert commented 4 days ago

@Sergey-Vlasov Could you confirm this problem, and maybe track down what the problem is with the System.Threading.Channels package?