Closed buluti closed 1 year ago
Can you provide more information about your project:
The file/assembly version is deliberately left at 2.4.0.0 as it would otherwise require binding redirects or recompilation of existing software (if strong naming is used). This is not related to your problem.
Hi Manuel, Thanks for the quick reply. Here is the info:
Error: {"Could not load file or assembly 'Codecrete.SwissQRBill.Core, Version=2.4.0.0, Culture=neutral, PublicKeyToken=6aa6bd7a159d47c2' or one of its dependencies. The system cannot find the file specified.":"Codecrete.SwissQRBill.Core, Version=2.4.0.0, Culture=neutral, PublicKeyToken=6aa6bd7a159d47c2"}
Stack trace: at xxxxxxx-ccccccc-mmmmmm.QRCodeService.GenerateSwissQRCode(String invoicenum, Int32 ordernumber, String customerName, String customerZipCode, String customerCity, String customerStreet, String customerHouseNumber, String unstructuredMessage, String billInformation) in C:\xxxxxxx-ccccccc-mmmmmm\SomeOtherService.cs:line 98 at xxxxxxx-ccccccc.SomeServiceService.ReplaceInvoicePlaceholders(String template, PLBox plBox) in C:\xxxxxxx-ccccccc\Services\SomeService\SomeServiceService.cs:line 559 at xxxxxxx-ccccccc.SomeServiceService.GenerateInvoice(PLEnum notification, String language, PLB plb) in C:\xxxxxxx-ccccccc\Services\SomeService\SomeServiceService.cs:line 464 at xxxxxxx-ccccccc.Frontend.Controllers.WebApi.v3.InternalEmailsController.GetInvoiceAttachment(PLEnum notification, String culture, String plId) in C:\xxxxxxx-ccccccc.Frontend\Controllers\WebApi\v3\InternalEmailsController.cs:line 153 at xxxxxxx-ccccccc.Frontend.Controllers.WebApi.v3.InternalEmailsController.PLBegin(SendEmailModel model) in C:\xxxxxxx-ccccccc.Frontend\Controllers\WebApi\v3\InternalEmailsController.cs:line 436
It looks like an error in Visual Studio's package dependency management. It has some issues and weaknesses.
What kind of project is the final application, a Windows application, ASP.NET application etc.? - ASP.NET Is your library project and the project of the final application in the same Visual Studio solution? Or do you create a package from the library, and then add that package to the solution of the final application? - It's in the same solution Does your library project use other third-party NuGet packages? And if so, do they work? - Yes, couple of them and they all work. Do you use some form of dynamic library or class loading for the SwissQRBill related code and or the responsible service? - No
I checked the Core.csproj in your code. It seems that the assembly reference is 2.4.0.0. That is the only mention of 2.4.0.0 Could this be the problem?
It'll take me some time to reproduce it. In order to do so, I still need more information:
And the assembly version most likely is not the problem. It's more likely a Visual Studio problem as it has - for whatever reason - decided not to copy the SwissQRBill library (or the QRCodeGenerator library) to the ASP.NET directories.
What .NET version does the ASP.NET application use? - .Net Standard 2.0 Which NuGet package do you reference in your library project: Codecrete.SwissQRBill.Core, Codecrete.SwissQRBill.Generator, Codecrete.SwissQRBill.Windows or multiple of these? - right now I'm using Generator but I have tried with all 3 of them and the result is the same
Are your sure the .NET version is .NET Standard 2.0? .NET Standard is just a specification of .NET, not an implementation. It works for library projects, but for an ASP.NET application? (I won't be able to verify it myself until later today.)
There is not .NET Standard for an ASP.NET application. It's either .NET Framework 4.x.x, or .NET 3.1 / 5.0 / 6.0. Which one are you using?
The end application is .Net framework 4.7.2
I can reproduce it. As suspected Visual Studio does not copy the assembly Codecrete.SwissQRBill.Core.dll into the bin folder of the main application, be it for a bug or a limitation of the old style project format used for .NET Framework projects.
It's very surprising that QrCodeGenerator.dll, which is a dependency of Codecrete.SwissQRBill.Core.dll, is copied.
The only workaround I'm aware is to add the NuGet package Codecrete.SwissQRBill.Core to both the library project and the ASP.NET project. Other workarounds might exist.
Thank you very much Manuel
Hello there, I'm having a problem using the package. {"Could not load file or assembly 'Codecrete.SwissQRBill.Core, Version=2.4.0.0, Culture=neutral, PublicKeyToken=6aa6bd7a159d47c2' or one of its dependencies. The system cannot find the file specified.":"Codecrete.SwissQRBill.Core, Version=2.4.0.0, Culture=neutral, PublicKeyToken=6aa6bd7a159d47c2"}
It looks like that the2.4.0.0 in the Core.csproj was not updated
I'm running .Net Standard 2.0 project on the win machine Can you help? Thank you