Montesuma80 / 3cx-web-API

an local API to Controll your 3CX v16/v18 over HTTP
77 stars 38 forks source link

.Net 6.0 compatibility #26

Open bk-lg opened 1 year ago

bk-lg commented 1 year ago

With the lastest v18u8 the .net version changed to .Net 6. I needed to add a return value in the update.cs for the catch case. After that it compiled and worked with the latest 3cx version. Build on 3cx Debian 10.

MSBuild version 17.3.2+561848881 for .NET Determining projects to restore... Restored /opt/3cx-web-api/WebAPICore.csproj (in 203 ms). /opt/3cx-web-api/update.cs(16,30): error CS0161: 'update.updateid(string, string)': not all code paths return a value [/opt/3cx-web-api/WebAPICore.csproj] /opt/3cx-web-api/getcallid.cs(29,38): warning CS0618: 'ActiveConnection.HistoryIDOfTheCall' is obsolete: 'V14. This ID is not stored in call history database. So this property should not be used to store references' [/opt/3cx-web-api/WebAPICore.csproj] Build FAILED. /opt/3cx-web-api/getcallid.cs(29,38): warning CS0618: 'ActiveConnection.HistoryIDOfTheCall' is obsolete: 'V14. This ID is not stored in call history database. So this property should not be used to store references' [/opt/3cx-web-api/WebAPICore.csproj] /opt/3cx-web-api/update.cs(16,30): error CS0161: 'update.updateid(string, string)': not all code paths return a value [/opt/3cx-web-api/WebAPICore.csproj] 1 Warning(s) 1 Error(s)

Time Elapsed 00:00:03.18

mountIT commented 1 year ago

With the lastest v18u8 the .net version changed to .Net 6. I needed to add a return value in the update.cs for the catch case. After that it compiled and worked with the latest 3cx version. Build on 3cx Debian 10.

MSBuild version 17.3.2+561848881 for .NET Determining projects to restore... Restored /opt/3cx-web-api/WebAPICore.csproj (in 203 ms). /opt/3cx-web-api/update.cs(16,30): error CS0161: 'update.updateid(string, string)': not all code paths return a value [/opt/3cx-web-api/WebAPICore.csproj] /opt/3cx-web-api/getcallid.cs(29,38): warning CS0618: 'ActiveConnection.HistoryIDOfTheCall' is obsolete: 'V14. This ID is not stored in call history database. So this property should not be used to store references' [/opt/3cx-web-api/WebAPICore.csproj] Build FAILED. /opt/3cx-web-api/getcallid.cs(29,38): warning CS0618: 'ActiveConnection.HistoryIDOfTheCall' is obsolete: 'V14. This ID is not stored in call history database. So this property should not be used to store references' [/opt/3cx-web-api/WebAPICore.csproj] /opt/3cx-web-api/update.cs(16,30): error CS0161: 'update.updateid(string, string)': not all code paths return a value [/opt/3cx-web-api/WebAPICore.csproj] 1 Warning(s) 1 Error(s)

Time Elapsed 00:00:03.18

What have you changed in the update.cs? I am having the same difficulties.

bk-lg commented 1 year ago

@mountIT I just added an empty return Statement in the Catch Block:

catch (Exception ex) { Console.WriteLine($"Update failed\n{ex}"); return (""); }