C# Visual Studio - Having trouble adding an assembly reference - c#

So, I'm new to adding assemblies and whatnot. I work in Unity and I want to add the Puma.NET OCR software to my build, but I'm having a lot of trouble. Here are the instructions to integrating the code into your project: https://drive.google.com/file/d/0BwGzQQGm378jNEVlcmlPU3gtcTg/view?usp=sharing
In Visual Studio, I added the references to my project Puma.Net and puma.intercomp. It's not letting me add the last dll file for some reason.
I have a test script which says "using Puma.Net" at the start. When it compiles in Unity, I get this error:
Unhandled Exception: System.TypeLoadException: Could not load type 'Puma.Net.PumaPage' from assembly 'Puma.Net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5e8cf038eac46fae'.
I've been at this for hours and I've been trying all kinds of different things, but I can't understand what I'm supposed to do. Any help?

I can´t read the instructions you posted, since the site sent a "file not found" when I click download. Anyway, you must follow these simples steps:
1) See if the NET version of PUMA is compatible with the same NET version you´re utilizing (eg. 4.5 or 4.6).
2) Add the reference to your project using the "Add Reference" and BROWSE the listed DLL´s of PUMA.
3) In the top of you main form, add "Using xxxxx" where that xxxxx is the name of the PUMA library
If it is not functioning, maybe it´s due to an incompatible library to UNITY - check this at PUMA site.

Related

WCF Service is unable to locate System.Net.Http in release build only

I'm working on an error that I'm getting in a WinForms application that was recently updated from .Net framework 4.5.2 to 4.7. The issue occurs only after the application has been deployed. The error is originating from inside a WCF service (.svc) that I'm using. The specific error text I'm getting is:
Could not load file or assembly 'System.Net.Http, Version=4.1.1.1,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The system cannot find the file specified.
In attempting to resolve this issue, I adjusted the App.Config file to bindingRedirect from System.Net.Http version 4.1.1.1 to 4.3.2 (which doesn't actually exist).
This resolved the issue with the service; however, when I made a call to System.Net.Http to download a string, the call failed. Presumably, this is because I directed System.Net.Http to use a dependency that does not actually exist (4.3.2).
This means currently I have a choice: either the service works, or calls directly to System.Net.Http work, but not both. Is anyone aware of how to make the service able find System.Net.Http 4.1.1.1? It is installed via NuGet... just seemingly not recognized unless:
1) I issue a binding redirect to a version of System.Net.Http that doesn't actually exist.
OR
2) I run the program in debug/release mode from Visual Studio (deployed release doesn't work).
I've found the issue, after several days of trouble. System.Net.Http is not published as it is supposed to be. It is a known issue (that is resolved, in theory), found here:
https://blogs.msdn.microsoft.com/bclteam/p/httpclient/
Issue 8
Symptom
ClickOnce applications targeting .NET Framework 4.0 that reference the Microsoft.Net.Http package may experience a TypeLoadException or other errors after being installed.
Resolution
This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following:
1.Right-click on the project and choose Add Existing Item
2.Browse to the HttpClient net40 package folder
3.In the File name text box enter *.*
4.Holding CTRL, select System.Net.Http.dll and System.Net.Http.Primitives.dll
5.Click the down-arrow next to the Add button and choose Add as Link
6.In Solution Explorer, holding CTRL select System.Net.Http.dll and System.Net.Http.WebRequest.dll
7.Right-click the selection, choose Properties and change Copy to Output Directory to Copy always
8.Republish

Cannot build solution because of log4net dependency issues C#

I am currently working on my colleague's project that he wrote a few years ago. The project uses "log4net" assembly although I do not really need it or use it. Anyways, when I'm trying to build project, i get this error:
Severity Code Description Project File Line Suppression State
Error Unknown build error, 'Cannot resolve dependency to assembly 'log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=9fea11e3513f1a42' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.' VersionChecker C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets 268
I've tried to remove the assembly, and also tried to redirect assembly versions without luck. I don't find any trace to log4net anywhere in my project and don't have a clue how to remove it completely and manage to build my project..
Thanks in advance for your help!
Go to 'Manage Nuget Packages for Solution' from Tools menu of VS and check if you could uninstall it from there.
There are multiple ways of building projects. The most common way is to use Visual Studio only. If this is your case, then simply go through each project in your solution explorer and expand references. You should see all the references to your project. Simply highlight Log4Net and press the delete key. You'll need to go through all the code that references Log4Net and remove it.
The other scenario is that you're using an external build script, like msbuild to do additional compilation. If this is the case you'll need to wade through your build scripts. The details vary among implementation, but a starting point is to simply highlight the project in question in the solution explorer and press alt+enter to bring up the properties. Check the build events tab for additional build script info.

How can fix System.InvalidOperationException = Unable to create service from type 'My type'?

I've got a web service that references a set of dlls that are currently version 6. I was given version 7 dlls to upgrade to, so I registered the new dlls in the GAC, removed the references in my project to the old dlls and added references in for the new ones. No problems so far.
I then proceeded to alter the App.config, which had references to these dlls and changed their version number to 7.0.0.0 from 6.0.0.0 and built the project. No errors or warnings.
Finally, I installed the web service and tested it out and got the following error:
[System.InvalidOperationException] = {"Unable to create service from
type 'the type,
dll name, Version=7.0.0.0, Culture=neutral,
PublicKeyToken=My token'."}
As I don't have access to the code in the dll's I don't know if it's something in them that's not working or whether it's perhaps a permissions / connection issue. Does anyone have some suggestions?
Press Ctrl + Q in Visual Studio in order to start texting in quick launch text box. Then type 'verbosity'. Change build output verbosity into 'Diagnostic' and analyze your build. That helps a lot in that cases.

Could not load file or assembly 'Jedox.Palo.Comm.DLL' or one of its dependencies in ASP.NET Website

Ok so I am trying to use the Palo DotNet SDK to access the OLAP server.
First I created an empty c# project, added the reference to Jedox.Palo.Dll.
It seems Jedox.Palo.Dll uses two other dll's namely 1. libpalo_en.dll 2. libpalo2.dll
(which are not type libraries themselves so can't be added as a references. See error below for more details on that).
So I read somewhere on SO that I need to add them to the Debug/bin directory of my application, and on doing so still got the error in the title. Then I changed the target framework from 4.0 to 2.0 and viola it worked!
So I then set out to do the same for a ASP.Net Website
I added the reference for the Jedox.Palo.Comm.dll and added the two other files to the bin directory. Image here: http://img200.imageshack.us/img200/6835/paloerror.png
But then I get the error message again. I have done everything I did in the C# application - Add the dll's to the bin dir, change the target framework to 2.0.
Here is the detailed error:
Warning 1 C:\Users\Development\Documents\Visual Studio 2010\WebSites\TestPalo\Default.aspx: ASP.NET runtime error: Could not load file or assembly 'Jedox.Palo.Comm.DLL' or one of its dependencies. The specified module could not be found. C:\Users\Development\Documents\Visual Studio 2010\WebSites\TestPalo\Default.aspx 1 1 C:...\TestPalo\
Here is the error message (pop up) if I try to add libpalo_ng.dll or libpalo2.dll as a reference:
A reference to 'C:\Users\Development\Documents\Visual Studio 2010\WebSites\TestPalo\Bin\libpalo_ng.dll' could not be added. No type libraries were found in the component.
So how can I overcome this. And if you're suggesting Reflector, it doesn't even tell me that Jedox.Palo.Comm.dll uses the other two dll's. So I'm not certain of its efficacy.
And is there like a separate folder where those two dll's need to be put, since this is an asp.net webite, since I feel that if it worked as a C# Application, there is no reason not to work as a web app.
Also should I add any references to those other two dll's int the web.config file?
Thanks in advance!
Solved. Just added the two depended dll to the sysWOW64 folder. Nothing else worked!
When running .net site, enable 32 bit Application in the IIS app pool configuration. Palo requires 32 bit.

Strange exception suddenly appears when trying to install a setup project, need help big time

Using Visual Studio 2010 to build a setup project that installs a Windows Forms application .Net 4.0 C#. It has worked fine for ages but now when I'm trying to install the finished setup file, I'm getting this error message:
Error 1001. Unable to get installed types in the "Path" assembly. -->
Unable to load one or more of the requested types. Retrieve the
LoaderExceptions property for more information.
I have been searching for answers for over 4 hours now without finding anything. This problem just came without me doing anything. Last time I build the install file was like 2 weeks ago and there was NO problem at all. I haven't deleted any reference or any code that have anything to do with the setup project.
How could this problem appear from nothing and more important, how do I fix it?
Based on the error message in your second comment, it appears that your SysDir.exe assembly has been added as a Custom Action with the InstallerClass property set to true, but either no installer classes could be found in the exe or the exe could not be loaded due to missing dependencies.
You can see the list of Custom Actions by right-clicking on the installer project, selecting View and then Custom Actions.
If your exe does not can an installer class, then you can remove it from the list of custom actions.
If it does contain an installer class, then the issue is going to be missing dependencies. If fuslogvw doesn't work for you (it has always helped resolve this kind of issue for us), you can carefully review the list of references in the exe's project and compare them to what is listed in the installer project.
The other trick that we use is to examine the install directory while the error message is displayed on the screen. We can often see that DLLs are missing by doing this, usually because the path was entered incorrectly in the DLL entry within the installer project or because a condition was set incorrectly.
Have the same error today. For me it was the project type of the class library.
I noticed that the pucture on the guide I was following had selected Class Library (.NET Framework) instead of just Class Library.
Creating the correct project type fixed the error.
https://nhvu1988.com/posts/how-to-create-msi-installer-using-vs-installer/

Categories

Resources