Could not load file or assembly 'System.Reflection.Metadata
vkirienko opened this issue · 1 comments
vkirienko commented
Hi,
I just updated Excel-DNA packages from 1.6 version to 1.7 and now facing below error running build using TeamCity. No issues building on my local box.
System.Reflection.Metadata is in bin/Release folder but it seems like that folder is not probed during the build. I tried to add it (and it's dependency System.Collections.Immutable.dll) to file:///E:/TeamCityBuildAgents/TCBldAgnt1_PCOTCAGNT01/work/de6594929000d07e/packages/ExcelDna.AddIn.1.7.0/tools/net452 folder.
Build went through after that.
PackExcelAddIn: Running PackExcelAddIn Task
PackExcelAddIn: Using base add-in bin\Release\XYZ.ExcelSync-AddIn.xll
PackExcelAddIn: -> Updating resource: Type: CONFIG, Name: __MAIN__, Length: 2695
PackExcelAddIn: ~~> ExternalLibrary path XYZ.ExcelSync.dll resolved to bin\Release\XYZ.ExcelSync.dll.
PackExcelAddIn: ~~> Assembly path ExcelDna.Registration.dll resolved to bin\Release\ExcelDna.Registration.dll.
error DNA964120249: System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.Metadata, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Reflection.Metadata, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at ExcelDna.PackedResources.ExcelDnaPack.IsAssembly(String path, Boolean& isPE)
at ExcelDna.PackedResources.ExcelDnaPack.IsNativeLibrary(String path)
at ExcelDna.PackedResources.ExcelDnaPack.PackDnaLibrary(String dnaPath, Byte[] dnaContent, String dnaDirectory, ResourceUpdater ru, Boolean compress, Boolean multithreading, List`1 filesToPublish, Boolean packManagedDependencies, String[] dependenciesToExcludeParam, String outputBitness, IBuildLogger buildLogger)
at ExcelDna.PackedResources.ExcelDnaPack.Pack(String dnaPath, String xllOutputPathParam, Boolean compress, Boolean multithreading, Boolean overwrite, String usageInfo, List`1 filesToPublish, Boolean packNativeLibraryDependencies, Boolean packManagedDependencies, String excludeDependencies, Boolean useManagedResourceResolver, String outputBitness, IBuildLogger buildLogger)
at ExcelDna.AddIn.Tasks.PackExcelAddIn.Execute()
=== Pre-bind state information ===
LOG: DisplayName = System.Reflection.Metadata, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///E:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/
LOG: Initial PrivatePath = NULL
Calling assembly : ExcelDna.AddIn.Tasks, Version=1.1.0.0, Culture=neutral, PublicKeyToken=f225e9659857edbe.
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: E:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Reflection.Metadata, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///E:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/System.Reflection.Metadata.DLL.
LOG: Attempting download of new URL file:///E:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/System.Reflection.Metadata/System.Reflection.Metadata.DLL.
LOG: Attempting download of new URL file:///E:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/System.Reflection.Metadata.EXE.
LOG: Attempting download of new URL file:///E:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/System.Reflection.Metadata/System.Reflection.Metadata.EXE.
LOG: Attempting download of new URL file:///E:/TeamCityBuildAgents/TCBldAgnt1_PCOTCAGNT01/work/de6594929000d07e/packages/ExcelDna.AddIn.1.7.0/tools/net452/System.Reflection.Metadata.DLL.
LOG: Attempting download of new URL file:///E:/TeamCityBuildAgents/TCBldAgnt1_PCOTCAGNT01/work/de6594929000d07e/packages/ExcelDna.AddIn.1.7.0/tools/net452/System.Reflection.Metadata/System.Reflection.Metadata.DLL.
LOG: Attempting download of new URL file:///E:/TeamCityBuildAgents/TCBldAgnt1_PCOTCAGNT01/work/de6594929000d07e/packages/ExcelDna.AddIn.1.7.0/tools/net452/System.Reflection.Metadata.EXE.
LOG: Attempting download of new URL file:///E:/TeamCityBuildAgents/TCBldAgnt1_PCOTCAGNT01/work/de6594929000d07e/packages/ExcelDna.AddIn.1.7.0/tools/net452/System.Reflection.Metadata/System.Reflection.Metadata.EXE.
vkirienko commented
I managed to fix it. Realized that TeamCity uses old MSBuild runner instead of recommended .NET runner. After switching build succeeds.