VSCode c# autocomplete not working on an added package - c#

I am trying to build a library on top of and other library / framework.
I am doing this in C#, So at first i create a new project by doing
dotnet new console
Then i add the package which will serve as the basis for my library. I do this in the following way:
dotnet add package Veldrid
This works fine, i see it get added and it is visible in the .csproj
But then when i try to acces a function of a class or even create a new instance of a class from that package i see no autocomplete options what so ever :( But when i type my own class within the project its namespace autocomplete works all fine.
Why doesnt the autocomplete function work for added packages?
Extra information:
i am using a mac,
I have dotnet core 2.2.300 installed,
i am using vscode with the c# extension,
and in my project i have the using Veldrid added so i can use the package.
Let me know if something is unclear or extra information is needed!
side note:
I keep getting the message: Some projects have trouble loading. Please review the output for more details whenever i open a c# project in vscode.

after spending an age of googling and searching i found what was causing the problem for me.
I had unity installed which also installs the mono framework. (for me the mono framework caused all the problems). So i uninstalled unity and the removed the monoframework from my computer (mac) and all was well.
Hope this helps anyone in the future!
If there are better ways of going about this please let me know!

Related

System.Data.SqlClient does not exist in a Unity project

I make a small project in Unity and I'm having a problem when I want to use the System.Data(.SqlClient) package. I tried to make a 'custom' reference, to the dll I downloaded separately for this purpose and got no luck with it. Anybody faced this problem before? I just can't get it to work. I want to use an SQL server with the game I'm doing but can't use commands like SqlConnection. The weird thing is that I succeded in Visual Studio (doesn't appear in the error list) but when I return to Unity it's still shown as a compiler error.
Edit: Just to clarify. I tried to use the default dll. I used NuGet to get another one. I used PowerShell's install command to get the System.Data.dll and also download 2 different from the internet from a trustworthy site. None of these ones are working with my Unity project.
Thank you for your help in advance!
The solution that helped me is to set the Framework Unity uses from .NET Standard 2.1 to .NET Framework.
Exact steps:
EDIT -> Project Settings -> Player -> Api Compatibility Level -> Set from .NET Standard 2.1 to .NET Framework || After that it worked for me.

New to Visual Studio, program won't build

I am relatively new to Visual Studio, C#, and using Github. I am trying to get the example for AncestralTrees working (Found here: https://github.com/fire-eggs/Ancestral-Tree). I cloned the repo and try to build, but I get a set of errors that do not make sense.
First is that AppSettings.cs and MruStripMenu.cs could not be found. Are these default config files I have to provide, or am I missing something?
And second is that .NET framework v4.5 wasn't found. For this I am a bit confused, because I thought it was backwards compatible, and I have v6.0.301 installed. To try and fix this error, I went to the website provided and downloaded it, but it wouldn't install as I already have a newer version. Again, am I missing something?
Any help would be greatly appreciated!
For the compatibility issue, .Net Core (6.0) and .Net Framework (4.5) are different animals, with .Net Core as more of a successor to Framework. They are very similar, but there are some breaking changes between Framework and Core, and if a project was intended for .Net Framework 4.5 you will want to have it installed on your system and set as the build target for the project in Visual Studio. You could probably also build for 4.7 or 4.8.
For the files, if they are part of the repo I would expect them to be there. I'd check your file system and see if the files are there, and then check the repo on github and see if they are included in the repo. If not, you may need an additional repo or you may need to manually add a NuGet package.
I did notice this at the bottom of the github page:
This program is both a demo of my GEDCOM library: YAGP, and a hopefully useful program in itself.
Where the "YAGP" text is a dead link. So I would expect to also need this project, which either no longer exists or is not public. This is probably the correct address:
https://github.com/fire-eggs/YAGP
(I submitted a change with the fixed link.)

namespace can't be found by omnisharp even though unity builds

I am using vscode to edit unity scripts, I've added Mirror for needs, which extends its own namespace, but the problem is that omnisharp can't find it's namespace. All Mirror's files are under Assets/Thirdparty/Mirror
Everything works in terms of compiling and the result, but I have no idea how omnisharp works and how to configure it.
Below you can see waving lines at everything that is extended by the namespace.
Sometimes I have that too, especially when I just updated VS Code or added a package in Unity. And sometimes this helps:
Press the Regenerate project files button in Project Preferences.
For me installing .NET Framework 4.7.1 Developer Pack fixed the problem.

Use OxyPlot in Windows Universal app c++/xaml project

I am new to windows app development. I want to use OxyPlot in UWAP C++/Xaml project. I am able to use it in C# based project but not in C++/Xaml project. First I tried to add it using Nuget package manager but it didn't install. Then I followed this (https://social.msdn.microsoft.com/Forums/en-US/8b77c775-21e0-4b43-b9f3-fb3777c43212/adding-libraries-and-use-them?forum=winappswithnativecode). In this Windows runtime component (with OxyPlot) is created in C# and used in C++ project. Here I am able to build the project but app crashes saying OxyPlot (added in C# project) not found.
Can someone please guide me. Regards
This may not 100% apply but it should. I was not trying to do this: "Use OxyPlot in Windows Universal app c++/xaml project". But I was tyring to use OxyPlot in a C++ .Net class so that it could do somethings fast, and eventually pass things back to a C# Class or WPF form. The idea I needed to know was could I create an OxyPlot.DataPoint array in C++ then put it into a C# Double array or an List in C# fast. And I can do that now fast! I hope this approach might help someone here doing this. I don't know how easy it is to use this technique to be able to use the opti chart in a C++ app or not. But if the GUI is done in C# this approach works.
I was getting the error: "You are trying to install this package into a project that targets 'native,Version=v0.0', but the package does not contain
any assembly references or content files that are compatible with that framework." when I tried to install OptiPlot.WPF or the NuGet.Commandline.
This may not be a complete solution for everyone's needs, but it worked for me. I found a "cheatin" way of getting OptiPlot.WPF into a sample C++.Net project. I had a C# main program project in my solution - I installed the package there:
Install-Package OxyPlot.Wpf -Version 2.0.0
Then I copied the packages.config file and the packages folder from there to my C++ .Net Class Library Project. Then I edited the packages.config file and took something out that didn't apply, and I probably took out a package in packages that wasn't needed. Then I added my references in the C++ .Net Class Library Project to packages/OxyPlot.Wpf.2.0.0 folder.
Now I could use the OxyPlot inside of C++! Cool!

C# Referencing Quartz.DLL. Error on Debug losing Reference

I'm trying to build a simple scheduler using Quartz.NET, but when I try to run my program it "loses" the reference and gives me 8 errors. If I re-add the reference, which never actually disappeared, the errors go away, but the program just does the same thing. I'm working on the project on a Team Server Foundation which is completely new to me. I committed the changes, but I simply can't get the third-party references to stick.
I saved the Quartz.DLL in my project in a lib folder.
Here's a screenshot of the errors I'm receiving.
I should also note that I'm not really super familiar with C# or Visual Studios. Any advice on how to add and manage a third-party library would be great.
check if your project's properties is running under .net 4.0 and not client profile.
I think your issue is the using System.DateTime; above using Quartz;. Try removing that to see if it fixes the issues.
Also, if you are running Quartz 2.0, you need to be sure that you are targetting at least the .Net 3.5 framework, not 2.0. See the breaking changes information here.
Right click on Home_Control project. Select properties >> Select Application tab >> Look for the Target framework: >> Change it to .Net Framework 4 (Note: Please select the appropriate version depending on your project. Please Don't Select .Net Framework 4 Client Profile or .Net Framework 3.5 Client Profile).
Try Building the project now.
remove the Qurtz reference and add new reference manually . Use reference from netXX-client folder in package folder.

Categories