I am done testing my site and I want to upload it to a site like this
http://www.university.edu/mydepartment/myname
the admin told me the server runs on .NET 3.5. So i used Linq ...
now i tried to upload the site by two ways:
when i just copy everything (with modification of web.config database settings) i get an error:
CS0246: The type or namespace name
'DataClassesDataContext' could not be
found (are you missing a using
directive or an assembly reference?)
Version Information: Microsoft .NET
Framework Version:2.0.50727.3082;
ASP.NET Version:2.0.50727.3082
Note here it says version 2.0
did he just lie to me? or its my configuration mistake?
anyway, i added the reference, nothing changes.
I tried also publishing (Build, publish) with option to keep the pre-comiled site updatable, and I get one line saying:
this is a makefile and should be
deleted!
what is going on?
It looks like it can't find your DBML file, or your DBML file isn't called "DataClasses.dbml". Also, the .NET Framework Version is not lying. It is reporting the CLR version, which is still 2.0 for the 3.5 .NET Framework.
Related
Last week I created a ASP.NET 5 MVC project using VS.NET 2015 Preview. I then used NuGet to get the MongoDB driver (mongocsharpdriver) and I wrote some code and with that added some documents to the database. I started a new project today along those same lines but it wouldn't build. It says the type or namespace MongoDB can't be found even though I have intellisense for it. So I opened the original project and now that one won't build, same exact error. My project properties is set to target CLR, not Core -- that MongoDB library doesn't work with Core. Has anyone run into this problem and know how to fix it? I'm pretty sure I'm not going crazy.
All I do to reproduce the problem is start a new ASP.NET Web Application, then pick ASP.NET 5 Starter Web, then install MongoDB from NuGet, then add an import to it in the HomeController.cs. Then it complains about it not being found in Core, even though I'm not targeting Core.
This is the error when compiling following my steps above:
Error CS0246 The type or namespace name 'MongoDB' could not be found (are you missing a using directive or an assembly reference?) Bug.ASP.NET Core 5.0 HomeController.cs
As per my best knowledge ASP.net core 5.0 framework does not support many of existing Nuget library and assembly.
Go to project.json and remove ASP.net Core 5 from framework section.
The hosting provider for one of the web sites I manage has forced us to only be able to modify the site as a web project instead of as a web application. When it was initially a web application it was working fine, but after converting to a web site project I had many issues involving missing namespaces and references and was able to resolve them by placing all of my libraries inside of the top-level App_Code folder of the web site. I have one last issue with my linq-to-sql class - in Visual Studio the class is recognized now that it's in the top level App_Code folder, but when I call a page which references it I get the following error:
The type or namespace name 'LIFH_IntakesDataContext' could not be found (are you missing a using directive or an assembly reference?)
Initially there was no namespace whatsoever, but in my attempts to fix this I addded a "LIHS" namespace and placed the Data Context within that:
Here are the references for the site:
And here is the Build configuration:
And, here is my directory structure (Linq-to-SQL class is referenced in the circled "reports.aspx" page):
Code in reports.aspx:
Both the master page and the reports page are both in the LIHS namespace.
I am developing on Visual Studio 2012 and the application pool is set to .NET 2.0. The hosting provider does not allow anything above 2.0.
I have researched and found many references to my issue but most of them solve the problem by converting to a web application, which I cannot do, or by changing the target framework or by using a namespace, which I have done, but to no avail. I would appreciate any insight on this.
Pay Attention: Linq is only available in .Net 3.5 and later
If you are using .net 2.0 it wont work.
You can see it in your screenshot.
Hope it helps.
Mike
I'm new here.
I have searched this site for answers and I found a workaround, but I'd still like get the original problem solved. I have set the target framework to Mono/.NET 4.0 and I am using Mysql.Data.dll. It compiles fine, but when I am trying to run it on xsp2 web server on my laptop, I run into errors:
Missing method .ctor in assembly
/tmp/kari-temp-aspnet-0/eaee30a1/assembly/shadow/04e2c4cc/18848ad4_1c664e18_00000001/MySql.Data.dll,
type System.Security.SecurityRulesAttribute
Can't find custom attr
constructor image:
/tmp/kari-temp-aspnet-0/eaee30a1/assembly/shadow/04e2c4cc/18848ad4_1c664e18_00000001/MySql.Data.dll
mtoken: 0x0a00002a
Missing method
System.Threading.Monitor::Enter(object,bool&) in assembly
/usr/lib/mono/2.0/mscorlib.dll, referenced in assembly
/tmp/kari-temp-aspnet-0/eaee30a1/assembly/shadow/04e2c4cc/18848ad4_1c664e18_00000001/MySql.Data.dll
Here you can see that it is using .../2.0/mscorlib.dll. I have tried to create a new project, like this thread suggests Mono take mscorlib.dll 2.0 instead of 4.0 but it still does the same. If I set the target framework to Mono/.NET 2.0, I run into some other errors.
For the workaround, I renamed mscorlib.dll in 2.0 and then made a symbolic link to the same file in 4.0 directory as some post here suggested and it works, but I'm not happy with that.
Is there a way to manually edit a project configuration file to select a 4.0 target instead of 2.0? Should this be reported as a bug to MonoDevelop? I am using MonoDevelop 2.8.6.3.
This is how xsp works:
xsp2 => mscorlib.dll 2.0
xsp4 => mscorlib.dll 4.0
I'm using VS 2010 with ASP.net MVC 2.
I recieved a program that was completed and when I was debugging the program I recieve an error message.
"Error 4 The type 'System.Web.Routing.RouteTable' exists in both 'C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Global.asax.cs"
and
"Error 1 The type 'System.Web.Routing.RequestContext' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'c:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Controllers\AccountController.cs".
The program was converted into VS 2010 format.
What should I do?
// Fullmetalboy
When you convert a project from .Net 2.0/3.5 to 4.0 in VS2010 the web projects will prompt you to upgrade the framework to 4.0 but you will need to manually go into the project properties and upgrade class library projects and certain other projects manually in the project properties. So this type of error is probably caused by your web project referencing the 4.0 version of System.Web.Routing but a class library in your solution is still referencing the 3.5 version.
One of the projects in your solution is referencing a single type (RouteTable/RequestContext) in two different places. I always start with cleaning and rebuilding the solution, but if that doesn't fix it, you're going to have to check the project references and resolve it that way. If all else fails, try to make a new project from scratch and manually add the references and projects you need and then copy and paste your old code.
Someone copied the ASP.NET MVC source code into the "lib" folder of your application and either included that folder in the project (so it is getting built when you build your project) or he/she built it before you got it and referenced it from within the project. Now it is in conflict with the ASP.NET libraries that exist in default installation folder on the system 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll'.
Since you're using the .NET 4.0 Framework, the library System.Web.Routing is ambiguous. Make sure you have referenced System.Web.dll (version 4.0) and remove the reference to System.Web.Routing.dll
I had an ASP.NET 2.0 web project. Worked fine. I decided to upgrade the site to 3.5. The upgrade worked fine. I have added a IHttpHandler that required to include the following line in the web.config:
<add verb="GET,POST" path="MyOperation.asmx" type="MyClass"/>
This line in the web.config generates the following error: "Parser Error Message: Could not load type 'MyClass'."
This sounds like a typical spelling error in the class name. But it looks not, I checked it 1000 times. However, what is really strange that on the bottom of the "yellow-screen-of-death" page it says:
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
This is really strange. The project is set to 3.5. The only piece of code that use 3.5 features are the IHttpHandler implementation. All the rest of the web project are 2.0 compatible and works without problem if I exclude the line from the web.config.
Why is this?
[I did not try with IIS. I use ASP.NET development server.]
[EDIT] I have to apologize, it was stupid spelling issue as I expected in the first round. My IHttpHandler implementation was in a nested class and the proper class name is "OuterClass+NestedClass" vs OuterClass.NestedClass that I used in my config file. However, I thank to all who contributed because I learned new things on CLR versioning!
I think you need to use the fully qualified type name.
Like:
<add verb="GET,POST" path="MyOperation.asmx" type="Your.Namespace.MyClass, assembly.name"/>
and the error containing the version information of 2 is normall since the CLR hasn't changed for 3 and 3.5. the only changes were additional sepperate assemblies and syntactic suggar (like automated properties are a feature of the compiler not the runtime) ".net 4" will come with a new CLR.
The version is not an issue ( I think). .net 2 to 3.5 sp1 use the same run time. The newer ones are just new libraries and compilers. So from the asp.net point of view not much has changed.
ASP.NET 3.5 is really 2.0 with extra extensions. So, as long as the server has 3.5 installed, then the message that shows that you're pointing to the 2.0 framework confirms that you have it setup correctly.
The issue is likely what olle suggested, that you need the full class name, assembly name.
Also confirm that you have the dll in your /bin folder and that it's marked as an application if you're not working from the root of your site.
Go to the project properties. Choose the Application tab. Change the Target Framework to .Net Framework 3.5 if you haven't done that already.