1
votes

Visual studio 2017 by default reads the tnsnames.ora file from the installation path of the oracle developer tools for vs2017.

There is an option to search and then copy and replace the tns file in above default location with a different ora file in the machine. However the problem with this is, multiple tns files needs to be maintained in this case(because other oracle software reads the tns file from oracle client installation path).

VS 2017 Search and copy tnsnames.ora file window

Instead, is there a way to change the default tnsnames.ora path read by VS2017? (TNS_ADMIN and Path environment variables are already configured.)

2
You should have only one tnsnames.ora file. If you have different applications which try to read from different locations the work with symbolic links.Wernfried Domscheit

2 Answers

0
votes

I don't understand your problem. Simply delete the tnsnames.ora file from c:\Program Files (x86)\Oracle Developer Tools for VS2017\network\admin (just guessing the folder name) then VS will take it from location you specified in "other locations".

Or

  1. Open a command line window
  2. Navigate to c:\Program Files (x86)\Oracle Developer Tools for VS2017\network
  3. Delete folder admin
  4. Create a symbolic link with mklink /d "c:\Program Files (x86)\Oracle Developer Tools for VS2017\network\admin" "c:\app\client\...\product\12.2.0\client_1\network\admin"
0
votes

I found that I had an issue with this step of Visual Studio 2017, it was trying to store it's tnsnames.ora in a directory that didn't exist, so I hunted and discovered that you can alter this via machine.config.

You'll want to open up RegEdit first and get the version number for the driver you are using (managed or unmanaged), you can do this by browsing under the oracle directory:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ODP.NET.Managed\4.122.1.0

my version was 4.122.1.0, I then placed this in the following:

<oracle.manageddataaccess.client>
    <version number="4.122.1.0">
      <settings>
        <setting name="TNS_ADMIN"value="C:\app\client\612851311\product\12.2.0\client_1\Network\Admin" />
      </settings>
    </version>
   </oracle.manageddataaccess.client>

You will need to add this to your machine.config in the .net framework version you are using, for me it was:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config

I hope this helps, yes you may want to use a symbolic links as suggested, as that you don't need duplicate files, or you may just want to change this to the directory you need.

restart your machine and you should be good.