I am Telerik controls in my project, Error is telerik.web.ui is not found, Coudn't find assembly
I have added Telerik.web.ui.dll inside Bin directory
Reference Code is available inside web.config
If you are running on a 64 bit comp then you will need to add the 64 bit version of Telerik.web.ui.dll that is properly the problem
Download Telerik DLLs and install them using NuGet Package installer . This will solve your problem and you may need not to worry about manually adding each and every DLL which are needed for your project
Related
My solution file contains a website project and some library projects. My website project is depending on these library projects and some other nuget packages. I have to build my .sln by MS Build. By executing nuget.exe all dependencies are loaded, but their references not updated to packages folder. When I google my problem I found the following solution.
https://www.codeproject.com/Articles/823752/ASP-NET-Website-Project-External-Assembly-Referenc.
But it did not solve my problem as I do not want to keep bin folder and I also do not want to keep the .refresh files of all the DLL. I need to load all external dependencies and referenced automatically, when I build .sln file.
ASP.NET website update assemblies references without modifying .refresh file
If I understand you correct, you can add a class library project to the solution, and add reference to the class library project to your website. Then, add the nuget in the class library, not the website project.
Then you could use nuget.exe update those nuget packages for the solution, like:
nuget.exe update "<YourWebsitePath>\WebSite1.sln"
In this way, When your build website, it pulls in all the class libraries' dependencies in turn.
If I am not understand you correct, please let me know for free and you can share a simple sample about your question, so that we could understand it more clearly.
Hope this helps.
About: I have a ASP.NET website (not Web project) with 3 class library projects in the solution. Earlier I was using SVN but now Git is used source management. I have installed the git locally on a computer (used as server) and using it for merging the source code from other developers. Also, I am using Visual studio 2015 community edition which provides the tools to work with git.
Problem: After cloning the project from the master repository, I build the project to run it. Building the project shows a dialog box saying "Package Restore is in progress". This process creates a folder named "Packages" and that folder includes every package listed in the packages.config file. But after restoration completes, the project throws the following exception:
This exception shows for each package (Autofac here).
The type or namespace name 'Autofac' could not be found (are you missing a using directive or an assembly reference?)
Work around To Solve this problem, I need to uninstall each package and installed it again and problem is solved. This thing I need to do again and again for each developer machine, which is frustrating and time consuming too.
Does anyone has faced the same problem working with Nuget, git and website in ASP.NET.
I faced a problem like this before. In my case, the reason was that I changed the project path (moved the project to another directory), and the path of the packages directory (that contains the NuGet packages) was stored in the csproj file for the old path, that is VS cannot restore NuGet packages. The solution for this was to edit the csproj manually and make it referring to the correct new packages path.
If this doesn't work for you, you can still use your workaround, but using the following PowerShell command (in NuGet Console) for simplicity:
Update-Package -reinstall -Project Your.Project.Name
Note: project name doesn't contain csproj extension, just the project name
It is good practice to not put third party packages into source control. It bloats your repository (even on a large web application, the size of the external packages will massively out weigh your code).
If NuGet package restore is slow, you could look at using a local cache (this can be as simple as a shared folder) or a better internet connection.
That said, you should only have this problem once per machine. While the packages are downloading you could be giving the new team member an overview of the design…
Make sure that all of your projects are using the same target framework, when this isn't done you can often get the
type or namespace [name] could not be found
warning.
To do this, right click each of the projects in the solution explorer > Properties > Application tab > Target Framework. They should all be the same or there will be incompatibilities between the references in your projects. Here's a question regarding this, hopefully this helps.
The main reason is there no Autofac reference in packages.config file.
When you see on the screen Restore packages message box this mean that nuget package manager is trying to install all the packages which are missing in the package folder.
Try to do this step:
In Visual Studio Solution Explorer pick the project and via context menu pick Unload project
After project was unloaded via context menu pick Edit your project
Go to section group and find you Autofac Reference section
If HintPath doesnt looks like ..\packages\Autofac.4.1.1\lib\net45\Autofac.dll (Actual for 4.1.1 version) remove the Autofac reference Item
Save csproj file and reload project
Install Autofac via NuGet Package manager
Commit and push changes to git repository
Had the same problem with VS 2019. In ASP.NET, packages are updated via the .refresh files that appear in your bin folders. If these aren't checked into Git, they wouldn't be copied down to your cloned repro.
I added the .refresh files for all of my package dlls, made sure the versions and paths in the .refresh files were correct, and now everything updates as expected.
I noticed today that whenever I build a word add in project of mine, Microsoft.Sharepoint.dll is being copied into the bin folder and is subsequently included when publishing.
Is there an easy way to see why this (annoyingly large) dll is being included when publishing?
It isn't referenced directly. There are 3 dependencies in the project page and I've checked all these projects and none of them reference it directly either. Do I need to continue following the dependencies of those projects too?
Is there not some kind of log file for a build that could give me a hint?
EDIT:
The problem was that my project referenced a project that referenced a project that had a reference to Microsoft.SharePoint.dll with copy local set to true. I had to delete the dlls from all projects and rebuild with copy local set to false. I didnt realise that the 3rd party dll would be copied into my project.
If this is being pulled in due to a dependency from another DLL, then try looking at all of your DLLs in Dependency Walker. It finds all of the dependecies that a dll has. This is usually only when they are actually being used/bound, but you can also use the Fusion Log Viewer to see where all DLL binds are being bound from.
You could have a a look at reflection mechanism of asp.net or if not you could run trace using firebug for cross reference on browser ,
In a MVC2 project I moved a file from App_code to Content folder and compiled it. Then move it back again to App_Code and then changed its Build Action to "Compile". Now I get this error and I don't know how to fix this to make my program work again:
CS0433: The type 'Helper' exists in
both
'c:\Users...\AppData\Local\Temp\Temporary
ASP.NET
Files\root\b00d4b7d\b2553f9c\App_Code.zowyklar.dll'
and
'c:\Users...\AppData\Local\Temp\Temporary
ASP.NET
Files\root\b00d4b7d\b2553f9c\assembly\dl3\5c6d3537\19f85663_cde9cb01\MyProject.DLL'
Cleaning and Rebuilding doesn't solve the problem.
This has been answered in a separate question and resolved the problem for me. Be sure to vote up the original person's answer.
ASP.Net error: "The type 'foo' exists in both "temp1.dll" and "temp2.dll"
Add the batch="false" attribute to the "compilation" element of the web.config file.
This problem occurs because of the way in which ASP.NET 2.0 uses the application references and the folder structure of the application to compile the application. If the batch property of the element in the web.config file for the application is set to true, ASP.NET 2.0 compiles each folder in the application into a separate assembly.
http://www.sellsbrothers.com/news/showTopic.aspx?ixTopic=1995
http://support.microsoft.com/kb/919284
Assuming you're building a Web Application, which it appears you are given the MVC2 point, you shouldn't use the App_Code folder. It was not designed to be integrated with Web Application projects.
When you Compile in Visual Studio, all the code in your application
(including in App_Code) gets compiled into an assembly. When you run
your application, asp.net knows about a "special" folder called
App_Code and compiles the content of it into an assembly with a unique
name. Thus, anytime you run the project you'll run into this problem.
The solution:
Rename your App_Code folder to something like "Code" or "Global"
(and update your now broken references) & voila, problem solved.
My issue was with different version of DevExpress.
Deleting all contents from bin and obj folders made my website run again...
Reference:
https://www.devexpress.com/Support/Center/Question/Details/KA18674
Try cleaning your solution and then try to rebuild. Visual Studio probably still has reference to the old dll after it created the new dll.
Simple Solution worked 100% for me
Put the class outside App_Code Folder
http://vishaljoshi.blogspot.in/2009/07/appcode-folder-doesnt-work-with-web.html
I had the same error :
The type 'MyCustomDerivedFactory' exists in both and
My ServiceHost and ServiceHostFactory derived classes where in the App_Code folder of my WCF service project. Adding
<configuration>
<system.web>
<compilation batch="false" />
</system.web>
<configuration>
didn't solve the error but moving my ServiceHost and ServiceHostFactory derived classes in a separate Class library project did it.
TRY THIS ONE!
Normally, when this happen locally, i clean all the aspnet temp folder. But recently it was happing when i published my website in Azure. So "clean temp aspnet folder" was not a solution.
After searching on the internet, i founded this:
Clear Temp ASP.NET files from Azure Web Site
It works for me!
The App_Code folder isn't intended to be used with MVC Projects (WAP).
Files in the App_Code folder gets compiled automatically as part of a special dll. If the Build Action property on the file is set to Compile, the same class will also get compiled as part of the main dll and you will end up with two copies.
Setting the Build Action property to None makes sure there is only one copy of the class in the project. The compiler will not catch any errors in the App_Code folder when building but Intellisense will still validate the code but compile-time errors won't show up until it is compiled on-the-fly.
The recommended solution is to put code in a normal folder and make sure the Build Action is set to Compile.
There might be two classes with same name "Helper" in your solution/project. Change name of one of them and then rebuild
I had the same problem in one of my projects. Turns out the problem started from me coping a Master page.
The problem will also occur if two pages "Inherit" the same page.
I had the following line of code at the top of my "LoginMaster.Master" & "MasterPage.Master"
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MainMaster.master.cs" Inherits="Master_Pages_Header" %>
I changed the Inherits on my "LoginMaster.Master to:
<%# Master Language="C#" AutoEventWireup="true" CodeFile="LoginMaster.master.cs" Inherits="Master_Pages_LoginMaster" %>
I was immediately able to publish my project with out any problems. Hopefully this works for someone else. I apologize for not use the correct terms.
You will also need to change the class in the .cs to match the Inherits name. If you don't it will cause an error.
IE:
public partial class Master_Pages_LoginMaster : System.Web.UI.MasterPage
If your are migrating ASP.NET 2.0 Website to .NET Web APP 4.5, you can have that issue too. And puting batch=false, adding a namespace etc... can not work.
The workaround is to rename the old App_Code folder (or any problematic folder) to Old_App_Code (like the automatic process do it), or any other name.
Had a similar problem, In my case, I noticed, that cleaning a solution doesn't clear the bin folder in the visual studio. There was old compiled .dll present in the folder that is causing the issue.
Solutions:
Manually delete bin folder and recompile.
In case of publishing, select delete existing files prior to publish.
This will solve the issue.
In the Web Application(not Web Site), I change App_Code*.cs Build Action(file properties) from Compile to Content. then the problem solve.
In my case, I have to items with same name but different extensions in my project. One was accountRep.aspx and the other accountRep.rpt made by Crystal Report. Problem solved when I changed accountRep.rpt to accountReport.rpt
Another potential solution which worked for me was to change all references from
CodeFile="~/..."
to
CodeBehind="~/..."
in all .master and .aspx pages
This occurred when converting an old website to a proper web application with a solution file.
I didn't find this information anywhere else so hope this helps someone.
I fixed this by checking Delete all existing files prior to publish in Visual Studio:
In my case I got this error when I had mistakenly named a class the same as the class it was inheriting from.
I tried pretty much every suggestion on this page, but had to delete visual studio 2017 completely off my machine. I reinstalled the latest version (2019) and it magically worked. I hope this helps someone in the future.
I fixed this by removing one of the unneeded NuGet packaged referenced in the dll files causing this conflict.
So in this case I had both ZXing.Net and ZXing.Net.Mobile installed. Since I was creating a mobile app in Xamarin Forms, removing the ZXing.Net NuGet package resolved this.
Be sure to check and make sure you don't have redundant NuGet packages for different frameworks, i.e. ASP.Net versus Xamarin.
Try to change folder name
from APP_CODE
to CODE.
This fixed my issue.
Alternatively you can move to another folder all your code files.
Comment one of the crystal report version part in Webconfig in assemblies
and build.
I have installed the ASP.NET MVC 2 RC and opened the default "example project", but get the following error:
Parser Error Message: The type
'System.Web.Mvc.ViewMasterPage' is
ambiguous: it could come from assembly
'C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mvc\2.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll' or from assembly 'C:\Documents and
Settings\sfent\My Documents\Visual
Studio
2008\Projects\MvcApplication1\MvcApplication1\bin\System.Web.Mvc.DLL'.
Please specify the assembly explicitly
in the type name.
This appears to be a conflict between the GAC dll and the dll created and placed in the bin directory (which I thought was supposed to be used in preference to the GAC version)
I have Googled this issue and have found similar problems, but relating to incorrect namespacing. This is the un-altered example application that comes bundled with the MVC framework.
I have also tried removing the framework entirely and re-installing the RC, but to no avail.
All suggestions appreciated.
I got this error, and in my case it was resolved quite easily.
I had made a new Master Page in my Views folder, but unnoticed by me, it came with code behind and designer, which of course you don't want with MVC2. It all built, but gave me that "Parser Error Message: The type 'System.Web.Mvc.ViewMasterPage' is ambiguous:..." error when I ran it.
To fix it, I removed the code-behind and designer files for my new Master page, and the error went away.
the problem might be that the Reference in your Project is still pointing to the old Version of the dll (v1.0). Delete the reference and add a new one to version (v2.0).
You find that hint as well in the release notes of MVC2 RC:
"Open the project using Visual Studio, and in Solution Explorer, expand the References node. Delete the reference to System.Web.Mvc (which points to the version 1.0 assembly). Add a reference to System.Web.Mvc (v2.0.0.0)."
Cheers,
Damrod
Does your project reference both v1 and v2 of the framework? Also, why not delete the matching dll that's been copied locally?