# FIX6 – `ihas.properties` next to `IMSApiDotNet.dll`

FIX6 extends FIX5 without changing the public legacy ABI.

## Property precedence

The shared `IMSApiDotNetBase` implementation (therefore both `net48` and `netstandard2.0`) resolves a property in this order:

1. `IMSApiDotNet.setProperty(key, value)` / `IMSApiDotNetBase.setProperty(key, value)`
2. `ihas.properties`
3. fallback/default value used by the caller

## Required file location

`ihas.properties` must be placed in the **same directory as the actually loaded `IMSApiDotNet.dll`**.

Example deployment:

```text
MyApplication\
|-- MyApplication.exe
|-- IMSApiDotNet.dll
`-- ihas.properties
```

For example:

```properties
itac.artes.clusternodes=https://partner.itacsoftware.com:8181/mes
```

The DLL determines its own location through `typeof(IMSApiDotNetBase).Assembly.Location` and loads:

```text
<Path of loaded IMSApiDotNet.dll>\ihas.properties
```

The current working directory is **not** used for normal lookup. `itac.propdir` remains an accepted legacy property but no longer redirects the physical `ihas.properties` file location. This prevents a service, console application, IIS host, scheduler, or other host process from accidentally loading a different file because its working directory differs from the DLL directory.

If `Assembly.Location` is unavailable in a special hosting scenario, `AppContext.BaseDirectory` is used as the runtime fallback.

## File syntax

- Empty lines are ignored.
- Lines beginning with `#` are ignored.
- Values use `key=value` syntax.
- Key and value are trimmed.

Example:

```properties
itac.appid=MyApplication
itac.artes.clusternodes=https://partner.itacsoftware.com:8181/mes
itac.artes.connection.timeout=30000
itac.artes.ihas.failover=true
```

Programmatic values still override the file:

```csharp
IMSApiDotNet.setProperty("itac.appid", "RuntimeOverride");
var api = IMSApiDotNet.loadLibrary();
api.imsapiInit();
```

## Verification

Run:

```powershell
.\scripts\check-ihas-properties.ps1
.\scripts\check-legacy-binary-compat.ps1
```

The property test deliberately changes the process working directory and sets `itac.propdir` to a different directory containing a conflicting file. The test succeeds only when the file next to the loaded `IMSApiDotNet.dll` is used. The legacy binary compatibility test remains unchanged.
