bring in dependency in live script c# compiler - c#

I am trying to create a form in C#.
Unfortunately, I can not use Visual Studio for this effort.
The program I am using has a live script c# compiler that allow user to write and compile code within the program. I am trying to use
using System.Windows.Forms;
but I get the following error
The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
Is there a way to reference System.Windows.Forms with out visual studio?
I tried this on a online compiler and got similar results so maybe there is a correlation?

Related

Package could not be found

I'm trying-out C# and .NET 5 for the first time, but I'm having trouble importing packages.
First of all I'm using VCode as my IDE and installed C# Extension (and enabled: Omnisharp: Enable Import Completion).
When I write a function using for example List, I don't get a recommendation to import:
using System.Collections.Generic;
It also doesn't recognize other classes in my project. Even when I import manually for example:
using WebApp.Model.Item;
I get an error like this:
The type or namespace name 'Item' could not be found (are you missing a using directive or an assembly reference?) C:\Users\ljhha\Documents\IT\C\WebApp\WebApp\WebApp.csproj
I also trying the same in Visual Code and get the same error.
I Build, Rebuild used Debugging, re-open the IDA. So I'm out of options?
Please check the full code here on github

Can't add popular namespaces references to C# .DLL Class Library

My question in simple few lines:
I'm trying to build a compiled .dll C# Class Library that contains functions I want to easily call from other non-C# applications.
My functions depend on popular namespaces' Assemblies references like System.Windows.Forms and Microsoft.Office.Interop.OneNote.
When I try to add any of them to my class library, I get does not exist in the namespace error.
Also, they don't exist in Reference Manager (Screenshot 2).
Continued description:
Within normal C# application (that's compiled to .exe), I can easily include those Assemblies references using code lines like below:
using System.Windows.Forms; // works good in normal application
using Microsoft.Office.Interop.OneNote;
Also I am able to add References with References Manager (by right clicking the References node on Solution Explorer → then Select Add Reference → then search for the references I want to add) — in Visual Studio 2019 (Screenshot 1). I can find and add assemblies like System.Windows.Forms and Microsoft.Office.Interop.OneNote easily.
But within a C# Class Library (that's compiled to .dll), when I try to include System.Windows.Forms and Microsoft.Office.Interop.OneNote using the below lines:
using System.Windows.Forms; // gives errors in C# Class Library
using Microsoft.Office.Interop.OneNote;
I get errors:
CS0234 The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) MyLibrary C:\Path\to\MyLibrary\Class1.cs
CS0234The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) OneNoteLibrary C:\Path\to\MyLibrary\Class1.cs 15 Active
Also, these assemblies aren't shown at all when I try to add using References Manager (Screenshot 2).
Screenshot 1:
Screenshot 2:
Screenshot 3:

NSUrl is not recognized by Foundation namespace

I am building in Visual Studio an iOS Binding Library. Objective Sharpie generated a code in ApiDefinition.cs. I am using directive namespace "Foundation" but clicking F12 at "Foundation" is not redirecting me to namespace definition. The "NSURL" type is not recognized. Other classes like "NSString" etc. are recognized well. There is an error:
CS0246 C# The type or namespace name 'NSURL' could not be found (are you missing a using directive or an assembly reference?)
What should I do to make 'NSUrl' recognized?
The compiler will prompt a large number of errors . Such as
You have to do something. For example, use the ulong/long instead of nuint ,and annotate the code such as [Verify(MethodToProperty)] .In addition,there are some differences between iOS and Xamarin.iOS in name of Object.For example ,NSURL in OC and NSUrl in C#.You need to manually modify it.

Visual C# Error: The type or namespace name 'Compression' does not exist in the namespace 'System.IO'

I am trying to compile a tile map editor so I can use it to work on a game, but I am getting the error "The type or namespace name 'Compression' does not exist in the namespace 'System.IO'" when I try to build in Visual C#. Does anyone know how I can fix this? I tried google but I found nothing.
You probably don't have a reference to System.dll, or you're using a version of .NET before version 2.0.

Missing directive or assembly reference using WMI ManagementObjectSearcher?

I have found this link:
Detect Antivirus on Windows using C#
However when I try this code in visual c# express edition 2008 it says :
Error 1 The type or namespace name 'ManagementObjectSearcher' could not be found
(are you missing a using directive or an assembly reference?)
C:\Users\Andy\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 15 17 ConsoleApplication1
Amongst other similar errors on the 2 lines which seem important!
Looks like the code segment is missing some imports or something?
I am using Windows 7... Please help!
Andy
You are missing a reference to the assembly containing the type ManagementObjectSearcher, which is in the System.Managementnamespace. Add this namespace and it should work.
You will have to rightclick the project -> add reference and add the System.Management assembly. System.Managment is not added automatically with the creation of a new project.
WMI reference
WMI + C#

Categories

Resources