I have an asp.net website I have been working on in Visual Studio 2019, using .Net Framework 4.5.1. The code builds just fine but won't publish, giving me this error:
Error BC30002: Type 'DataTable' is not defined.
The publish is to a folder on my pc, and is in Release mode. I have 'Delete existing files' set to False, 'Precompile during publishing' set to true, and in the Precompile options I just have 'Do not merge' selected.
DataTable is defined in System.Data, and I am referencing version 4.0.0.0. The code throwing the error is in a class in the App_Code folder, which I know can cause issues - but i've published this code before without an error so I don't see why it wouldn't work.
I tried deleting the .vs folder and restarting Visual Studio, as well as starting VS as an administrator, but I still get the error. Does anyone have any suggestions how I can get the website to publish?