I have a C# Excel VSTO addin which runs properly launched from VS, but fails to work when published with ClickOnce.
MSAL.Desktop.4.62.0.0.MsalClientException wam_runtime_init_failed Microsoft.Identity.Client.MsalClientException: Unable to load DLL 'msalruntime': The specified module could not be found. at Microsoft.Identity.Client.NativeInterop.API.x64.MSALRUNTIME......
I have a reference to Microsoft.Identity.Client.NativeInterop in the project, in the solution.dll.manifest, I have the following
<file name="runtimes\win-x64\native\msalruntime.dll" size="2872888"`
And in the corresponding (\runtimes\win-x64\native), I do have a msalruntime.dll.deploy file.
I also checked the Release and Publish folders to see if there were any missing files, and all the .dll seem to have their corresponding .dll.deploy.
Edit: further investigations:
- reference to Microsoft.Identity.Client.NativeInterop was an attempt to make sure the .dll was properly included. However, after removing the reference:
- I still have the msalruntime.dll in the same folder, as it's a dependency for the SDK to which I'm connecting
- The .dll is not included anymore in the published app
So it looks like it's a problem of ClickOnce not realizing it needs to include a dependency from a project dependency.
How can I force that inclusion?