Cannot modify an evaluated object originating in an imported file
Restarting Visual Studio fixed the issue for me.
I ran across this question as well as a couple others related to the error message, specifically. My issue was different from the OP's as it had to do with NuGet packages not installing/uninstalling/updating.
I opened the .CSProj
files only to see the package reference completely missing for Microsoft.NET.Test.Sdk
, ie some VS file somewhere was caching this bad reference, even after killing all existing .vs
directories. So I just added it manually, ran nuget restore
, and was back in business.
Basically, I modified this block of project file XML:
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.4.0</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.4.0</Version>
</PackageReference>
</ItemGroup>
to this:
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.8</Version>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.4.0</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.4.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>16.1.1</Version>
</PackageReference>
</ItemGroup>