Missing assembly references - c#

I have cleaned the solution. Even deleted contents of the bin folder. But I still get
Type or namespace name 'Mvc' does not exists in the namespace 'System.Web'
The type or namespace name 'Kendo' could not be found (are you missing a using directive or an assembly reference?)
How do I resolve this?

You don't have the references needed.Install MVC, Kendo, etc. again and the references will be added to your project.
Either browse for the necessary packages (Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution) or install it using the Nuget console (Tools -> Nuget Package Manager -> Package Manager Console)

Try Cata Hotea's solution. I can't tell if you have the reference from your screenshot. It stops. Once System.Web.Mvc is installed. Clean your solution. Close your project. Go to the file system. Delete everything within the packages directory. Then delete your hidden .vs. Then open the solution again within VS. You should get a pop up about needing to download the packages or you can just build the project. Also, be sure to add your Kendo.Mvc reference to the Web.config within your Views directory in XML tag system.web -> pages -> namespaces -> add. Also, note adding or changing System.Web.Mvc or Razor does not always update the Web.config version numbers. Be sure those are correct to avoid warnings.

Related

Finding assembly dependencies in a project

I have a solution where one of the references is refering to google.protobuff v3.1.0.0, but when building the solution I get the older version google.protobuff v3.0.0.0.
From what I gather one of the other references in the project is refering to v3.0.0.0 and overriding v3.1.0.0, but how can I find who's referring to it? there are tons of references in the project.
I tried using Analyze Assembly Dependencies, but it shows that google.protobuff.dll is dangling (means no one depends on it).
Thank you,
Ofir
You can check which project uses a particular assembly and which version, using the Solution Explorer.
Example - searching for the Newtonsoft.Json assembly:
Also, if your assembly is coming from a Nuget package, right-click your solution and select "Manage NuGet Packages for Solution" and then "Consolidate" to check if there are different versions of the package/assembly in the solution:

Project in Solution Added from Hard Link Does Not Show As a Reference

So, I'm working with a Solution, Solution. I have a project that I use as a library, Library. It's located in a dir outside of Solution.
I did the following:
Inside the Solution root directory I created a hard link (mklink /J), Link, to the path for Project.
I added Project to Solution using the Link as the address, generating a
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project", "Link\Project.csproj", "{1DE7E580-A7EB-4228-AA72-2110FE7881DD}"
EndProject
line in the Solution.sln file
Added Project, as a reference, into another project Project2 that lives inside Solution
However, the library shows up with a File Not Found icon in the references list:
If I include the namespace in a file I get:
Error 23 The type or namespace name 'InvoiceGeneratorLib' could not be found (are you missing a using directive or an assembly reference?)
Is VS unable to follow hard-linked project references? What else could be causing trouble?
Hard-to-spot mistake.
The reason the Proeject dll was not being added the Project2 is because
Project was targeting .NET 4.5.2
and
Project2 was targeting .NET 4.5
At least, I can say that TIL that you can use a hard-link to add a project to more than one solution. Not sure if this is best practice, but there it is...

Xamarin Studio, Missing Type or Namespace

I started using Xamarin Studio, and the version is 6.0.1 build 9.
I downloaded sample projects to check its behavior.
I downloaded the projects from the official website.
https://github.com/xamarin/urho-samples
When I start building the project, the error happens as follows.
Error CS0234: The type or namespace name iOS' does not exist in the
namespaceUrho'. Are you missing an assembly reference? (CS0234)
(Urho.Samples.iOS)
error image
I guess I need to fix the building setting, but I don't know how to deal with it.
I'd appreciate your advice.
You are probably missing one or more NuGet packages as indicated by the message.
You can restore the package automatically by going to you solution view, find the project that is missing references, right-click the packages node and click the Restore option.
Here you can also Update all packages or add them.
This is one of the first things you want to do when getting a external project of at first checkout. There is also the option of doing this automatically when building.
For this go the the Xamarin Studio menu option, the Preferences and find the NuGet section. Under General you can check an option to do this automatically when building a solution.
Also, you can let it check for updated packages. Then you will see the '(x.x.x available)' suffix like in the first screenshot.

Visual Studio Online build fails - Local works

I upgraded to VS2015, and MVC was updated to 5.0.
I am able to build successfully on my local PC, but when I checkin to Visual Studio Online, and my CI build builds, it fails:
"The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)"
I've used nuget manager to remove, and re-install MVC on my project - same results.
Looking at my references in the project, all looks OK.
I also notice in the log before the error happens:
Installing 'Microsoft.AspNet.Razor 3.2.3'.
Installing 'Microsoft.AspNet.Mvc.FixedDisplayModes 5.0.0'.
Successfully installed 'Microsoft.AspNet.Mvc.FixedDisplayModes 5.0.0'.
Successfully installed 'Microsoft.AspNet.Razor 3.2.3'.
All packages listed in packages.config are already installed.
But it seems when it builds, it doesn't know what MVC is. How can I resolve this?
Late to the game here, but I was having a very similar issue: Error CS0246: The type or namespace name 'blank' could not be found (are you missing a using directive or an assembly reference?).
This was building locally but not in VSTS. My solution was to delete the reference under the project's references, and then just add it back in again. The reference was to a namespace in a local project to the solution. For some reason it was being found locally but not found when checked into and built on VSTS.
Deleting the reference and then re-adding it worked for me.
Check the version number mentioned in all web.config files. I mean also those in the view folders; that they match the version 5.2.3.0
Scan all your references and ensure, that all of them related to MVC have Copy Local property set true. Not only Mvc one.
I fixed this by removing all the folders within my Packages folder, leaving only repositories.config. This forces VSOnline to restore all the packages on each build.

'Validation' does not exist in the namespace 'System.Data.Entity' when building on Team City

I have a project that is working perfectly on my computer, but when trying to build it on Team City i get the following build error for source files where i have
using System.Data.Entity;
using System.Data.Entity.Validation;
CS0234: The type or namespace name 'Validation' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
Do I need to install Entity Framework manually on the server running Team City for this to work?
Update after activating Nuget Restore:
This must be some kind of configuration issue.
I can see in the build log that the build process is copying the .dll:
[Copy] Copying file from "D:\TeamCity\agent1\work\541c9f462afc285d\packages\EntityFramework.5.0.0\lib\net45\EntityFr amework.dll" to "bin\Release\EntityFramework.dll".
[16:51:55][Copy] Copying file from "D:\TeamCity\agent1\work\541c9f462afc285d\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.xml" to "bin\Release\EntityFramework.xml".
But shortly after, it is considering a bunch of different locations, but not including the bin\Release\EntityFramework.dll" folder.
Update 2:
Manually copying the .dll to the bin/release folder of my class library helped the build to pass, but obviously this is no viable solution, so will need to keep on finding out how to configure this correctly.
Update 3:
Never did find a satisfying solution for this I am sad to say, so any genius that can solve this are very welcome. :)
As an error suggested you are missing assembly. And as #Shriroop suggested this is in EF packge.
Before your compile step, add Nuget Installer step. There are few options you should set, Path to solution name and I suggest you use nuget 2.7+ and Restore mode: Restore.
To install latest nuget version in teamcity go to Administration > Nuget Settings > NuGet.exe and fetch latest version.
Here is a sample of NuGet Installer step: http://img.hihi.si/Upload/5PUm.png

Categories

Resources