In my WPF project using .NET Framework 4.7.2 in VS2017, I'm trying to install Interop.MSUtil.dll NuGet package as suggested here. I do need this package installed, so could someone please help me installing it or providing a workaround.

Error:

Install-Package : Could not install package 'Interop.MSUtil.dll 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:1 + Install-Package Interop.MSUtil.dll -Version 1.0.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

2 Answers

0
Wildcat Matt On Best Solutions

It appears that the NuGet package for Interop.MSUtil.dll is not compatible with the .NET 4.7.2 Framework.

However, if you have LogParser installed on your machine and you have administrator access, you can recreate it locally.

  1. Locate your copy of LogParser. The most likely place is in C:\Program Files (x86)\Log Parser 2.2.

  2. Locate your Developer Command Prompt. In Windows 10, just type developer command prompt into the Windows search bar.

  3. Run it as Administrator. Generally this can be done by right-clicking on the Developer Command Prompt item for the context menu.

  4. cd to the location where LogParser is installed.

  5. Run the following command:

    tlbimp LogParser.dll /out:Interop.MSUtil.dll

This should build a new version of Interop.MSUtil.dll which will be friendly to your version of the Framework.

Now you can add it as a reference manually by browsing to the LogParser directory and selecting the new DLL.

Don't forget you may need to set Embed Interop Types to False.

Note that this draws heavily from this previous answer.

0
Ivan Ičin On

If Nuget package is not declared to be installed it can't be installed through the package manager.

However you can install a .dll file. First install it on the some project where it can be installed. Then in packages folder of the project find some .dll file that you find appropriate. Finally add it as the reference to the project. It may or may not work depending on the package itself but that is the only way if it has any chance to work.