Hi Team,
I'm having an issue where I'm unable to use any DLL's from my D365FO projects. I've added a reference to the DLL in my x++ project as described in the links below but the Visual Studio development environment does not appear to be aware of the reference and behaves as though it does not exist.
- IntelliSense does not provide suggestions that should be available from the assembly.
- The compiler displays build errors that indicate it is unaware of the reference:
'TestAPI' is not declared.
The qualifier 'TestAPI.Class1' is not valid for field 'helloWorld'
The qualifier 'TestAPI' is not valid for field 'Class1'
Links:
https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-tools/write-business-logic
https://www.schweda.net/blog_ax.php?bid=477&wdl=en
https://blog.monsieurwinner.com/2022/08/30/consume-api-from-dynamics-365-finance-and-operations/
My environment:
D365FO dev environment v10.0.29 deployed from LCS.
Visual Studio Professional 2019 Version 16.11.18
Microsoft .NET Framework Version 4.7.03190
My test class library:
Language: C#
Targeting: .Net framework 4.7
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestAPI
{
public class Class1
{
public string helloWorld()
{
return "Hello world!";
}
}
}
Other information:
The DLL exists under my \PackagesLocalDirectory\<MyModel>\bin\ directory: C:\AOSService\PackagesLocalDirectory\<MyModel>\bin\TestAPI.dll
The XML file exists in my \PackagesLocalDirectory\<MyModel>\<MyModel>\AxReference folder.
XML file contents:
<?xml version="1.0" encoding="utf-8"?>
<AxReference xmlns:i="">www.w3.org/.../XMLSchema-instance">
<Name>TestAPI</Name>
<AssemblyName>TestAPI</AssemblyName>
<AssemblyDisplayName>TestAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</AssemblyDisplayName>
<Version>1.0.0.0</Version>
</AxReference>
I've tried the following troubleshooting tests with no success:
- Building the DLL with different target frameworks including 4.5, 4.7, .Net 5, netstandard2.0
- Adding the assembly to the GAC
- Referencing the DLL as a prebuilt DLL
- Referencing the DLL as a C# project in the same solution
Hoping that someone can tell me what I'm doing wrong and what I need to do to get it working as it should. Please let me know if you need any additional info or want me to perform additional troubleshooting.
Thanks,
Stuart