How to target .NET 4.0 under mono
I have mono 2.10 installed which is said to support 4.0 i have a site running, a simple hello world that is built (i develop in on a windows box with vs 2010 and then upload to a linux box) with 3.5.
I want to put the site under 4.0. I changed it on visua开发者_Python百科l studio and on the windows box it works. on linux i have the error
Unrecognized attribute 'targetFramework'
SO, which steps are needed to change the target from 3.5 to 4.0?
EDIT: Am not using monodevelop.
Am creating the site on a windows machine with visual studio and then copying the entire website folder to the linux box. After that i open the site url and thats it.
WHen should i run the dmcs compiler? AFAIK the site is compiled automatically when it runs for the first time ?
Although it is correct that you use dmcs
to compile .NET 4 apps on Mono, I do not think that this is your problem. It sounds to me like you are trying to serve a compiled ASP.NET app on Linux.
Your problem is probably that you need to call mod-mono-server4 from Apache but are likely running mod-mono-server2. You should have a line in your httpd.conf or mod-mono.conf that looks like the following:
MonoServerPath default /usr/bin/mod-mono-server4
Check out this page, specifically the troubleshooting section. The instructions are a little dated so you have to change the digit '2' to '4' but it is a good explanation of what is going on. This page might also help you setup the right configuration.
Using mono 2.10, you either run dmcs
or gmcs -sdk:4
when compiling your code.
精彩评论