Trouble when redeploying WP8.1 app - c#

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.

Related

ASPNETCOMPILER error ASPCONFIG: Could not load file or assembly 'My dll' or one of its dependencies. Only publish time error occured

ASPNETCOMPİLER(0,0): Error ASPCONFIG: Could not load file or assembly 'DAL' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I update oracle data access from 2.121.2.0 to 4.122.19.1.
I changed my project platform target to x64.
Now project is working. But when I publish error occured.
Does anyone know what may be causing this issue and how to solve this problem ?
İf you look output you see that compiler use C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe but I need is C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe. x86 aspnet compiler doesn't compile for x64 platform. So I changed compiler with added new x64 active solution platform. Then everything is ok

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.

Viewer lines in License.licx breaking build process

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!

Re-named assembly, application won't build

I renamed my WPF application's assembly from DBce_TEST2 to AMS, then attempted to build it to see what would happen. I ran it, and it wouldn't build for obvious reasons but now after renaming it back to DBce_TEST2 I get the following error:
Managed Debugging Assistant 'BindingFailure' has detected a problem in 'G:\C# Projects\Asset Management System\DBce_TEST2\bin\Debug\DBce_TEST2.vshost.exe'.
Additional Information: The assembly with display name 'AMS' failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'AMS' or one of its dependencies. The system cannot find the file specified.
The error can be fishy. Use Fusion log viewer to understand what has gone wrong.
How to enable assembly bind failure logging (Fusion) in .NET
Figured it out. Renamed the assembly again to some random text, attempted to run it, then renamed back to original assembly name and the error disappeared. Guess some generated files were messed up by visual studio a little bit, and this fixed it.

Windows Service: System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the re

I am using a windows service, In which I am having a reference of an assembly which is copy local= false. But I am trying to load it at runtime, which is though working fine when I am running it from visual studio, But when I try to install it, cmd gives this error:
An exception occurred while trying to find the installers in the D:\Official\Pro
jects\20131007_ImproveDN\build\debug\application
s\SubscriptionService\SubscriptionService.exe assembly.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the
requested types. Retrieve the LoaderExceptions property for more information.
Aborting installation for D:\Official\Projects\2
0131007_ImproveDN\build\debug\applications\SubscriptionService\SubscriptionServi
ce.exe.
An exception occurred during the Rollback phase of the System.Configuration.Inst
all.AssemblyInstaller installer.
System.InvalidOperationException: Unable to get installer types in the D:\Offici
al\Projects\\20131007_ImproveDN\build\debug\appli
cations\SubscriptionService\SubscriptionService.exe assembly.
The inner exception System.Reflection.ReflectionTypeLoadException was thrown wit
h the following error message: Unable to load one or more of the requested types
. Retrieve the LoaderExceptions property for more information..
An exception occurred during the Rollback phase of the installation. This except
ion will be ignored and the rollback will continue. However, the machine might n
ot fully revert to its initial state after the rollback is complete.
Also one thing to note here is that If I make copy local true of that .dll it makes installation fine. BUt I dont want to load it before installation so I want to do it at runtime.
Thanks in Advance.
Maybe you need to use another version of InstallUtil.exe:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe
c:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
c:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe
Try to use x64 version from Framework64 subfolder.
Also one thing to note here is that If I make copy local true of that .dll it makes installation fine. BUt I dont want to load it before installation so I want to do it at runtime.
That doesn't really matter, the assembly still needs to make it to the installation directory. If you set Copy Local to false, then you still need to distribute the assembly with the installation.
I had a similiar problem. I did the following that worked for me.
First, use FuseLog (Assembly Binding Viewer) to figure out where the binding is failing (Described Here
Once I began getting logs, I noticed this in my log was "Invalid assembly platform or ContentType in file (hr = 0x8007000b)."
My solution consisted of 3 projects. I went through the build properties of each project and noticed that one of them was targeted for "x86". I changed it to "Any CPU", recompiled and the problem was resolved.

Categories