I've got MVC.Net application in my TFS2015. My Applications builds & runs fine in Local. I'm configuring CI/Cd pipeline for this application. Please find the error specified below
Error CS0234: The type or namespace name 'WebApi' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
Error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'System.Net.Http' (are you missing an assembly reference?)
I've tried both MSBUILD & Visual Studio Build tasks in my pipeline, still same error occurs
The type or namespace name 'WebApi' does not exist in the namespace 'Microsoft.AspNet' (are you missing an assembly reference?)
According to the error message, it seems you are missing the references when you build with Azure DevOps. You should add nuget installer tasks to restore the package:
NuGet Tool Installer task
When we build the project/solution on local machine, the packages is downloaded stored in the \packages folder, this folder is ignored by the source control (This is recommended.) when we submit our source code, so when we build the project/solution on the Azure DevOps, we need add nuget restore task to restore nuget package before we build it.
If you have already use nuget restore in your pipeline and still get that error, please share the warning info in your build log.
Hope this helps.
I've copied the missing dll's from
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\Facades
To
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2
Thanks #Leo Liu -MSFT for suggesting this article. It worked for me
When trying to build a solution developed in VS2010, I get the following error in one of the subprojects that depends on a DLL built by another project in the solution, though it seems to have all the project references correctly interpreted by Xamarin Studio (v5.7.0).
/path/to/failing/project/myproject.csproj (Build) ->
/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/4.5/Microsoft.Common.targets (ResolveAssemblyReferences target) ->
/Library/Frameworks/Mono.framework/Versions/3.12.0/lib/mono/4.5/Microsoft.Common.targets: warning : Reference '/path/to/successful/parent/project/library/bin/ReleaseMac//mylibrary.dll' not resolved
After this error, there are subsequent compilation errors like:
The type or namespace name 'MyLibrary' could not be found. Are you missing an assembly reference?
These are presumably related to the fact that the DLL that did not resolve correctly contains that namespace.
Might this also be related to Xamarin not resolving references correctly?
When opening an MVC4 C# web project in Visual Studio 2013, the IDE reports the error "The type or namespace name '_' could not be found (are you missing a using directive or an assembly reference)", but the project builds and runs without any errors. Furthermore, intellisense does not include the project namespace.
The "missing" reference is to files within the same project.
for example; the web project namespace is "webproject.com", and references in a controller files to "webproject.com.models" is underlined in red with the error above.
I have checked the following:
All Solution projects are configured to use the same Target Framework(.Net 4)
web.config in the Views folder contains the namespace in the system.web.webPages.razor section
cleaned and rebuilt solution
deleted all bin and obj content
deleted .suo and .csproj.user files that were created by VS2010
The only way that I can get rid of these errors being reported in VS2013 is to unload then reload the project.
When opened in Visual Studio 2010 I do not get these problems.
I have the same issue.
ALthough the project compiles correctly, the code editor shows an error The type or namespace name '_' could not be found (are you missing a using directive or an assembly reference).
THere is one workaround. Just delete the *.SUO files and re-open the solution. THen for this only Session it works. Unfortunately after closing and reopening the solution the issue is back again. VS 2012 works fine.
Seems to be a bug in VS 2013....
My solution, when I encountered the problem with VS 2013 Express edition was to simply unload the offending project and reload. Opening the SUO or Project file and making changes had not affect.
Try to unload the project in VS2013, then right click the node and select edit "projectname.csproj". Check the individual references they might point to somewhere strange.
EDIT: the csproj file is an xml file and the references are located under Project -> ItemGroup -> Reference
I had the same issue.
It's a VS 2012 solution with different projects.
Search for all *.suo files and deleted them.
Rebuild and reopen Visual Studio.
There's a known issue with Web Application projects when bound to a TFS server that sounds like this issue. This occurs when the following TFS setting option is checked:
Options -> Source Control -> Environment -> Get everything when a solution or project is opened.
Disabling this option resolves the problem.
thanks,
Miguel Lacouture
[MSFT]
Same issue, on project reference.
I opened the referenced project file (*.csproj) with a text editor and did some cleanup:
1) reset these properties' values:
<PublishUrl>publish\</PublishUrl>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
2) removed dirty platform/configurations:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
...
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|x86'">
...
Now I can compile without any issue.
Glad to share it with you! :))
Same issue. Opening the project's properties and making a change to the name (or any value) and then rebuilding seems to have resolved it.
I have just had this problem and none of the solutions here helped. I fixed mine by doing a repair of Visual Studio (An option when you select to uninstall the program). Hope this helps someone
I had same issue when I added a new class file ( e.g. MyClass.cs) and called it in some other C# code places. For some reason VS did not add that new class file to my working project folder (not seen in VS, but seen in Windows File Explorer). And, hence, the compile path for new class file is not included in the compile section of my project file (e.g. MyProject.csproj). So to solve this problem, First, right click on your working project > Add > Existing Item ... > Select your new class > OK.
Then, check the project file (*.csproj) and make sure a new element is inserted in the compile section such as:
Finally, rebuild your project and the problem should be solved.
Another reason for this issue is the project, I had long ago with VS, is my other project was set up with Client Profile as its target framework. So, to solve the issue: Right click your project in VS > Properties > Application tab > make sure Target Framework option is not Client Profile. You should change all projects in your solution to the same framework version AND all of them must not have Client Profile option.
Microsoft just released a new security update to be automatically applied to machines configured to use Microsoft Update.
Unfortunately, some ASP.NET MVC 3 and 4 VS projects can no longer build after the update is applied. These projects will fail with the following error:
"Could not locate the assembly "System.Web.Mvc,Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSIL"
My project also had the error "The type or namespace name 'System.Web.Mvc' could not be found (are you missing a using directive or an assembly reference)". Installing the latest version of Microsoft.AspNet.Mvc solved my problem. See the following article from Microsoft for more info:
http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx
Unloading and then reloading the project worked for me.
I have a project which uses "SD.LLBLGen.Pro.DQE.OracleMS.NET20" reference.
I did some blunder and it's missing now.
I am getting Build Error:-
The type or namespace name 'Oracle' does not exist in the namespace
'SD.LLBLGen.Pro.DQE' (are you missing an assembly reference?).
Can any body help me in this, tried googling but no fruitful result??
Apologies, if the question is put in wrong section .
If you have LLBLGen installed locally, you should find the file in a location something like this:
C:\Program Files (x86)\Solutions Design\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\Net2.0\SD.LLBLGen.Pro.DQE.OracleMS.NET20.dll
You can correct the path of the broken reference to point to this file. Or, better yet, copy this file into your source control location for the project so other team members can compile the project without having the full LLBLGen installation.
If you don't have this file locally but have a customer ID you can log in here to download the installer:
https://www.llblgen.com/pages/customerlogin.aspx
I suspect the trial version also comes with this file, but have not tried that approach.
I am trying to create a ManagedWrapper dll that can be called from an MFC application that will not be compiled using /clr switch. In a header of my test MFC, I have declared the following:
#import "ManagedProxy.tlb"
using namespace ManagedProxy;
When I try to compile the test MFC application, I get error C2871: 'ManagedProxy' : a namespace with this name does not exist. I am sure this has worked as recently as yesterday. If I specify a wrong tlb file name, I get compile error C1083, which indicates to me that the tlb file is being loaded correctly.
Why is Visual Studio now complaining and why did it work before?
Addition:
I just found out that my proxy stopped working after I changed the namespace to ManagedProxy. I have recompiled the Managed project, and the native application has as an Additional Include Path, the Debug folder of the managed project, so it should be referencing the latest tlb but it is not. I tried an absolute path to the tlb, cleaned and rebuilt project with no luck.
Why is the tlb not the namespace change?
Addition
Used Object Browser to see what is in TLB and the namespace ManagedProxy is somehow renamed to something else. I am also missing a couple of interfaces although they are marked with ComVisible(true).
Someone please help....
TIA.
You can rename the namespace when you import.
#import "ManagedProxy.tlb" rename_namespace("ManagedProxy")
The interfaces not showing up are likely not marked public.