I have a plugin written in C# for a web application. When it is called by the application, the plugin assembly cannot be compiled.
I have found the point of the problem, but IDNK how to solve it.
Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web;
using System.Linq;
namespace App.plugins
{
public class ThePlugin
{
public string ToHtml(){...}
}
}
When I omit using System.Linq;
the plugin is compiled successfully. I also checked the IIS for loaded assemblies and the System.Core
(containing System.Linq
) is in the list.
EDIT:
How:
CompilerResults cr = provider.CompileAssemblyFromSource(cp, SourceCode);
Obtained: error, that tells me in the System namespace name does not exist type or namespace Linq (Error No# CS0234)
FrameWork: .NET FrameWork 4.5
Any hints?
It was necessary to add System.Core.dll
to the list of DLLs as below
CompilerParameters cp = new CompilerParameters();
cp.ReferencedAssemblies.Add("System.Core.dll");
CompilerResults cr = provider.CompileAssemblyFromSource(cp, SourceCode);