I have a program using WPF in C# that uses the .NET 4 Framework (Not Client Profile), and it compiles a source file called "Source.txt". However, whenever it compiles it I get this error "Error CS02345: The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?)". No file is created.
When I checked the lines from the Source.txt file, these are the ones that are giving the error:
using System.Windows.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Forms;
using System.Management;
This is the code I'm using to compile it from the main program:
CompilerParameters Params = new CompilerParameters();
Params.GenerateExecutable = true;
Params.ReferencedAssemblies.Add("System.dll");
Params.OutputAssembly = ServerNameBox.Text;
Params.CompilerOptions = " /target:winexe";
string Source = compileSource;
CompilerResults Results = new CSharpCodeProvider().CompileAssemblyFromSource(Params, Source);
if (Results.Errors.Count > 0)
{
foreach (CompilerError err in Results.Errors)
System.Windows.Forms.MessageBox.Show(err.ToString());
}
else System.Windows.Forms.MessageBox.Show("Sucessfully Compiled Program!");
As indicated in the code, I want this program to be compiled as a Windows Form / GUI Application (" /target:winexe");
If this information is not sufficient, please ask.