English

Error: The extension cannot set the "ComVisible" attribute. Error: The property could not be read/written because the language service returned an unknown error.

Error Message

Building new ArcObjects SDK for .NET version 10.8 Projects from application project templates causes an error.

This error only occurs with Visual Studio 2019 when a new project is created from within a running Visual Studio instance using one of the ArcObjects Class Library Project Templates.  After selecting references to be included from the Project template wizard, Visual Studio 2019 displays the following error message:

“The extension cannot set the "ComVisible" attribute.
Error: The property could not be read/written because the language service returned an unknown error.”

Cause

All Class Library Project Templates use a Visual Studio project template wizard with code-behind to modify properties and code snippets of any newly created project.  This works fine after Visual Studio is newly started, but fails when creating a new project from within a running instance of Visual Studio.  The cause of the problem is that Visual Studio 2019 is passing a bad (or corrupt) EnvDTE.Project object to one of the project template’s call back functions.  When trying to use the EnvDTE.Project parameter, the error is thrown.

Solution or Workaround

To successfully create a new project using a Class Library Project Template, restart Visual Studio 2019 and create a new project at startup.