0

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?

7
  • You need to publish and then run the setup.exe file in the publish file. The publish updates the dll in the deployed machine to allow code to run. It may be the wrong version of the dll that is being deployed. Is project x32 or x64? The error message says x64. Commented Mar 4 at 17:54
  • Yes, I publish and run the setup.exe file. The project is x64, all the project build setting are set to x64 only (not any CPU, just x64), and indeed, there are no x32 folder in the bin folder. Commented Mar 4 at 18:07
  • What type of machine are you deploying code to? See following : chromewebstore.google.com/detail/clickonce-for-google-chro/… and support.google.com/chrome/a/thread/292584375/… Commented Mar 5 at 3:39
  • Windows 10. Nothing fancy there. Commented Mar 5 at 12:27
  • You are using Native Interop which is for Net 7 or later. What is your target for project? See learn.microsoft.com/en-us/dotnet/standard/native-interop/…. Error may have to do with Excel and the Version of Interop that you are using. Commented Mar 5 at 13:07

1 Answer 1

0

Solution: ClickOne fails to include dependencies that it's not aware of. Solution was to manually include the dll in the project, as indicated here: How to add native DLLs to ClickOnce deployment of .NET app

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.