Cannot modify an evaluated object originating in an imported file

Viewed 10588
5 Answers

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>

In my solution happend because there was NuGet packages source pointing to non-existent local folder, changed it in Package Manager Settings.

My workaround was to open the .vcxitems and .vcxitems.filters, mentioned in the error message, in text editor and delete the file directly in the xml. Also I want to note that this error appears for me only when I tried to delete files that were part of different .vcxitems that was imported into main project. You can check your main project for <Import Project="xyz.vcxitems" />.

Related