The type or namespace name 'Linq' does not exist in the ASP.NET# namespace 'System.Data' (are you missing an assembly reference?)...

After adding the .dbml (LINQ to SQL class file) file, when I double-click the .designer.cs source file, I find that the compiler prompts: The type or namespace name "Linq" does not exist in the namespace "System.Data" (whether the program is missing or not) set references?). But "System.Data.Linq" is clearly there in the "Reference" in the solution!

My solution:
modify the Web.config file: (<system.web> is in <configuration>)

<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
</system.web>

After modification, it may not take effect immediately, you can save it first, then close the solution, and then reopen it.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324124798&siteId=291194637