Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8721967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:18:33+00:00 2026-06-13T07:18:33+00:00

I have a program using WPF in C# that uses the .NET 4 Framework

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:18:35+00:00Added an answer on June 13, 2026 at 7:18 am

    As the error clearly hints, you need to add System.Windows.Forms.dll to ReferencedAssemblies.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a c# program using WPF. I have it that when you press
I have a client-server program that uses sockets to transfer information in a stateful
I have a program using odac(11.2) and oracle client 11.2. Now I want to
I have a program which reads an XML file using the DOM functions: $doc
I have a program that draws some vector graphics using System.Drawing and the Graphics
I have a program that uses a licence system for its users. Now I
I have a C# WPF program using AciveX objects and providing WCF service. So
I have a simple plugin architecture for my program that uses an interface to
The Situation I have a WPF program that I want to print several documents
I am designing (not programming) a data-series viewer program for medical data, using C#/WPF.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.