# Trying to use SwiPlCs in C# app

**URL:** <https://swi-prolog.discourse.group/t/trying-to-use-swiplcs-in-c-app/6712>\
**Category:** PlDoc\
**Tags:** how-to\
**Created:** [July 16, 2023, 9:25pm UTC](https://swi-prolog.discourse.group/t/trying-to-use-swiplcs-in-c-app/6712 "2023-07-16T21:25:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Relvox](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/relvox/32/5611_2.png) [@Relvox](https://swi-prolog.discourse.group/u/Relvox)\
**Post date:** [July 16, 2023, 9:25pm UTC](https://swi-prolog.discourse.group/t/trying-to-use-swiplcs-in-c-app/6712/1 "2023-07-16T21:25:25Z")

</div>

Hello there!

I’m trying to include `SwiPlCs` in my `net7.0` project.

When I put this in my `.csproj`

```xml
<Reference Include="SwiPlCs">
    <HintPath>lib\SwiPlCs.dll</HintPath>
</Reference>

```

I get:

```prolog
Unhandled exception. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at System.Runtime.InteropServices.Marshal.WriteInt64(IntPtr ptr, Int32 ofs, Int64 val)
   at SbsSW.SwiPlCs.libpl.SetStreamFunction(PlStreamType streamType, StreamsFunction functionType, Delegate function)
   at SbsSW.SwiPlCs.PlEngine.SetStreamFunctionWrite(PlStreamType streamType, DelegateStreamWriteFunction function)
   at SbsSW.SwiPlCs.PlEngine.Initialize(String[] argv)
   at Program.<Main>$(String[] args) in \path\to\Program.cs:line 42

```

if I try this:

```xml
<Reference Include="SwiPlCs64">
  <HintPath>lib\SwiPlCs64.dll</HintPath>
</Reference>

```

I get this:

```prolog
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'SwiPlCs, Version=1.1.60601.0, Culture=neutral, PublicKeyToken=03ea137181587c56'. The system cannot find the file 
specified.
File name: 'SwiPlCs, Version=1.1.60601.0, Culture=neutral, PublicKeyToken=03ea137181587c56'
   at Program.<Main>$(String[] args)

```

Is there any reason this shouldn’t work? Suggestions would be much appreciated!
