Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't System.Data.OracleClient available in .NET 4.0 Client Profile?

Tags:

c#

.net

So I'm working on a project which is built in the version visual studio 2005 under the framework 2.0. Now I moved the project to the new version of the visual studio 2010 sp1 under the version and start to realize they are throwing this errors and warnings with the dependencies, for example

Warning 1 could not be resolved because it has a dependency on "System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". 

Bring me the consequence that the application doesn't read the reference that I added, but changing the framework. .Net framework 4.0 the problem was solved. Testing I change them to .net framework 4.0 client profile and I realized the build errors and warnings appear again.

Now my question it's why setting .net 4.0 work and not with the client profile?? I need a good explanation because I'm not an expert in this part.

like image 282
Jorge Avatar asked Nov 14 '11 16:11

Jorge


3 Answers

The Client Profile only includes a subset of the whole .NET framework, a subset that should be sufficient to make desktop applications, while making it easier to redistribute .NET with your application.

As mentioned in a blog post introducing the Client Profile, the Oracle Client feature isn't included in the Client Profile. This is likely because Oracle Client is deprecated as of .NET 4 (the same release that introduces the Client Profile), and you should phase out using it altogether. (It's also arguably not really appropriate for inclusion in the Client Profile anyway.)

If you need to connect to Oracle from your application, you should either target the full .NET framework, or preferrably use a third-party driver library - presumably one developed by Oracle, not by Microsoft - that's going to stay up-to-date. (The InfoQ article about the deprecation lists several alternatives.)

like image 98
millimoose Avatar answered Sep 28 '22 06:09

millimoose


Go to the project property page and change the target framework to .NET Framework 4 then it should work! The client profile is for "small" application and doesn't install all assemblies.

like image 42
Fischermaen Avatar answered Sep 28 '22 07:09

Fischermaen


The .NET Client Profile is a subset of the full installation of .NET containing only "client" peices of the framework. The server functionality, like ASP.NET, is not present. The purpose of this is to reduce the size and requirements of the .NET Framework.

Or from MSDN:

The .NET Framework 4 Client Profile is a subset of the .NET Framework 4 that is optimized for client applications. It provides functionality for most client applications, including Windows Presentation Foundation (WPF), Windows Forms, Windows Communication Foundation (WCF), and ClickOnce features. This enables faster deployment and a smaller install package for applications that target the .NET Framework 4 Client Profile.

Now, the reason you cannot use the Client Profile is because the .NET Oracle Provider requires assemblies beyond what the Client Profile provides, thus your application cannot use the client profile.

like image 34
vcsjones Avatar answered Sep 28 '22 06:09

vcsjones