DLL Reference issue with C++ (CLR support) - visual-studio

I am using one of the DLL file which is provided by Lync Client 2013 SDK (Microsoft.Lync.Model.dll -- version 15.0.4454.1509) in C++ code (with /CLR support). But during building the project it is not giving me any errors relevant to the code of Lync SDK class. But at run-time it is throwing me an error message:
(An unhandled exception of type 'System.IO.FileNotFoundException' occurred in scanuser.exe Additional information: Could not load file or assembly 'Microsoft.Lync.Model, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.)
//DLL I want to use
#using <Microsoft.Lync.Model.dll>
//namespace provided that DLL
using namespace Microsoft::Lync::Model;
//Function which is using that DLL
void getusername()
{
LyncClient ^lyncClient;
String ^text=lyncClient->Self->Contact->GetContactInformation(ContactInformationType::DisplayName)->ToString();
Console::WriteLine(text);
}
I also added "Additional #using Directories" in which that DLL file is present that is:
"C:\Program Files\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop"
This DLL is working fine in sample applications which is written in C#. So I guess there is no problem with the sub-version of DLL
Visual Studio 2012 Ultimate,Windows 7 Ultimate 32 bit,Lync Client SDK 2013
So any ideas what's going on?

Related

DTS.runtime.Application Error With Visual Studio 2019

Visual Studio 2019 Enterprise v16.11.15 SS Integration services 3.16
I try to Load my DTSX Package as File with Framework C# class. I add
reference to Microsoft.SqlServer.Dts.Runtime to my project with browse
dll within : C:\Program Files (x86)\Microsoft Visual
Studio\2019\Enterprise\Common7\IDE\PublicAssemblies\SSIS\150 When
running reach the instruction :
Microsoft.SqlServer.Dts.Runtime.Application a = new
Microsoft.SqlServer.Dts.Runtime.Application(); I get the following
output Error : System.IO.FileNotFoundException: 'Could not load file
or assembly 'Microsoft.SqlServer.DTSRuntimeWrap, Version=15.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its
dependencies. The specified file can not be found.'
the same Script.Main is working perfect when i downgrade the DTS.Runtime reference to the ManagedDTS version 14 or older. The problem that the TargetServerVersion of SQL Server 2019 is only able in Version 15.
If someone has a solution i would be grateful.
Finally i find solution to workaround this bug ; i have changed the visual studio project Template from Console App (.Net Framework ) to SSIS Project and then i put my code on Task Script Component. Naturally i add reference to new ManagedDTS dll for VS 2019 to my project .
Now solution is running well and i can call the function
App.SaveAndUpdateVersionToXml sucessfully to upgrade automatically all packages DTSX by Framework .Net Script.
I share with you this blog which very supported me to make solution.
https://blog.bartekr.net/2018/02/28/upgrading-ssis-projects-part-iii/
Thank you for you all

Can't find .NET assembly from SSRS 3.0 Reports

I'm developing some reports in SSRS 3.0, and I've hit a snag. I've got a .NET method that I need to call, and I can't get it to work. I've found a few "how to" websites that purportedly explain the process, but I can't seem to make it work. As a first experiment, to just prove I can do this, I've written a little "HelloWorld" program that just returns two strings concatenated together with a space between:
using System;
namespace HelloWorld
{
public class Hello
{
public static string SayHello(string hello, string world)
{
return hello + " " + world;
}
}
}
I've got the reference defined in the Report Properties / References tab; but when I try to run it, I get
Error while loading code module: ‘HelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'HelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I've copied the DLL to numerous suggested locations:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\Reporting Services\ReportServer\bin
The folder with the RDL file
Nothing seems to work.
I've seen reference to editing the rssrvpolicy.config file; but my system doesn't have one. I could create it, but I don't know where to put it.
I'm using Visual Studio 2010, Report Builder 3.0, and SQL Server CE (I have SQL Server installed on my dev machine as well; but it will not be on the target machines). We will not be using a Report Server -- the target machines are all standalone, and very few will have network access.
If there's any other information I can provide, please let me know. And thanks for any suggestions you may have.
Sounds to me like a mixed DLLs CPU architecture issue.
How do you compile your DLLs (x64, x84 , AnyCPU)?
Try to match the DLLs to correct CPU architecture of the server. then clean solution and compile it with as debug or release (that doesn't matter).
Make sure to clean all copies of previous DLLs , before copying the new ones. (just to be on the safe side)
Let me know if that works for you...

Missing System.Data.SQLite.dll reported after installation

The desktop software (.Net 4.0, compiled under Visual Studio 2010, target: x86) I'm developing is shipping with System.Data.SQLite (1.0.86 for x86, from system.data.sqlite.org*) for the first time.
On the development machine (And every other machine where the System.Data.SQLite-installer has run), everything works correctly.
On the testing machine however, after installation (a standard MSI setup created with the Visual Studio Installer) launching the application and showing the splash screen, before showing the GUI, the application creates an exception with the error:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.SQLite.dll' or one of its dependencies.
The mentioned file itself is found in the application directory (correct version), along with all the other referenced DLLs.
I assume this works on the development machines because of the setup option 'Install images'. I didn't install SQLite in the GAC. The application project is directly referencing the pre-build System.Data.SQLite.dll with local copy set to true.
Are there any dependencies I'm not seeing?
Or is it a missing Microsoft Visual C++ Runtime Library (Not present in the application directory)?
Or a missing SQLite.Interop.DLL (Not present in the application directory)?
How could I fix those?
= The installer I've used: http://system.data.sqlite.org/downloads/1.0.86.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.86.0.exe
Ensure that you have the latest Microsoft Visual C++ 2010 Redistributable Package installed.
http://www.microsoft.com/en-gb/download/details.aspx?id=5555
Why? The sqlite DLL has some unmanaged code embedded in it that is run directly from the assembly at runtime. This manifested for me as a bad image format exception but you never know!

I can't Add dll to References in Visual Studio 2010

I work on WinApp in Visual Studio 2010 (With C# Language)
I want to add one dll (not system dll) to Reference.
but when I open Add Reference Window And Browse dll see under error message:
Could not load file or assembly 'W2D_D2.dll' or one of its
dependencies. The module was expected to contain an assembly manifest.
this file may not be a managed assembly.
I even change the Target Platform from ".net framework 4 client profile" to ".net framework 4" but not difference.
How Can Add This dll To My Project?
Looks like this DLL is not a managed assembly. You can check this very quickly by trying to open it with ILSpy or Reflector.
If this is the case, you'll have to pinvoke or use com to use this dll.

Web Reference namespace not seen by Visual Studio 2010 compiler after 2.0 to 3.5 project conversion

I'm getting a build error in Visual Studio that's not making any sense:
The type or namespace name 'MyService' does not exist in the namespace 'My.Project' (are you missing an assembly reference?)
The namespace MyService is defined in a Web Reference. In the Object Browser, I can clearly see that namespace and all of the classes defined in it. There are no compile errors for any of the code in the Web Reference.
The code stopped compiling after I changed the framework target from 2.0 to 3.5. Why could the compiler be choking, and how can I go about fixing this? I already tried updating the web reference, but the problem remains. I even tried commenting out the code in the generated "Reference.cs" and copying the code to another code file in the project, and the namespace was still not seen.
My project is referencing the following:
System 2.0.0.0
System.Data 2.0.0.0
System.EnterpriseServices 2.0.0.0
System.Net 3.5.0.0
System.Web.Services 2.0.0.0
System.Xml 2.0.0.0
Update
It isn't just my web service generated code that is having compile problems; for all of the projects converted to .NET 3.5, I cannot reference their namespaces.
I'm still not sure why this is all happening, but I found a workaround; by adding a using Ns = My.Project.MyService to my code, I was able to reference types in the namespace with Ns.MyType.
This is apparently documented as a bug in Visual Studio:
https://connect.microsoft.com/VisualStudio/feedback/details/570557/targeting-net-framework-3-5-actually-targets-3-0-gac
I utilized the workaround documented in the post by copying System.Web.Extensions.dll from C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5 to C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0. Then I restarted Visual Studio.
That alone didn't fix the problem. I had to redo the project conversion from 2.0 to 3.5 after the assembly was copied. After the new conversion, the code compiled as expected. Doing a diff between the project file pre- and post-workaround didn't reveal any substantial differences, so the build errors must have been due to some internal state of Visual Studio.

Resources