I'm not exactly a master of TeamCity (yet!) so please accept my apologies if this question is poorly formulated.
In my local IDE I can rebuild the solution. In TeamCity, I can do that too. Then, I add a new project, which has a reference to an external DLL (Oracle.DataAccess). While the local version builds without problems, I now get an error when running the build from TeamCity.
It claims that the problem is as follows.
error CS0012:
The type 'Oracle.DataAccess.Client.OracleDbType' is defined in an assembly that is not referenced.
You must add a reference to assembly 'Oracle.DataAccess,
Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342'.
Why does it complain about it when the local rebuild works?
What can be done about it?
I've checked that I'm targeting the correct repository to avoid this mistake. The only thing that changes is that I'm adding the project to the solution. I also noticed that removing the reference from the project fails the local build with the same message as the TC's. However, readding the reference to it (followed by a check-in) doesn't reciprocate the success of rebuild...
Suggestions?!
Make sure that reference to Oracle.DataAccess has attribute CopyLocal = true.
Also, take a look at the other properties as well. The path might be set to a locally available drive pointing to a file that isn't checked in to the VCS.
Related
This is my first time initializing a project and downloading it from a repo from another developer. When I try to inialize it. I am missing references. I have solved some references being missing by right clicking them in the reference tab Clicking Properties, and Enablying "Copy Local" to true... This has worked for others. But when I do this for this specific reference (Elmah) it keeps turning back to false. I also don't see a .DLL in the folder if I try to manually add it. It only shows a .nuget file. Can someone explain to me exactly how .nuget works when you first download your solution? How is it suppost to work- and can someone give me an idea as to why this might be failing? Here are some references thatI have tried that are failing. "'Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified'' after using Elmah.MVC in NuGet
This solution worked for this for my infrastructure .dll
Could not load file or assembly 'Microsoft.Web.Infrastructure,
Whenever I try to simply reinstall Elmah from .nuget package manager I get the error
"Severity Code Description Project File Line Suppression State
Error Failed to add reference to 'Elmah'.
Error HRESULT E_FAIL has been returned from a call to a COM component.
It is resolved. I manually deleted it and simply reinstalled it after manually deleted it. I have yet to see if I switch branches if it will retain though.
I'm receiving this error messange:
The type NormalDistribution exists in both Accord.Statistics,
Version=3.8.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7 and
Accord.Statistics, Version=3.8.2.0, Culture=neutral,
PublicKeyToken=null
How can I solve this?
So I had this problem today. Seems I had two versions of the DLL I fixed this by removing both from project
Solution > References -- check for the files with similar names and remove them. then re-add the correct version.
Clash solved.
It's possible this is related to: Where does error CS0433 “Type 'X' already exists in both A.dll and B.dll ” come from?
In summary:
This can sometimes happen when Visual Studio fails to correctly clear out cached state as part of rebuilding. I have noticed it occurring more frequently with recent updates of VS2019.
Try the following steps and see if it helps:
Delete all bin/obj directories for your solution using File Explorer
Close VisualStudio and restart PC (this seems odd and unnecessary, but have found it can help)
Reopen VisualStudio and do a full rebuild
It is also possible, although much more unlikely, that you genuinely have two references to the same package / dll with different hint paths. One retrieving a signed version, and one not (although if this is an external package it seems unlikely you'd have an unsigned version available). If the above steps don't work, check your project file for duplicate references.
I am running a project that had been running without issue for some time but recently started throwing an error stating,
"Could not load file or assembly 'Microsoft.Practices.Unity,
Version=2.1.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
or one of its dependencies. The system cannot find the file
specified."
I see that this assembly is for IoC/Dependency Injection support however I never explicitly added it to the solution; although I do see that it is in fact there.
When I check the version of the assembly it is showing the same version that is being referenced in the above error; so I cannot figure out why the file cannot be found by the project.
In effort of resolving the issue I've cleaned the solution, deleted my obj folder, rebuilt, removed and even reinstalled the assembly via nuget but the issue persists.
I've found somewhat similar issues reported here on SO but the proposed resolutions were either not applicable because it was not the same assembly reference as the one I'm having issue with OR it involved configuration of a XAML based application. This is ASP.NET.
The only other clue that I could find as to why I'm having the problem is that the targeted runtime framework of the assembly is v2.0.50727 and this application is .NET 4.5
Which would seem a reasonable explanation for the problem from my limited perspective except that the app was previously running without the problem.
I'd also mention that the assembly isn't explicitly being called from the block of code throwing the error; which is simply creating a web service client and calling a method.
long memberId = 1326728123;
ServiceClient sc = new ServiceClient("ServiceClientEndPoint");
var leadPackage = smc.GetLeadPackages(memberId);
So there could be other variables of this equation that may be attributing to the problem (e.g. Network blocking and etc)
I just wanted to make certain that I may not be missing something by running it past SO before wasting time going in the wrong direction for an answer.
Note that this could mean a number of things, including that one of the dependent assemblies of Microsoft.Practices.Unity could be loaded.
The first place searched is the GAC, if you are building and running on the same machine, this probably won't cause a problem because the runtime will also find the same library but if you are deploying, the project will sometimes bind to the GAC library whereas the production server might not have it installed and it will fail to run. CopyLocal=true should fix that but if you are deploying, you should check that the library is copied into the bin directory.
Secondly, you should open Microsoft.Practices.Unity.dll using reflector or ilspy.exe and see what other dependencies it has (other than the System.* libraries) since any other ones will need the same treatment as Microsoft.Practices.Unity i.e. adding to the project and copy local set to true.
I am developing a .net solution. Due to certain complications, I have been asked to add dlls to the solution and then reference the dlls from within the solution.
It works fine on the local box , and builds perfectly on TFS Build server,
but when I run it on the server after deploying , I get a run time exception saying :
Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Would you know what I should be doing at this point ?
I can provide you more detailed info if needed.. please let me know.
It seems like you need to get Microsoft.TeamFoundation.Client.dll file,
then add it as a reference to your application
this is the dependencies you described:
Two possible resolutions
Set CopyLocal property to true so that when build is done local copy of dll is added.
Check reference folder has been checked in TFS or not. Sometimes it happens that reference folder is not added in TFS.
We have a project which utilizes Sharp Architecture. For the purposes of some testing, we made some adjustments to strongly type some assemblies.
Following this, the project would no longer build. VS2010 complained that:
error CS0012: The type 'SharpArch.Core.PersistenceSupport.IRepositoryWithTypedId`2' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpArch.Core, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b5f559ae0ac4e006'.
The reference has been removed and re-added. It's also in the GAC and we've verified that the Public Key Token matches.
Just check if you are running in x64 mode. Otherwise things will not work. Go to the vs project properties and change it to x64.
This is my checklist with the most likely cause on top.
Make sure your project is not set to ".NET x.x CLIENT Framework". This one gets me all the time.
Try cleaning your solution. I find that VS gets confused sometimes and needs you to clear out the obj/bin folders.
Restart VS
Set the reference to copy locally.
Change it so that it doesn't request a specific version.
Change it so that it does request a specific version.
Remove the reference to the GAC version and add one to a version stored in a file.