Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot modify an evaluated object originating in an imported file

I am trying to delete a file from my visual studio project, but this dialogue pops up and prevent me from doing that. What does it mean and how do I resolve this problem?

There is a xamarin thread about this but no solution there.

https://forums.xamarin.com/discussion/25719/cannot-modify-an-evaluated-object-originating-in-an-imported-file

enter image description here

like image 344
Yuchen Avatar asked Mar 07 '16 22:03

Yuchen


2 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>
like image 171
kayleeFrye_onDeck Avatar answered Oct 21 '22 01:10

kayleeFrye_onDeck


Restarting Visual Studio fixed the issue for me.

like image 45
Eternal21 Avatar answered Oct 21 '22 03:10

Eternal21