Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Reflection.Metadata in NuGet package for build #589

Open
govert opened this issue Apr 5, 2023 · 4 comments
Open

System.Reflection.Metadata in NuGet package for build #589

govert opened this issue Apr 5, 2023 · 4 comments
Assignees

Comments

@govert
Copy link
Member

govert commented Apr 5, 2023

We have this as a dependency of our build task, but we're not shipping the library in the NuGet package.
The build normally seems to work fine, but this discussion makes me ask whether we are supposed to ship it or not.
How would we know whether this is expected to be available in the build environment?

@Sergey-Vlasov
Copy link
Contributor

As I understand, System.Reflection.Metadata comes with .NET Core and VS MSBuild.

I’m (unfortunately?) can’t reproduce the problem from the discussion on my machine(s). Tried VS 2022 17.1.6 and VS 2019 too.

And without experiencing the problem, I can’t try to see if adding System.Reflection.Metadata.dll to our package will help or not.

@Michael-Kempe
Copy link

Hi, I see the same error when building my project on VS2019 v16.11.32.

Adding a reference to the project does not help - also adding System.Reflection.Metadata.dll v6.0.0.0 to the Excel DNA Package Folder (ExcelDna.AddIn.1.7.0\tools\net452) does not work.

My project:
AnyCPU
.Net Framework v4.7.2
VS 2019 v16.11.32

My project worked with ExcelDna.AddIn v1.6

Any suggestions?

Here's the error message:
Severity Code Description Project File Line Suppression State
Error 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, List1 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, List1 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:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/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: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\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: The same bind was seen before, and was failed with hr = 0x80070002. Test.Excel

@govert
Copy link
Member Author

govert commented Jan 4, 2024

@Michael-Kempe Thanks for reporting that you're running into this problem too.
I'll have to test with a clean machine and VS 2019 installation to see if this can be reproduced.

My only immediate suggestion is to build with VS 2022, or maybe from a 'dotnet build' command line.

@Sergey-Vlasov
Copy link
Contributor

I've retested it with VS 2019 on my main workstation and on a clean VM with the project attached and still can't reproduce the problem. Wondering what may cause it...

MyAddin.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants