CS0234 error with System.Linq namespace in ASP.NET

2019-06-03 23:35发布

问题:

At my company, we have tiered environment for our web applications (development, staging, production). I made a bunch of changes to one of my applications and deployed them to the development environment (Windows 2003 w/ IIS 6.0). I also had to make an immediate change to one of the user control files that needs to fix issue with the current production application.

I just deployed the one file to the staging environment (Windows 2003 w/ IIS 6.0), which is an exact copy of production on got the following ASP.NET 2.0 compilation error.

Exception type: HttpCompileException Exception message: d:\inetpub\myapp\BaseControl.cs(3): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

I copied the original file from production (Windows 2003 w/ IIS 6.0) back down to staging and got the same error. I also recycled and restarted the application pool. I still get the same result.

Has everyone experienced this issue and know how to resolve it?

UPDATE:

The .NET 3.5 framework is installed on the development and staging server. Each environment is hosted on the same server. The development environment is working just fine.

回答1:

My web.config file was missing from my staging environment. I copied the web.config from the production environment and everything is working...



回答2:

Make sure you have System.Core available, as this is where System.Linq lives. Do you have .NET 3.5 installed on the environment?



回答3:

you need .net 3.5 to use System.Linq or anything related to linq