Home > Mobile >  .Net 6.0 Windows App Cant Reference System
.Net 6.0 Windows App Cant Reference System

Time:10-16

So the weirdness has hit. I created a new Visual Studio 2022 - fully patched, updated, and current.net 6.0 Windows Desktop app. It has 1 form that has a menu bar dragged from the toolbox on it and that is it. I have done nothing else to it! System, Form, void, object, EventArgs, and Application are all red and not available (see below)

using System;

namespace Developmeny_Test_Application
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {

        }

        private void e7xitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}

This is as basic as it gets and can I get Visual Studio to let it in?

Under Dependencies/COM it is showing an orange triangle (which I always thought meant depreciated but as this was created with the wizard templates that's not likely)

So my question is what am I missing? All the web searching I have done has revealed nothing of any use.

Any help is gratefully appreciated.

Added as an edit for more information

The section that has the triangle has this section in the project file :

<ItemGroup>
    <COMReference Include="{bee4bfec-6683-3e67-9167-3c0cbc68f40a}">
      <WrapperTool>tlbimp</WrapperTool>
      <VersionMinor>4</VersionMinor>
      <VersionMajor>2</VersionMajor>
      <Guid>bee4bfec-6683-3e67-9167-3c0cbc68f40a</Guid>
    </COMReference>
</ItemGroup>

CodePudding user response:

That COM-Reference is fishy. You should not need that. When I do the same (create a new Winforms project and add a "MenuStrip" to the form) I'm not getting that reference.

I'm assuming you accidentally added a component from a third-party library to your form, which caused this strange reference. Just delete that section from the project file and see what happens. If the error persists, please quote the exact error message you get.

  • Related