简体   繁体   中英

gridview in aspx throws 'Color' is ambiguous in the namespace 'System.Drawing'

I have a project that has been running great for years. Just this week, it started throwing the error in the title.

It compiles just fine but throws it (captured in global.asax.Application_Error) when entering any form with a gridview. Here's an example:

<div class="div70pctColumnLeft">
<asp:GridView ID="gvInd" runat="server" DataSourceID="dsInd" DataKeyNames="id" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
BackColor="#CCCCFF" BorderColor="Blue" BorderWidth="2px" ShowFooter="True" Width="100%">
<Columns>
...

There are no other references to color anywhere in the grid and I've checked every reference to "Color" and have it only in System.Drawing.

The (single) project is .net 4.8.

I've tried recovering (from backup) the forms, the entire solution (including packages), updating all packages via nuget, repairing Visual Studio, etc. - 4 days worth with no progress.

Thanks in advance for any help you can provide.

I wanted to update the progress with these issues in case that might be of some value to others.

Ultimately, I found the only solution to the problem was to completely rebuild the entire solution by:

  1. Created a new, empty project
  2. Copied all forms/items/folders/etc. from the original project to the new one and did an Add | Existing
  3. Reload all packages via NuGet and update them, then
  4. Debugged like crazy (which I'm still in the process of)

To this point, it appears that one or more libraries were corrupted. Without a checksum (or equivalent) tool to verify them this it would be impossible to track down. Note also that I did reinstall Visual Studio, used sfc, etc., etc. as part of this journey – none of which helped.

Finally then, the solution was to completely rebuild using a new, fresh solution and project.

I hope this helps someone else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM