Quantcast
Viewing latest article 11
Browse Latest Browse All 20

Reminder to self: app.config and “ORA-12154: TNS:could not resolve the connect identifier specified”

When you have one app.config for your whole set of DTAP environments (develop/test/acceptance production), every once in a while you get this error:

ORA-12154: TNS:could not resolve the connect identifier specified

For this particular setup, it means the replacement of parameters in the app.config with actual values from the DTAP went wrong (or was missing). For that we’ve some steps in both the PreBuildEvent and PostBuildEvent of the .csproj file:

PreBuildEvent:

del "$(ProjectDir)$(TargetFileName).config"
copy "$(ProjectDir)app.config" "$(ProjectDir)$(TargetFileName).config"

PostBuildEvent:

powershell -noprofile -file Replace-Parameter.ps1 -Path "$(TargetDir)$(TargetFileName).config"

The PreBuildEvent looks like it is not needed, but sometimes Visual Studio forgets to perform the copy action.

–jeroen


Filed under: .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET ORM, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Database Development, Development, NHibernate, OracleDB, Software Development Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 11
Browse Latest Browse All 20

Trending Articles