I have created a C# project which works as intended when tested on desktop.
However, when I run the executable on a mobile device using .NET CF 3.5 I get the following error: File or assembly name 'System.Windows.Forms, Version=2.0.0.0, etc etc.' or one of its dependencies, was not found.
If I understand correctly, this means that one of the assemblies referenced in the project is "desktop only" and is not present on the mobile device. So how can I get access to the .NET CF 3.5 equivalent and reference it in my project in Visual Studio?
Thanks for any help.
You need to create a "Smart Device Project" to run your application on a Windows CE device. That project type will let you reference CF assemblies only. There are a lot of features that are not supported by the CF version, so your code maybe won't compile.
Related
Since English is not my native language I'm gonna try to explain myself as clearly as possible.
I have an old project on Visual Basic targeting the .NET Framework version 4.5.2, the project has a reference to System.Drawing dll but no System.Drawing.Common dll reference, when executing the application on my development PC it works fine.
My problem is that when I execute it in a virtual machine that I'm starting to use by requirement of my boss that had no .NET installed, the application cannot found a reference to System.Drawing.Common dll; I already have installed on the virtual machine:
.NET Compact Framework 2.0 (Since my boss told me that it could be some even older dlls)
.NET Compact Framework 3.5 (Since it went with the 2.0 version)
Windows Desktop Runtime 3.0.3 (Cause I found some links that said the dll is part of .NET Core)
Windows Desktop Runtime 3.1.3 (Just in case)
And trying to install any of the .NET 4.x versions tells me that its already installed cause the OS is Windows 10.
Since that seemed not to work I also put a copy of System.Drawing.Common.dll directly in the executable directory and modified the project to load it when the AssemblyResolve event fires. But it still not working, and also I canĀ“t understand why is it requesting that assembly if none of my dlls and exe reference to it.
I'm trying to keep the virtual machine with no developer tools so i'm not sure what else to do. Would be pretty grateful if anyone has some clue of what my problem is. Thank you.
Edit: what makes more noise in my mind is: If System.Drawing.Common is a dll of .NET, shouldn't it be automatically loaded to any .NET application when it is needed? or at least be recovered since I already put the dll in the same folder as the .exe file of my application
I have a classic asp site that needs to consume a .NET assembly. I have written a dll library that is COM-visible and the project is using a reference to a Paypal-SDK library. I have been successfully able to create the dll and consume it in a classic asp web page on my Windows 10 development machine. When I copy the web application to a Windows 2012 running IIS 7.x I get the following error
nDataConsulting.PaypalStub error '80070002'
Could not load file or assembly 'PayPal, Version=1.8.0.0, Culture=neutral, ?>PublicKeyToken=5b4afc1ccaef40fb' or one of its dependencies. The system cannot >find the file specified.
The COM visible assembly is using the Paypal.dll SDK which I believe it cannot find on the Windows 2012 server. I have tried placing the dll in the application BIN folder, tried regsvr32 etc but I have not been able to make my dll find the dependent dll. Kindly help me resolve this issue as this is a major show stopper right now
There is a program called Dependency Walker which shows basic information about a DLL, such as its methods, and also lists the dependents DLLs.
It was answered here:
https://stackoverflow.com/a/7378982/8419161
If you find any related DLLs, you must include them along with the Paypal one.
I am running this bit of code:
string serialized = JsonConvert.SerializeObject(somethingToSend);
And it throws this exception:
MissingMethodException: Could not load type 'System.Runtime.Serialization.StreamingContext' from assembly 'mscorlib, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
Here is my configuration:
Visual Studio 2008 (with all the latest service packs etc)
Smart Device project targeting Windows Mobile 6 .Net 3.5
Json DotNet version 4.5 Release 7 (referencing the DLL from the WindowsPhone folder in the zip)
The answer to this question "Is there a library to read JSON in C# on Windows Mobile?" implies that it should work.
I am running it in debug with the real device attached (so no emulator) where I have previously installed the CAB file from here without error:
C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\NETCFv35.wce.armv4.cab
The application runs fine until I click the button that is running the line above, so does anyone know what I am missing?
This thread "Json.Compact.dll for Windows CE 5.0?" suggests that I would need the Windows SDK installed, which I have. Given it is running on the device itself I guess that is not going to be the fix anyway.
The other suggestion is to build from source but like the author of the question I cannot load the project file into VS 2008 to do that. I could create a new project and include the source files and try to get it to compile but before I do that I thought I would ask here if it is worth it or if there is something else missing from the installation on the device perhaps? Or maybe I should be using an alternate build?
So I needed to RTFM! The readme file says:
Microsoft stopped support for the Compact Framework in Visual Studio 2010.
For a Compact Framework 3.5 build download Json.NET 3.5.
So I grabbed the most recent 3.5 version which is: Json.NET 3.5 Release 8, updated my reference to point to the Newtonsoft.Json.Compact.dll assembly, ran it and it worked fine.
I'm trying to use Microsoft Solver Foundation in my C# application in VS2010 Ultimate. I've installed MSF (64 bit version) and as far as I understand I should be able to use the services after declaring:
using Microsoft.SolverFoundation;
However, I get the error "The type or namespace name 'SolverFoundation' does not exist in the namespace 'Microsoft'".
I see that there's Microsoft.Solver.Foundation.dll located in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0
Initially I thought the 64 bit version might be the problem so I uninstalled and switched to the 32 bit version. But no success either.
How can I integrate MSF into my C# application?
I'm trying to use Microsoft Solver Foundation in my C# application in VS2010 Ultimate. I've installed MSF (64 bit version) and as far as I understand I should be able to use the services after declaring:
using Microsoft.SolverFoundation;
How can I integrate MSF into my C# application?
At no point did you mention that you added a reference to this library to your project, and the behavior you are describing is consistent with not having added a reference. Therefore, you also need to add a reference to this library to your project.
I've already tried adding the references before but it wouldn't work. Now I've noticed something in the warnings (which I probably didn't see before):
"The referenced assembly "Microsoft.Solver.Foundation, Version=3.0.1.10599, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project."
I fixed this by setting Application Properties -> Application -> Target Framework from ".Net Framework 4 Client Profile" to ".Net Framework 4".
Does "Microsoft Solver Foundation" show up when you go to Add Reference...?
If it does not perhaps you are not using the correct framework, try Project -> Properties.. -> Compile -> Advanced Compile Options... and certify you are NOT using .NET 4 Framework Client Profile (uses to be default for new projects). If it is, change it to .NET 4 Framework.
If that also fails... have you downloaded and installed the solver?
You need to add a reference to that DLL you found to your project.
When I run any project from Visual Studio, it works excellent (on Motorola MC 3190 - WinCE 6.0)
However, when I install and run the application on the device, I get this error:
No compatible FusionInterface dll found, Expected version is 4.1.0.1 or higher version having the format 4.x.x.x
What could be the problem?
In my case, deploying Symbol.Fusion.dll and FusionInterface.dll files in the same directory than my executable has resolved this error.
You must install the symbol.all.arm.cab file. If you are using Windows CE then you need the armv4 version. If you are using Windows Mobile, then you need the armv4i version.
Also, make sure there is no local copy of the DLLs in your application's directory; this could be possibly causing a version mismatch.
Adding a reference to Symbol.ResourceCoordination worked for me. Per the CS_FusionSample1 code example included with the Motorola EMDK v2.9, the relevant Symbol references are Symbol, Symbol.Fusion, and Symbol.ResourceCoordination.
Note, I'm building for a Motorola 9190 handheld under Windows CE 6.0.
Fusion Interface DLL Version Compatibility
EMDK for .NET access Fusion Public API via Fusion interface DLL as mentioned in the Overview section. There can be different versions of Fusion Public API and in return many versions of Fusion Interface DLLs.
Version Incompatibility Issue
If this DLL is incompatible with EMDK, an appropriate meaningful error message will be provided in the exception when trying to access Fusion. This occurs when creating Config and WLAN objects.
Possible Messages
Older and incompatible FusionInterface dll 1.0.0.1 found. Expected version is 2.0.0.3 or higher version having the format 2.x.x.x
Newer and incompatible FusionInterface dll 3.1.0.5 found. Expected version is 2.0.0.3 or higher version having the format 2.x.x.x
Solution
The DLL version incompatibility arises because of the two files (Fusion Interface DLL and the Fusion Assembly DLL) taken from different EMDK packages. To fix the issue,
Method 1:
Remove "Symbol Managed Class Libraries" using "Remove Programs" in the control panel of the device.
Check "\Windows" folder of the device for any existence of "FusionInterface.dll" and if so, delete it.
Take the "symbol.all.arm.cab" from EMDK installed location, copy to the device and run installation.
The typical location is the appropriate sub directory (wce400\armv4 or wce500\armv4i) of "\Program Files\Enterprise Mobility Developer Kit for .NET\v2.x\SDK\Smart Devices".
Run the application.
Method2:
Copy the appropriate DLL to the \Windows directory of the device.
Run the application
Note: This DLL is not separately available in the EMDK for .NET package.