Bonjour,

Lorsque j'ajoute un Windows Form à un projet (application console) j'ai l'erreur suivante :

Nom : Capture.PNG
Affichages : 96
Taille : 20,8 Ko

Et voici le code associé (Form1.Designer.cs):

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Windows.Forms;
using System.Drawing;
using System;
namespace Parsement_2
{
 
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Text = "Form1";
        }
 
        #endregion
    }
}
ComponentModel n'est pas connu malgré la présence de "using System" ( j'ai même rajouté le System.CompenentModel). Pourtant si je crée un projet Windows Form il n'y a aucun soucis.

Comment ajoute t'on correctement un Windows Form sur un projet console existant?

Edit : Problème réglé, je n'aurai pas du appeler une de mes classe System