Visual Studio 2015 Isolated Shell application won't compile in Visual Studio 2022

Viewed 347

With the release of Visual Studio 2022, my team is trying to get switched over to using it instead of VS2019. Most of our solutions compile without any issues. However, we have one application that was developed using .NET 4.8 and the Visual Studio 2015 Shell (Isolated). This application will not compile succesfully. I get the following errors:

Error CS1747 Cannot embed interop types from assembly 'envdte80, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it is missing the 'System.Runtime.InteropServices.GuidAttribute' attribute.

Error CS1759 Cannot embed interop types from assembly 'envdte80, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it is missing either the 'System.Runtime.InteropServices.ImportedFromTypeLibAttribute' attribute or the 'System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute' attribute.

I have verified that the EnvDTE80 reference has the Embed Interop Types property set to False and Copy Local is set to True, just like it is when successfully compiling the solution using VS2019.

What has changed with VS2022 that would cause this error to occur?

Another thing I find strange is that the errors refer to version 17.0.0.0, but the EnvDTE80 NuGet package version is 8.0.3.

For the EnvDTE80.dll reference in VS2019...

  • The Path property points to C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\PublicAssemblies\EnvDTE80.dll. The version of the file in this folder is 8.0.50727.932
  • The HintPath property in .csproj points to the NuGet package folder ..\packages\EnvDTE80.8.0.3\lib\net10\EnvDTE80.dll. The version of the file in this folder is 8.0.50727.932

For the EnvDTE80.dll reference in VS2022...

  • The Path property points to the NuGet package folder ..\packages\EnvDTE80.8.0.3\lib\net10\EnvDTE80.dll. The version of the file in this folder is 8.0.50727.932
  • The HintPath property in .csproj also points to the NuGet package folder ..\packages\EnvDTE80.8.0.3\lib\net10\EnvDTE80.dll.
  • The EnvDTE80.dll file is found in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\PublicAssemblies\EnvDTE80.dll, but the file version is 17.0.31822.380.

Why is the error message referring to version 17.0.0.0 when the project references v8.0.3? Is this a 64-bit Visual Studio vs. 32-bit project issue? Is it a .targets file issue?

0 Answers
Related