Re: [Mono-aspnet-list] Mono ASP.NET vs MS VS

2014-09-28 Thread Fernando Rodriguez
On Friday 26 September 2014 3:34:50 PM Chris Rogus wrote:
 1) If there is something easy and obvious that I am missing in my config,
 please let me know.  (e.g. the global or Views web.config files are
 different between MS VS and Mono, for sure, but I am not an expert with
 these files to know exactly what is needs to be changed in the MS VS one,
 if anything, to fix this situation)

 2) Otherwise, any advice on how I could figure out exactly where this error
 is coming from?  What dll is missing or what line in my config xml is not
 right, etc?  How can I debug an ASP.NET application in Mono -- using xsp4
 or monodevelop anything else?

I could never get MVC5 to work on Mono but if you don't use any of the new 
features in MVC5 you can just rebuild your app on MonoDevelop referencing the 
System.Web.Mvc.dll version 4 from Microsoft and it should work, here's what I 
did to get it working:

1. Download and install MVC4 if you haven't already.\

2. Open your VS2013 project in MonoDevelop on Linux and change the 
System.Web.Mvc reference to the one that ships with MS MVC4. Make sure the 
copy local checkbox it ticked.

3. Change the System.Web.WebPages.* references to the version 3.0.0 that comes 
with mono. I copied them from the GAC to a directory on my solution tree and 
added the reference from there checking copy local. On the latest version of 
MonoDevelop if you add it from the GAC or the framework directory and tick 
copy local it will copy a lot of stuff that will break your app.

4. Change both Web.config files so that all references to System.Web.Mvc use 
version 4.0.0.0 and all references to System.Web.WebPages use version 3.0.0.0.

5. Build and run the solutiion on MonoDevelop. It should work.

When you scaffold an edit view with VS2013 it will add the css classes to the 
Html.EditorFor, MVC4 ignores it so the form controls are not formatted for 
bootstrap, my solution was to use jQuery to set the css class. Also VS2013 mvc 
template references site.css but the file is called Site.css, you need to fix 
this so it works right on XSP.

The Web.config files that VS created for me are called Web, not web so you'll 
probably have to rename yours.

 
 3) What do I need to do to get an ASP.NET solution created in MonoDevelop
 to open in MS VS?  (Hopefully this is the same solution as getting my MS VS
 ASP.NET site to work in Mono/xsp4.)

I created my solution in Visual Studio and it opens in both. I've been mostly 
working on Linux but if I need to work on VS I need to change the assembly 
references back.

 4) Any advice on where Mono might already have a Publish feature like MS VS
 has in MonoDevelop?  Or else where I should go add one if no such feature
 yet exists, if it acceptable to the team in charge of this product (I don't
 want to do it, submit a pull request and be told it is an undesired
 feature).  Such a feature would very helpful for me.

Project  Deploy to Web... (on Version 5.0.1). It can only deploy to a local 
directory or network share.

-- 
--
Fernando Rodriguez
frodriguez.develo...@outlook.com
___
Mono-aspnet-list mailing list
Mono-aspnet-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list


Re: [Mono-aspnet-list] Mono ASP.NET vs MS VS

2014-09-28 Thread Michael Lynch
mngadlban


On Mon, Sep 29, 2014 at 7:47 AM, Fernando Rodriguez 
frodriguez.develo...@outlook.com wrote:

 On Friday 26 September 2014 3:34:50 PM Chris Rogus wrote:
  1) If there is something easy and obvious that I am missing in my config,
  please let me know.  (e.g. the global or Views web.config files are
  different between MS VS and Mono, for sure, but I am not an expert with
  these files to know exactly what is needs to be changed in the MS VS one,
  if anything, to fix this situation)
 
  2) Otherwise, any advice on how I could figure out exactly where this
 error
  is coming from?  What dll is missing or what line in my config xml is not
  right, etc?  How can I debug an ASP.NET application in Mono -- using
 xsp4
  or monodevelop anything else?

 I could never get MVC5 to work on Mono but if you don't use any of the new
 features in MVC5 you can just rebuild your app on MonoDevelop referencing
 the
 System.Web.Mvc.dll version 4 from Microsoft and it should work, here's
 what I
 did to get it working:

 1. Download and install MVC4 if you haven't already.\

 2. Open your VS2013 project in MonoDevelop on Linux and change the
 System.Web.Mvc reference to the one that ships with MS MVC4. Make sure the
 copy local checkbox it ticked.

 3. Change the System.Web.WebPages.* references to the version 3.0.0 that
 comes
 with mono. I copied them from the GAC to a directory on my solution tree
 and
 added the reference from there checking copy local. On the latest version
 of
 MonoDevelop if you add it from the GAC or the framework directory and tick
 copy local it will copy a lot of stuff that will break your app.

 4. Change both Web.config files so that all references to System.Web.Mvc
 use
 version 4.0.0.0 and all references to System.Web.WebPages use version
 3.0.0.0.

 5. Build and run the solutiion on MonoDevelop. It should work.

 When you scaffold an edit view with VS2013 it will add the css classes to
 the
 Html.EditorFor, MVC4 ignores it so the form controls are not formatted for
 bootstrap, my solution was to use jQuery to set the css class. Also VS2013
 mvc
 template references site.css but the file is called Site.css, you need to
 fix
 this so it works right on XSP.

 The Web.config files that VS created for me are called Web, not web so
 you'll
 probably have to rename yours.

 
  3) What do I need to do to get an ASP.NET solution created in
 MonoDevelop
  to open in MS VS?  (Hopefully this is the same solution as getting my MS
 VS
  ASP.NET site to work in Mono/xsp4.)

 I created my solution in Visual Studio and it opens in both. I've been
 mostly
 working on Linux but if I need to work on VS I need to change the assembly
 references back.

  4) Any advice on where Mono might already have a Publish feature like MS
 VS
  has in MonoDevelop?  Or else where I should go add one if no such feature
  yet exists, if it acceptable to the team in charge of this product (I
 don't
  want to do it, submit a pull request and be told it is an undesired
  feature).  Such a feature would very helpful for me.

 Project  Deploy to Web... (on Version 5.0.1). It can only deploy to a
 local
 directory or network share.

 --
 --
 Fernando Rodriguez
 frodriguez.develo...@outlook.com
 ___
 Mono-aspnet-list mailing list
 Mono-aspnet-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-aspnet-list

___
Mono-aspnet-list mailing list
Mono-aspnet-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list


[Mono-aspnet-list] Mono ASP.NET vs MS VS

2014-09-26 Thread Chris Rogus
Hi, I am trying to build an ASP.NET website in C# using Razor templates in
MS Visual Studio that will then run in Mono on Linux.

I have never attempted to run an ASP.NET site with Mono before now, and I
only played with MonoDevelop briefly when I last explored Mono a couple
years ago.

I have mono-complete and mono-fastcgi-server4 installed from Xamarin's deb
on my Xubuntu 14.04 desktop VM (running in VirtualBox): sudo
add-apt-repository 'deb http://download.mono-project.com/repo/debian wheezy
main'  # etc

When I use Xamarin Studio 5.4 in Windows 7 (downloaded 5.0.1.3 from
monodevelop.com and then upgraded in-app) to create a new solution of type
C#  ASP.NET  ASP.NET MVC Razor Project, and then copy the bin dir,
Views dir and Global.asax + Web.config + package.config files into my Linux
machine's /var/www/ directory, and finally run xsp4 there, everything works
fine.  Fine here meaning that I open localhost:9000 and see a simple page
that says: Welcome to ASP.NET MVC 5.2 on Mono!  (Note that I can also
accomplish this with nginx + mono-fastcgi-server4.)

When I then use Visual Studio 2013 Professional Update 3 in Windows 7 to
create a new solution of type Visual C#  Web  ASP.NET Web Application 
Empty  check MVC, and then copy from the Xamarin solution I just created
(for demo purposes): Controllers/HomeController and all the contents of the
Views dir except Web.config (note that MS VS uses web and Mono/Xamarin
uses Web, if ever that might matter).  I then right click on the project
in MS VS and then Publish  Custom  (name it)  Publish method: File
System  Target location: (somewhere).  Once that is published locally, I
will then copy that dir into my /var/www in Linux and finally run xsp4
there, where I see this error displayed in the browser when I open
localhost:9000 :

System.InvalidCastException
Cannot cast from source type to destination type.

Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or
object): System.Web.WebPages.Razor.
Exception stack trace:
at System.Web.WebPages.Razor.WebRazorHostFactory.GetRazorSection
(System.String virtualPath) [0x0] in filename unknown:0


Version Information: 3.8.0 (tarball Thu Sep 4 12:24:26 UTC 2014); ASP.NET
Version: 4.0.30319.17020


Additionally, if I try to open the Mono solution in my MS VS, it fails to
convert it, with an error:

C:\Users\Chris\Documents\Visual Studio
2013\Projects\MonoSite\MonoSite\MonoSite.csproj : error  : The imported
project C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets
was not found. Confirm that the path in the Import declaration is
correct, and that the file exists on disk.  C:\Users\Chris\Documents\Visual
Studio 2013\Projects\MonoSite\MonoSite\MonoSite.csproj


Now, I am an experienced C# developer and used to do C and C++ once upon a
time, so I would like to contribute / help myself here:

1) If there is something easy and obvious that I am missing in my config,
please let me know.  (e.g. the global or Views web.config files are
different between MS VS and Mono, for sure, but I am not an expert with
these files to know exactly what is needs to be changed in the MS VS one,
if anything, to fix this situation)

2) Otherwise, any advice on how I could figure out exactly where this error
is coming from?  What dll is missing or what line in my config xml is not
right, etc?  How can I debug an ASP.NET application in Mono -- using xsp4
or monodevelop anything else?

3) What do I need to do to get an ASP.NET solution created in MonoDevelop
to open in MS VS?  (Hopefully this is the same solution as getting my MS VS
ASP.NET site to work in Mono/xsp4.)

4) Any advice on where Mono might already have a Publish feature like MS VS
has in MonoDevelop?  Or else where I should go add one if no such feature
yet exists, if it acceptable to the team in charge of this product (I don't
want to do it, submit a pull request and be told it is an undesired
feature).  Such a feature would very helpful for me.


Thanks!

---
Chris Rogus
___
Mono-aspnet-list mailing list
Mono-aspnet-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-aspnet-list