How to specify assembly id in type name?

I use visual studio 2010 for network design and I used a layer

I use gidview and objectdatasource, but I get this release:

"The type 'WebApplication4.view1' is ambiguous: it could come from assembly 'C:\Users\EHSAN\AppData\Local\Temp\Temporary ASP.NET Files\root\d04444bc\d654bde6\App_Code.i0fp6yrj.DLL' or from assembly 'C:\Users\EHSAN\Documents\Visual Studio 2010\Projects\WebApplication4\WebApplication4\bin\WebApplication4.DLL'. Please specify the assembly explicitly in the type name." 

I posted my code here:

this is my web.aspx:

 <asp:ObjectDataSource ID="ObjectDataSource1" Runat="server" TypeName="WebApplication4.view1" SelectMethod="Search" OldValuesParameterFormatString="original_{0}" > </asp:ObjectDataSource> 

and this is the search.cs file in the BAL folder in APP_Code:

 namespace WebApplication4 { using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Data; public class view1 : System.Web.UI.Page { public view1() { } public List<person> Search() { List<person> persons = new List<person>(); DataSet ds = PersonsDB.Search(); foreach (DataRow row in ds.Tables[0].Rows) { persons.Add(new person((String)row["id"], (String)row["nam"], (String)row["family"], (String)row["namepedar"], (String)row["shshenas"], (String)row["codemelli"])); } return persons; } } 

where is the problem?

+6
source share
5 answers

Try moving the Search.cs file from the App_Code folder and see if it works. I had the same problem, and I redid it, and it started working.

+10
source

I had the same error. I created a WebUserControl project with a control in it called control1 . In addition, I had a Website1 project where I used my control1 (using the project build event to copy control1 to Website1 ). It worked fine, but then I copied the Website1 project and renamed the Website2 project. On website2 I got this error. Cleanliness, restructuring did not dare. I deleted all the files in the Website2 \ bin folder and created a Website2 project. Error resolved.

+3
source

This happens when a project has two classes with the same name, usually due to a copy and paste error. Can you check if you have another class named view1 elsewhere?

If this is not a problem, try clearing temporary web files as shown here: Removing temporary asp.net files

+2
source

When you add a solution link, please make the file properties copied to the local "False". Therefore, it will not be copied when we build the solution, and we will not get the error. It works for me. please try this.

0
source

Right-click the website / web application property and set the Assembly header field with the specified name.

For example: if the application has the name XYZ and uses the namespace name as companyname.dept.XYZ , then the application can have two separate DLLs. XYZ.dll and companyname.dept.XYZ.dll , which can cause conflicts.

0
source

Source: https://habr.com/ru/post/945316/


All Articles