I have an issue with my project within Visual Studio that whenever I attempt to reference the Microsoft Visual Basic dll, none of the commands are showing or working within the project.
I've used the dll in projects before and I can't understand why it's not working in this one. I've referenced the dll using using Microsoft.VisualBasic; but whenever I want to use the Interaction.InputBox("Not Working"); command it's not showing or just gives me the error "The name 'Interaction' does not exist in the current context".
Am I being an idiot and missing something here or is there something else that is causing it to not work?
Any help?
You also need to add a reference to Microsoft.VisualBasic.dll:
https://support.microsoft.com/en-us/kb/325961
In a Visual C# application, click the Project menu, and then click Add Reference.
In the Component Name list, click Microsoft Visual Basic .NET Runtime to add Microsoft.VisualBasic.dll.
You can now use members of the Visual Basic .NET run-time library in Visual C#
In a Visual C# application, click the Project menu, and then click Add Reference.
In the Component Name list, click Microsoft Visual Basic .NET Runtime to add Microsoft.VisualBasic.dll.
You can now use members of the Visual Basic .NET run-time library in Visual C#
it works 4/03/2021
Related
I'm trying to create a WPF application using FolderBrowserDialog and I know I need to add a reference to System.Windows.Forms. The only problem being is that there are no sources anywhere on how to do that in Visual Studio 2019.
The main differences are in my Solution explorer the place to reference is called Dependencies whereas on every single person's VS it's called references? What's up with that? And when I try to add references to the window for it I don't have the assembly tab, here's what I mean:
This is what it's supposed to look like:
,
and this is what I sadly have:
I'm very surprised that this is how it is, is there any reason that this is like this?
I previously asked a similar question regarding Visual Studio 2013 but now I'm running into the same problem with Visual Studio 2015 but it seems to work differently, which makes the previous answer not applicable to this question. This is my previous question: Visual Studio 2013 - How to debug a project within a solution
I'm attempting to add a project reference. I have a library I'm working on in a separate solution/project and a console application I want to use to test and debug the library.
I tried: Add Reference > Projects > Solution > Browse
But the open file dialog does not contain .sln files in the filter list and if I force it to display them by typing *.sln and then select the Solution I get:
"Please make sure the file is accessible and that it is a valid assembly or COM component."
What am I doing wrong? How do I properly add a Solution/Project reference?
For me issue was due to difference in Target framework. One was .NET Framework 4.5 and other was .NET Framework 4.5.2
Verify if the Target framework is same for your project and the project reference that you are trying add reference.
(Right click on project -> properties -> Application Tab(Target frame work))
Right click on your solution file in Solution Explorer window, click Add and select Existing Project...
Once the project is a part of the solution, you will be able to add project reference.
In case anyone else runs into this here is something that I found. I had almost the exact same issue in VS 2015. I created a console app and then a class library project but could not add a reference to the class library.
It turns out I didn't create a class library project as I had thought, but rather a class library (package) project. These are different things and I was unaware of what the (package) part meant when I selected it. This is for creating Nuget packages, apparently.
I'm not sure if this is something new to VS 2015 but I had not run across it before and it caused me some grief. The error message ('A reference to ClassLibrary1 could not be added') was totally worthless in trying to debug it.
You should add project to your solution first; after adding project to your solution, you can reference it.
To add an existing project to your solution:
Add reference menu:
Add references dialog:
In order to add a project reference, the project has to be part of the solution.
For me issue was due to a difference in the types of projects. One was a C# Windows forms project and the other project was a C# Universal Windows project.
The Windows Forms project couldn't reference the Universal Windows project. The error was "Unable to add a reference to project "XYZ".
It appears you can have a library shared between both types of projects by folloing this answer: What kind of class library works with both Universal and Winform projects?
I ended up having a different solution. I had three projects in the solution which referenced a NuGet package which was no longer available. I had the library locally but I was unable to add it. I found that because of the BUILD ORDER and DEPENDENCY of my projects, I had to add it to the project that was built first, then I could add it to the projects that were dependent on that project.
I had this problem today and I looked at the configuration manager for the solution. The projects had different platform settings. I made them both Any CPU and rebuilt. Then I could reference the project.
I have looked everywhere and cannot find a solution. My problem has the following elements:
I have a Visual Studio Solution (Visual Studio 2013) with several projects.
One project ("Control Project") has several user controls I built.
Other projects ("Other Control Projects") contain various open source controls.
Another project (the "Problem Project") references the Control Project and the Other Control Projects.
The Visual Designer toolbox shows the Other Control Project controls perfectly in my Problem Project.
The Visual Designer fails to show the Control Project controls in my Problem Project.
I have tried:
1. Making sure the option to auto-populate the toolbox is checked.
2. Rebuilding the solution
3. Resetting the toolbox
4. Ensuring the access modifiers for the controls are Public.
If I "Choose Items", I can add the Control Project controls to the Problem Project by selected the .exe but this seems like a hack and also has caused other problems that are difficult to define.
Anybody have any clues on what may be wrong with either my Problem Project or my Control Project?
That answer might be a bit late but I recently had the same Problem.
For me it was a Problem with missing DLLs.
I have a nearly simular Soloution like you.
A Library providing selfmade UserControls
Another project ("Problem Project") that references the Control Library
The problem occurred when I recently switched from VS2008 to VS2013 and from .NET Framework 3.5 to .NET Framework 4.5. The cause of the Problem for me seems to be with Crystal Reports references. In my Library project I have a Class that inherits from CrystalDecisions.CrystalReports.Engine.ReportClass. This Class I provide as a control in the Toolbox. When I open the Library Project itself (not as a Subproject) and open a Form to load the Toolbox I got the following Error: Failed to create ToolboxItem of type: CrystalDecisions.VSDesigner.ReportToolboxItem, CrystalDecsions.VSDesigner.
After I knew this I found out, that I have to copy some Librarys, in my case
CrystalDecisions.CrystalReports.Engine.dll
CrystalDecisions.Shared.dll
CrystalDecisions.VSDesigner
to C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE (found it here:Can't add project controls to the Visual Studio Toolbox)
To me it seems like VS Toolbox starts to create the Controls and gets an Error at one of them and stops to fill the Toolbox. In my case the problem might be, that I reference old CR Librarys (v12.x) which work with CLR 2.0 and .NET Framework 2.0 - 3.5 and I compile my project with .NET Framework 4.5 which works with CLR 4.0. It looks like the old Librarys are not supported in .NET 4.x. If I use this Workaround the Toolbox works fine for me.
Greetings
btw. sorry for the patchy english ;-)
I am making a C# Web Form application and I want to use RedditSharp. https://github.com/SirCmpwn/RedditSharp
I've never used an API in C#, this would be my first time using something outside of the C# generics. Could someone help me understand how to import it to use it?
Create C# Web Forms project in Visual Studio
Download RedditSharp code from Github
Compile RedditSharp into DLL (build enclosed solution, grab DLL from the bin/release folder or wherever it builds to)
Add a reference from your project to RedditSharp DLL
Check examples at https://github.com/SirCmpwn/RedditSharp, add something like that to your code
Don't forget to add "using RedditSharp;" to the top of your code file.
Easiest thing to do in Visual Studio is to install the nuget package. Go to Tools...Nuget Package manager... Manage Packages for Solution. Search for RedditSharp, click install.
Now you can reference it from anywhere in your project by adding:
using RedditSharp;
This has the added benefit of Visual Studio alerting you to new updates anytime the official RedditSharp project is updated.
I am using Visual Studio 2012 and .NET 4.5 and the new WebAPI project type. However, I am unable to add a reference to my class library project to the WebAPI project. Does this need to be a "portable class library" project or can it be a regular one? There's no error, it just doesn't get added!
Alrighty so in Visual Studio 2012 there's a check box next to each reference you want to add, in the add references menu.
It's very non-intuitive. We've gone away from selecting things by highlighting and have moved to check boxes.