Unity lost almost all Assembly references - c#

I have an unity project in which I added an external .dll via NuGet.
After that my project lost almost all assembly references. (Error CS0234)
I tried reimporting all assets.
I deleted the Library-Folder and let it rebuild and reinsert the deleted one.
I checked the manifest.json; It contains "com.unity.modules.ui": "1.0.0", .
Since the Unity Editor and Visual Studio throw me that error I can't run the project.
Can I rebuild the assembly references in any way, so I can save my project?

I found the problem and the solution:
The problem:
You need to insert the .dll you wan't to access into your Asset folder. I did that. I simply took the whole constructed folder hierachy from the NuGet installation folder.
There were multiple versions of the same .dll in there. Also there was a .xml file with assembly code in it.
The solution:
Just copy the .dll and avoid multiple dlls and the xml file. Unity will take care of that itself.
If you lost your assembly references, take a backup of the manifest.json from the Package folder and replace the corrupt one.

Related

BLL and DLL are not founded, when I move them somewhere except source repos(Visual Studio 2019)

I have 3-layer MVVM project, my solution folder, DLL folder and BLL folder are inside 'source > repos >' and project loads normally
But if I move BLL or DLL(or both) to some other folder, or Desktop for example, my project doesn't load correctly and file moved to Desktop defined as not founded in solution explorer
How could I fix it? I need put all this three project folders(DLL, BLL, View) to one folder, because I need to share it as one big project, but I can't, because any movement with files or folder finishes with error 'Files not founded'
Sadly can not send images here, in y question(
Thanks in advance for your answers!
Check for that in your project: is it in the references list? If it is, check that it's built for the same CPU type as your project, and that the Reference properties option "Copy Local" is set to true.
If it isn't, try adding it. If that works, try rebuilding. If it doesn't, then it's probably a Native Library, and you need to ensure that the DLL is either in the EXE folder, or in a folder on the current PATH that Windows uses to locate executables.
You Need to compile the DLL project into a dll file and then refer to the compiled dll file.
Or just use project references to add your DLL project and BLL project.

Could not load file or assembly Telerik.OpenAccess

I added references to telerik dlls in the codeBut, when I am building the project I am receiving an error randomly.
Error1Unknown build error, 'Could not load file or assembly'Telerik.OpenAccess, Version=2015.1.220.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of their dependencies. Can not find the file specified.
I am not using openaccess assembly at all. I have no idea why this keeps coming randomly. I am not even able to find the dll anywhere to add it to the project.
Kindly help me fix this issue.
For me (and after searching around, for many others) this was due to dll files erroneously remaining in the bin folder, even after cleaning the solution. In my case the dlls were somehow left over while switching from one git branch (which included some dlls that depended on Telerik.Openaccess) to another.
I manually cleaned out my bin folder and rebuilt my solution and the problem went away.
The same problem is discussed in the Telerik forums: https://www.telerik.com/forums/unable-to-build-the-application-after-adding-telerik-references.
What you can do is to:
delete the contents of the licenses.licx file and save it.
delete any references to the Telerik.OpenAccess.dll in the project. If needed edit the solution file of the project in a text editor and remove the reference from it.
Last but not least delete your VS and .NET cache - Clean Up ASP.NET and Visual Studio Cache and Temp Files

References can not be reinitialized after check-in from visual studio team service

I did check-in to download source code for the first time, but i got some missing references. I've tried following ways but it doesnt work for me:
Add references: Right click -> add references then find references (after adding the references, there is nothing change, you can see in the photo below)
Dlls were set to Copy Local (I even can not change the copy local to
true)
Adding namespaces to both web.configs did nothing.
I used VS2015. is there any way to update it correctly? thanks
Generally, source code does not contain dll's, since they are vey big files. So I would not normally expect to get dll's from source control. You would usually have to build the solution and hope that Nuget is enabled to download the dll's from where they are stored.
However, the dll's you are showing come with the .net framework, so this should not be an issue, unless of course, the solution file is expecting to find the dll's in some /bin directory.
You can find which directory the dll's are expected to be in by right clicking on the missing dll and then clicking on 'properties'. This should show you the referenced dlls path in the properties window.
If the dll is not in that path you can do one of 2 things:
Delete the reference and add a new reference to the dll, where it actually exists
paste the dll in the path that is being referenced by the solution.

VS2013: never put bin directory in source control, but it caused build fail

I'm new in Visual Studio 2013 (C#). I know in general it should be avoid putting bin directory in source control. However, in my bin directory, there are lots of dll files. Without this dlls, I can't build my project.
I thought maybe I should create a directory, such as 'lib' to store the dlls. But the fact is NuGet always put dll into the bin directory. Should I manually move the dll from bin to lib?
All I want is to simply put all source codes, resource files and dll files to source control (git). Then my team-mates can pull the project then build it in their machine.
edit on 1/4/2015: provide further details
For example, I installed log4net thru NuGet. After finished, I found 3 new files existed in bin directory:
log4net.dll
log4net.xml
log4net.dll.refresh
I tried to remove bin directory from my project, then rebuild my project, and hope to see that a new bin directory would be built and all dll/pdb/etc files would come back. But unfortunately it didn't happen.
In my understanding, the ideal process would be:
add reference/install package, then certain config info would be recorded and according files would be installed to bin directory;
when build, according lib files would be referenced from bin, if such files not found, VS would get the reference info from some place other than bin and download them again. So that's one of the reasons why we don't need to put bin into source control.
However, I found that's not true in my project.
Actually according to the official .gitignore, I found bin directory as build results is filtered ([Bb]in/). That is to say, even VS knows such directory should be ignored.
Maybe some wrong setting within my project?

How to find out where my error is coming from?

I have an annoying error that's been popping up, and I don't know where it is coming from. The error is:
Error 31 Unable to copy file "app.config" to "bin\Debug\Framework.Tests.dll.config". Could not find file 'app.config'. Framework.Tests
The problem is, I don't have a bin\Debug folder anywhere, and it does not say from where it is trying to copy app.config. Double clicking on the error doesn't bring me to any code where it is trying to copy, so that doesn't help me either. So I don't know where I should make the app.config.
How can I find this out?
You have added a reference to a file called app.config or Visual Studio did this for you. The file does not exist on the disk, presumably because after adding the reference you later deleted the file.
Search for the missing file in your Solution Explorer, and either delete the reference or create the file.
It is most likely in the root folder of one of your projects, and should have a yellow triangle warning icon showing that the file is missing.
In an MSTest project the app.config is the one that you would like to provide any calls to the ConfigurationManager class.
It resides in the root of your test project.
The bin\debug folders will be created once the project compiles for the first time. Show all files in the solution explorer should help as they are not (and should not) be included in the project.
HTH
You probably do have a bin\Debug folder beneath your project folder, being the build target folder created by Visual Studio when you build your project for the Debug configuration.
My guess is that something (a test framework perhaps) still has the DLL file loaded, so Visual Studio can't delete and replace the existing Framework.Tests.dll.config file with the contents of your app.config. [Note: the project build action for app.config files is to copy it to the target folder renamed to match the executable with an extension of .config appended.]

Categories

Resources