Build error after upgrading MimeKit to .NET 4.7.2:

2019-08-20 20:11发布

问题:

First, this is not a duplicate of:

Build error while transitioning between branches: Your project is not referencing the ".NETFramework,Version=v4.7.2" framework

I downloaded MimeKit and opened it in VS2019. I attempted to update the project from .NET 4.5 to .NET 4.7.2. After doing this, it won't compile. I get the following error:

Your project does not reference ".NETFramework,Version=v4.7.2" framework.

After finding the SO post above, I was very hopeful, but it didn't work. I followed the steps described in the accepted answer. Specifically, I did the following:

  1. I deleted the bin/obj folders from the project root down.
  2. I cleaned the project. (multiple times)
  3. I rebuilt the project. (multiple times)
  4. I right-clicked on the solution in VS2019 and chose Restore Nuget Packages.
  5. I opened the .csproj file and looked for references to .json files but found none.
  6. I tried all of the above in VS2017 also.

I don't know what else to try. Thanks in advance for any advice.

回答1:

This is a horrible bug in VS2017 and VS2019 that I was never able to solve per se. My workaround was to add the NuGet package for MailKit and MimeKit to my custom solution and simply grab the DLLs I needed. I wish MS would fix this.