Tod
Tod

Reputation: 2524

VS dll reference error - Instance object was created as immutable

If you try to add a NetStandard library dll to a .net core application Visual Studio throws the error:

instance object was created as immutable

And refuses to add the reference.

Upvotes: 6

Views: 4242

Answers (2)

user19370793
user19370793

Reputation: 41

I had this issue when trying to add a reference to the TwinCat.ADS library. My issue turned out to be the opposite of yours. I had added the package using NuGet. NuGet didn't install the package correctly but was preventing me from adding the reference to the dependencies separately. I had to remove the package from NuGet before I could add the library to the references.

Upvotes: 4

Tod
Tod

Reputation: 2524

I thought I would share this as nothing much turns up in a search. You need to add a reference to the NetStandard.Library NuGet Package, before you can add a .netstandard library.

https://www.nuget.org/packages/NETStandard.Library

Then add references to the DLL.

As a side note, I never had any issues adding a project reference to a netstandard 2.0 project, but to its output dll - I did.

Upvotes: 13

Related Questions