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.
Related
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.)
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!
I'm trying to use web services on unity.
I used svcutil to generate a proxy class, however the proxy class was using "System.Threading.Tasks".
I noticed that System.Threading.Tasks wasn't aviable on .Net 3.5.
So I went to player setting and I changed to .Net 4.x
But now I have an other issue, and I cannot find a way to fix it, I need to use System.Web.dll and System.Web.Services.dll to make my web service work, however, the dll that are include in Program Files\Unity\Editor\Data\Mono\lib\mono\2.0 are all targets for .Net 3.5.
So that mean I cannot use them on .Net 4.x
I've been looking for quiet long and was unable to find any answer.
I can add the code to the proxy class here if it's require, but I don't think it would be useful. Should I download those dll somewhere?
Anyone ever seen thoses issues somewhere?
You are using the wrong dll version.
Once you change Api Compatibility Level to Net 4.x, you have to copy the System.Web.dll and System.Web.Services.dll files from <UnityInstallationDirectory>\Editor\Data\MonoBleedingEdge\lib\mono\4.5 to your <Project>\Assets path.
That's it. Restart Visual Studio and Unity.
There is another method of linking missing libraries as described in this unity documentation.
Create a file called csc.rsp and put these 2 lines in it:
-r:System.Web.dll
-r:System.Web.Services.dll
And yes, you better set compatibility level to .NET 4.x
You also might want to restart Unity or VS in some cases.
I just had to downgrade my ASP.Net 4.5 application to an ASP.Net 4.0 application, because our servers don't support 4.5. The way I downgraded it was pretty simple:
Project -> Properties -> Application -> Target Framework
When it finished doing stuff, I restarted the solution, tried to start debugging, but it stopped right after I started debugging, giving me first some errors (which say they can't find some namespaces) for a fraction of a second and after the errors disappeared it gives me 127 warnings that all look like this:
Now I know what the problem is here, but I don't know how to solve this issue.. Does anyone know how to fix these warnings?
Thanks in advance
INFO
I'm using Visual Studio 2015 Community
Remove your current references to the Dlls in question and them add them again, it should load the correct versions of the Dlls. Because you had references to the 4.5 versions and then changed the project target the references are invalid now because they are build against a higher version framework. Changing the projects framework version target does NOT update the references in most cases
It is actually not that easy when it comes with ASP.NET. You have to go through all web.config(s) and downgrade referenced libraries. If its new project, just create new ASP.NET on .NET 4 and compare its web.config(s) with yours.
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.