Viewer lines in License.licx breaking build process - c#

I've recently been tasked with adding a report to an older WPF application. Part of the process involved adding ActiveReports to the solution in question.
After getting the report implemented and tested on my local machine, it came time to commit it up to our Dev/Test build environments. Everything went fine, until I attempted to run the application on a machine that did not have ActiveReports installed and licensed on it - I got the "Viewer needs to be licensed error window."
Here's where things get confusing, though. It should be working.
For starters, I'm running ActiveReports 8.0.133.0.
The contents of my licenses.licx file are:
GrapeCity.ActiveReports.SectionReport, GrapeCity.ActiveReports.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
I've generated a satellite licensing DLL for the WPF project's executable, and ensured that it's referenced and set to Copy Local = true. (I've already dealt with this in the past.)
Even though it's not a web project, for safety's sake, I used the WebKey Generator and added an Active Report 8 Developer key to the app.config file.
It gets more interesting, though. When I add the following lines to my licenses.licx file, as the error window I get above suggests I should do:
GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
GrapeCity.ActiveReports.Viewer.Wpf.Viewer, GrapeCity.ActiveReports.Viewer.Wpf.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff
When I try to simply build the project in Dev, the build fails with the following message:
[10:29:34] [exec] (CompileLicxFiles target) ->
[10:29:34] [exec] Properties\licenses.licx(2): error LC0004: Exception occurred creating type 'GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff' System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001 [C:\CheckoutDirectory\Project\[(0) BUILD]\UI\UI.csproj]
[10:29:34] [exec] Properties\licenses.licx(3): error LC0004: Exception occurred creating type 'GrapeCity.ActiveReports.Viewer.Wpf.Viewer, GrapeCity.ActiveReports.Viewer.Wpf.v8, Version=8.0.133.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff' System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001 [C:\CheckoutDirectory\Project\[(0) BUILD]\UI\UI.csproj]
For those who don't want to scroll:
System.ComponentModel.LicenseException: License cannot be confirmed. Error code: 01-001
The end result is a sort of Morton's Fork of badness. Either I can build the app, but I can't run the report (which, is sort of the point of me making these changes), or I simply can't build the app at all.
Question: What can I do to get the report viewer to run without a license exception and keep the application building? I should also note, I'm on a short deadline with this!

I was correct to add the Win and WPF viewer lines; it turns out the answer was to upgrade the Build server with Active Reports 8. From there, everything went swimmingly.
TL;DR - Upgrade everything that needs to be upgraded!

Related

Could not load type 'System.Dynamic.IInvokeOnGetBinder'

I have a .Net Core 3.1 WPF app. It needs to connect to a service and pull/push data to that service. The app executable works without any error message. However, when I publish the Self Contained app and make it a single exe file, It is not able to connect to the service and throws an exception with the following message.
Could not load type 'System.Dynamic.IInvokeOnGetBinder' from assembly netstandard, Version=2.1.0.0, Culture=neutral
What may cause this exception?
This must be a bug on the Microsoft side. I went ahead and unchecked the Trim unused assemblies and the app starts working. Although this outputted a bigger executable file, Trimming seems to be removing too much if enabled.

Crystal Report to PDF in .NET

I put together a POC console app. to generate a PDF from a Crystal Report (using CrystalDecisions libraries)
It all works fine on my dev. box, but encounters an exception when executed elsewhere:
Could not load file or assembly
'CrystalDecisions.ReportAppServer.CommLay er, Version=13.0.2000.0,
Culture=neutral, PublicKeyToken=692fbea5521e1304' or on e of its
dependencies. The system cannot find the file specified.
Unhandled Exception: System.TypeInitializationException: The type
initializer for
'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an
exception. --
-> System.IO.FileNotFoundException: Could not load file or assembly 'CrystalDeci
sions.ReportAppServer.CommLayer, Version=13.0.2000.0, Culture=neutral, PublicKey
Token=692fbea5521e1304' or one of its dependencies. The system cannot find the f
ile specified.
at CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor()
I believe this is caused by the absence of the Crystal Reports runtime (which is not explicitly installed).
1) Can anyone please confirm this?
2) Is there any way to get this working without installing Crystal Reports runtime on the target machine(s)?
I've read about building an installer with merge modules etc. but this is a console app and I don't want to go down that route.
Thanks in advance.
EDIT:
I checked out the DLL dependencies and this actually appears to be missing libraries API-MS-WIN-CORE-*
You will need to distribute the runtime for Crystal Reports to work.
Another option is to write second app to generate the pdf files which you could install on a server, then each of your console apps send a request to the new server app which sends back the pdf. This would mean the crystal runtime would only be installed on one machine, and the original console app wouldn't need to worry about it.
Just for information, the crystal runtime can be downloaded from here: http://scn.sap.com/docs/DOC-7824

Trouble when redeploying WP8.1 app

I met a problem, every time I want to deploy my app again, I will encounter error:
"An exception of type 'System.IO.FileNotFoundException' occurred in DropNetRT.ni.DLL but was not handled in user code
Additional information: Could not load file or assembly 'System.Net.Http.Phone, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified."
I have to uninstall the app, and then deploy. But next deployment same error again.
I'm also seeing this error - it only shows in Release mode, running the same app in Debug mode it doesn't repro.
The WP8.1 Silverlight solution builds without issue in both configurations.
Workaround for me is to remove all System.Net references solution-wide, clean the solution, then add them back in (using NuGet with Microsoft.Net.Http). Takes time and is annoying, but it works.
There seems no logic that the System.Net references removed and added back in are exactly the same assemblies and work fine on first deployment but fail on redeployment. It is even possible to redeploy exactly the same build and see this error.

One solution causing issues with an unrelated one?

Recently I've had a lot of trouble with a solution I've been working on so I decided to redo it from scratch. Basically, it's an ASP.NET application and a Web Service. I got everything to where it should be working. It's deployed to IIS, and when I try to debug I get: "Unable to start debugging on the web server. The web server is not configured correctly."
So I tried running without debugging and I get this error:
Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify yourconfiguration file appropriately.
Parser Error Message: Could not load file or assembly 'BrowserInfoApp'
or one of its dependencies. This assembly is built by a runtime newer
than the currently loaded runtime and cannot be loaded.
Source Error:
Line 57: <add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 58: <add assembly="System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 59: <add assembly="*" />
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\web.config Line: 59
Unsure of what this line did, I tried commenting it out. It still wouldn't let me debug on the server and this was the result of running without debugging again:
Parser Error
Description: An error occurred during the parsing of a resource required
to service this request. Please review the following specific parse error
details and modify your source file appropriately.
Parser Error Message: Could not load type 'BrowserInfoApp.Global'.
Source Error:
Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="BrowserInfoApp.Global" Language="C#" %>
Source File: /global.asax Line: 1
What is strange about this, is that BrowserInfoApp is completely unrelated. It is something that I made for testing, but the solution I am using now has never referenced it or been related to it. I started the solution I'm using now fresh, under an hour ago, so it's not a forgotten reference or anything like that.
I'm running everything on Windows XP with IIS 5.1.
So far I've tried removing the BrowserInfoApp virtual directory from IIS. If need be, I will try deleting the entire app, but I feel as if that's unecessary.
I really don't know where to go with this. If there is more information that I could provide, please let me know and I would be glad to do so.
Edit: I've tried deleting all of BrowserInfoApp and I get the same error.
Maybe you copy and pasted the reference to the BrowserInfoApp class when you rebuilt from scratch. Delete the Global.asax file and then re-add it, making sure it doesn't reference that assembly, which was built in a newer version.
Web.config files are hierarchical. Perhaps there's a web.config at a higher level of the virtual hierarchy which is referencing this other assembly.
In that case, you'll have to upgrade the applications in the higher levels of the hierarchy.
I solved the issue by removing "Inherits="BrowserInfoApp.Global"" from the Global.asax file. I also uncommented "add assembly="*" /" in my web.config file. I think I may have also had an issue with publishing to IIS (I named the site something different than the project name).
Not too sure what went wrong or why it works now, but it does.
I had the same issue. My setup: all my web apps were created as applications in the Default Web Site in IIS. I somehow managed to let one of my web projects in an unrelated solution create itself in the Default Web Site. So all my other solutions inherited the config settings, but they didn't have the required DLLs.

NSevriceBus Assembly Version Error

I have an issue when trying to load the NServiceBus assembly from a client machine. The software runs correctly from my development box but once rolled out I get the following error:
Could not load file or assembly 'NServiceBus, Version=2.0.0.1100, Culture=neutral, PublicKeyToken=9fc386479f8a226c' or one of its dependencies. The system cannot find the file specified.
The weird thing is I am not using version 2.0.0.1100, I am using the latest version 2.0.0.1219. It seems to be referencing the old version somewhere but I cannot find where. I have set the “Specific Version” flag to true on both the NServiceBus & NServiceBus.Core assemblies and have tried to explicitly set the version number in the app config, both with no luck. I don’t understand why it works fine locally but errors once rolled out. The project causing the error is a shared class library and it only appears to be erroring on some projects too.

Categories