'The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) error in cshtml file

I know that my question was already put, but none of the solutions provided couldn't help me. I have a project similar with this one. In line 1 of Viewer.cshtml file from Views->Home folder I'm getting the error The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?).

Viewer.cshtml code:

<style>
    .custom-image-item {
        background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjYgMjYiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDI2IDI2OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj4uc3Qwe2ZpbGw6IzNEM0QzRDt9PC9zdHlsZT48Zz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMjUsN2MwLTAuMi0wLjEtMC42LTAuMy0wLjdDMjQuNiw2LjEsMjQuNCw2LDI0LjIsNkgxNnY1LjdsMS45LDEuN0wyNSw3eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xLDIybDE0LDNWMUwxLDRWMjJ6IE04LDEwYzEuNywwLDMsMS44LDMsNGMwLDIuMi0xLjMsNC0zLDRzLTMtMS44LTMtNEM1LDExLjgsNi4zLDEwLDgsMTB6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTE4LDE1bC0yLTJsMCw4bDguMiwwYzAuMiwwLDAuNC0wLjEsMC42LTAuM2MwLjItMC4yLDAuMi0wLjQsMC4yLTAuNkwyNSw5TDE4LDE1TDE4LDE1eiIvPjxlbGxpcHNlIGNsYXNzPSJzdDAiIGN4PSI4IiBjeT0iMTQiIHJ4PSIyIiByeT0iMyIvPjwvZz48L3N2Zz4NCg==);
        background-repeat: no-repeat;
    }
</style>
<script>
    function CustomizeMenuActions(s, e) {
        var itemDisabled = ko.observable(true);
        s.Init.AddHandler(function (s) {
            var exportDisabled = s.GetReportPreview().exportDisabled;
            exportDisabled.subscribe(function (newValue) { itemDisabled(newValue); });
            itemDisabled(exportDisabled());
        });
        var sendViaEmailItem = {
            id: 'someCustomId',
            imageClassName: 'custom-image-item',
            text: 'Send via Email',
            visible: true,
            disabled: itemDisabled,
            clickAction: function () {
                s.PerformCustomDocumentOperation('[email protected]');
            }
        };
        e.Actions.push(sendViaEmailItem);
    }
</script>
@Html.DevExpress().WebDocumentViewer(settings =>
{
    settings.Name = "WebDocumentViewer1";
    settings.ClientSideEvents.CustomizeMenuActions = "CustomizeMenuActions";
}).Bind(new XtraReport1()).GetHtml()

I have added in Views\Web.config this

  <compilation debug="false">
    <assemblies>
      <add assembly="System.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      <add assembly="System.Xml.Linq, Version=4.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      <add assembly="System.Web.Extensions.Design, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    </assemblies>
  </compilation>

but with no success. I also have added System.Data.Linq, System.Xml.linq references but it didn't solve the error. What should I do to get rid of this error? Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source