Installer for Win Form App with drivers and dependencies - c#

I am trying to make an installer for an open source app called mission planner. I've had some features and so on but now I can't make an installer for it. The problems are :
I need the installer to install drivers too and I don't know how to do this.
For now when I run the app on the new machine the script stop with the error
System.TypeInitializationException: The type initializer for
'MissionPlanner.MainV2' threw an exception. --->
System.BadImageFormatException: Could not load file or assembly
'System.ValueTuple, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Reference
assemblies should not be loaded for execution. They can only be loaded
in the Reflection-only loader context. (Exception from HRESULT:
0x80131058) ---> System.BadImageFormatException: Cannot load a
reference assembly for execution. --- End of inner exception stack
trace --- at MissionPlanner.MAVLinkInterface..ctor() at
MissionPlanner.MainV2..cctor() --- End of inner exception stack trace
--- at MissionPlanner.MainV2..ctor() at MissionPlanner.Program.Start(String[] args)
Now when I look in the dependencies at the file monoPosix.netstandard.dll the dependencie mono.posix is showing a yellow warning flag.
SO It looks like my issue is in the dependencie of some dependencies...
I am a bit lost with the way I should fix this. So if anyone knows anything about installers with complex dependencies I would be glad to here from him.
Thank you in advance.
Alexandre Larribau

Related

Getting ModuleLoadException (C++ Modules) and TypeLoadException from WindowsBase.DLL ONLY when attempting to use the System.Windows.Clipboard class?

I am running a C# WinForms app. The goal of this small section of code is to copy the contents of a .JMP file into a .csv file for data manipulation. Easy enough right? I do not want to do this all in JMP or using a .jsl. The code for parsing and reformatting the data is already there for .csv files and has been working flawlessly.
The app that runs fine unless I have this one specific line that accesses the System.Windows.Clipboard class in my code:
Clipboard.SetDataObject(my data);
When I run the code with the line commented out all is well, but when I run them with the line included the app immediately goes into breakmode with these exceptions:
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for '<Module>' threw an exception.
Source=<Cannot evaluate the exception source>
StackTrace: Cannot evaluate the exception stack trace
Inner Exception 1:
ModuleLoadException: The C++ module failed to load during appdomain initialization.
Inner Exception 2:
TypeLoadException: Could not load type 'System.Windows.Media.DisableDpiAwarenessAttribute' from assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
For Inner Exception 1, I am confused because this is a C# app in WinForms with no C++, don't know what the deal is here.
For Inner Exception 2, I am confused because the Assembly WindowsBase is for WPF and not WinForms. I am unable to even add a project reference to this WindowsBase assembly. Again, these errors only happen when I try to do anything with the System.Windows.Clipboard class.
I have downloaded, installed, and ensured the proper location of the following DLLs:
1. PresentationCore.dll
2. System.Windows.Forms.dll
Am I still missing some DLLs? Any help is appreciated.
You should use System.Windows.Forms.Clipboard instead of System.Windows.Clipboard, for the latter one is from WPF. You should remove the reference to PresentationCore.dll, because it's from WPF and not needed in WinForm.

Auth0 LoginResult not able to load Newtonsoft.Json 10.0.0.0

I am facing a weird kind of situation while trying to achieve LoginAsync using Auth0.OidcclientWpf SDK. I am using below code:
private async void PerformAuthenticationAsync()
{
Auth0Client auth0Client = new Auth0Client(new Auth0ClientOptions()
{
Domain = "mydomain",
ClientId = "clientid"
});
var extraParameters = new Dictionary<string, string>();
extraParameters.Add("connection", "connectionParam");
var result = await auth0Client.LoginAsync(extraParameters: extraParameters);
}
After performing the authentication process, I am getting error:
Not able to load NewtonSoftJson.dll version - 10.0.0.0
and the source was Identitymodel.oidclient. Here after setting IdentityModelEventSource.ShowPII to True I can see in the trace that the token for which I am looking for is recieved but LoginResult is failed to decode the header.
I tried refering NewtonSoft.Json dll version 10.0.2 in my project. Now I am getting exception like:
Not able to load NewtonSoftJson.dll version 11.0.0.0
and this time the Browser was not even launched to enter credentials.
I am confused which version of NewtonSoft.Json dll I should refer? I updated my IdentityModel.oidcclient to the latest version. Even after that IdentityModel.Oidcclient.LoginResult is complaining for NewtonSoft.Json version 10.0.0.0 unavailability.
I am not sure what is the real issue. Whether I have to refer both the versions (10 & 11) and how to do that? I would appreciate if someone can help.
UPDATE
below is the trace I am getting -
System.TypeInitializationException: The type initializer for
'System.IdentityModel.Tokens.Jwt.JsonExtensions' threw an exception.
---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) at
System.IdentityModel.Tokens.Jwt.JsonExtensions..cctor() --- End of
inner exception stack trace --- at
System.IdentityModel.Tokens.Jwt.JsonExtensions.DeserializeJwtHeader(String
jsonString) at
System.IdentityModel.Tokens.Jwt.JwtSecurityToken.Decode(String[]
tokenParts, String rawData) --- End of inner exception stack trace
--- at System.IdentityModel.Tokens.Jwt.JwtSecurityToken.Decode(String[]
tokenParts, String rawData) at
System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ReadJwtToken(String
token) at
IdentityModel.OidcClient.IdentityTokenValidator.d__4.MoveNext()
>
Same problem here, with Auth0.OidcClient 2.2.0.0 and Newtonsoft.Json version 11.0.0.0.
I have no real solution for the problem, either. In the end I implemented a custom assembly resolve handler as a workaround.
To make sure that this does not affect the rest of the application, I am installing the handler only temporarily while the login window is open. I also make sure to only load the assembly named "Newtonsoft.Json". The handler looks for the Newtonsoft.Json assembly in the folder of the executing assembly.

getting TypeInitializationException Oracle.DataAccess

I have Windows 10 machine. In that I am running a c# project which references Oracle.DataAccess.dll. I have installed ODAC112012_32Bit. There is a dll NexFen.FirmLoad which accesses Oracle dll. When I run the project I get following error:
System.TypeInitializationException: The type initializer for
'NexGen.FirmLoad.AppUtils' threw an exception. --->
System.IO.FileLoadException: Could not load file or assembly
'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) --->
System.IO.FileLoadException: Could not load file or assembly
'Oracle.DataAccess, Version=4.112.1.2, Culture=neutral,
PublicKeyToken=89b483f429c47342' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) --- End of inner
exception stack trace --- at NexGen.FirmLoad.AppUtils..cctor()
--- End of inner exception stack trace --- at NexGen.FirmLoad.LoadFirmware.d__0.MoveNext()
Check that your project meets all the following conditions:
You have an Oracle client installed (e.g. Oracle Instant Client)
Oracle.DataAccess.dll and the Oracle Client and the compile target of your application have all the same architecture (i.e. 32-bit vs. 64-bit)
Version of Oracle.DataAccess.dll is the same version as your Oracle client (even the minor version has to match). Your error message indicates version 4.112.3.0 and 4.112.1.2, perhaps there is your problem. Check installed versions in your GAC and Policies.

How to solve .Net Framework Version Issue?

It works fine on server. But now I'm deploying this on new server. I just copied the Package from my old server to this server.
When I browse application, getting the below mentioned error.
Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
On new Server its showing .net clr version v4.0.30319, but on old server it is
.net version v4.0.30319 for Application Pool.
Is this Framework related Issue? or m I missing something?
You new server might not have an ASP.NET-MVC installed on. You can set the reference to System.Web.WebPages.Razor copied to local set to true.
Right click on the System.Web.WebPages.Razor in your references and click properties. Set the Copy Local to true.

Problems upgrading MVC Mini Profiler to latest release

I've been using Mini Profiler in dev and production (azure) for a while and LOVE it.
It tried to upgrade to the latest release today via NUGET. The DLL get's placed in the bin but my site gets an error. If I go back to the old dll it works fine. Does anyone know how to fix this?
Server Error in '/' Application.
Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly 'MvcMiniProfiler, Version=2.0.4177.17902, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
MyGlobal.application_BeginRequest(Object sender, EventArgs e) in C:\Users\Nate\Documents\Visual Studio 2010\Projects\TrainerRoad\com.TrainerRoad.DataAccess\MyGlobal.cs:15
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
Be sure to read the documentation on http://code.google.com/p/mvc-mini-profiler/
In particular:
Ensure you remove all the modifications you made to web.config.
If you are profiling Entity Framework grab the MiniProfiler.EF package
If you are running latest EF see: Problem using SQL Server CE with Entity Framework code-first and ASP.NET MVC 3 and mvc miniprofiler
There is not MiniProfiler version 2.0.4177.17902 so I really do not know where it is coming from.

Categories

Resources