ASP.NET to Mobile - ios

Right now I am developing a website in visual studio using ASP.NET and C#. Is there any easy way to turn it into an application where iPhone users can get it on the app store. I heard something about Xamarin(monotouch), but I did not really understand exactly what it did.

No. Xamarin is a framework that lets you write Apps for iOS and Android using C# and accessing the native API frameworks. It does not allow you to simply port any .NET app to a mobile platform.
You can use responsive design to allow your ASP.NET site to work with both desktop and mobile browsers. See http://www.asp.net/mobile

As Jason wrote Monotouch enables you to build native applications. If you would choose a single page application approach you would be able to put the output in PhoneGap to publish it to the AppStore/Google Play.
That requires a bit of different thinking and doing, as you can't rely on the classic model with controllers/views and hard links.
However, it is still possible and I did it already for a project. I have an ASP.NET MVC application with Razor etc. as foundation, so I can easily manage the different "pages", dozens of different script files etc. However, all pages are Parial Views rendered within one single page. The nice thing about is, that this application works in each browser and is testable, too. To get it additionaly in an app container, we wrote a little tool that grabs all the output of that single page and converts it to a static HTML file, copying and referencing all the images, stylesheets and scripts, too.

Related

Ant Design antd vs antd-mobile for non-native mobile web development

Reading about Ant Design I am getting confused about which library to use for mobile web development. There are two libraries, antd and antd-mobile. While it is clear that antd-mobile supports react-native on iOS and Android, it is unclear which one is best suited for plain mobile (non-native / SPA) web development.
Reading the antd introduction you see statements like "Ant Design which is specially created for internal desktop applications, ...", while reading the antd-mobile introduction you will see "Support Web / iOS / Android platform (Based on React Native)"
From this I would think that ant is somehow not very suitable for web development other than web based desktop (i.e. Elektron) apps.
But trying to build a normal web app with ant-mobile I couldn't get it to work. For example the Button is showing but DatePicker is not. Switching to ant everything seems to work fine.
Am I right to assume that for any non-native mobile development you need to use ant instead of ant-mobile?
If so, what is this supported "Web" platform that antd-mobile is mentioning?
From my experience:
Antd:
Intended for full browser web only (or electron) development, they are no mobile first design, some cases you have to tweak to make you web page look good in mobile.
Antd-mobile:
Antd mobile exports 2 versions of components, the web one (which uses DOM) and the react native version (uses View, Text etc...)
Web version: You can think it's like jQuery Mobile, Sencha Touch etc, it's intended to build pure mobile web page/application, the application that you are going to see in a mobile browser. example, go and open facebook.com, amazon.com with a mobile browser (they look really different then the desktop one).
React Native version: You will use this to build a Mobile App (a hybrid app) that sits in Google Play store/App Store, an app that needs to be installed.
Hope it helps.
If I made mistakes please let me know.

I need to deploy source ASP.NET MVC code on Azure websites, and for it to run

This may be a terribly simple question, but....
I am using MVC3, Razor, C#, ASP.NET4.5/SQL Server 2008 and deploying to Azure Websites & SQL Azure.
I need to copy all of my source code, without compilation, from my web application ie model source, class libraries and views. All additional projects such as Entity Framework DAL projects will remain as a DLL. However I do not wish to have a web application DLL since I need to edit C# code in situ, and have the site run using this code, no doubt using the JIT compiler.
The main reason is because I am doing some integration work and the 3rd party site sends a return url back, and "Localhost" is not very accessible to the outside world, so wish to use my Azure website instead.
So can I copy my web application code as source, and if so is it a matter of copying all the C# files up and removing the web application DLL?
Thanks in advance.
EDIT
Further thoughts. Azure Websites provides a container for the Worker process to operate which hosts the Application DLL which is P-Code which is then dynamically compiled to native code. So I am not sure if one can start with a source C# file like one can with a Razor View.
EDIT2
Or do I need to make the changes on my Local machine and keep republishing to Azure Websites to test the integration? A little long winded...
MVC Sites must be Web Applications, they cannot be on the fly compiled. Sorry, there is no way around this. You must compile your code into a DLL for it to run if you want to use MVC.
The reasons for this are many, but a big one is that the "on the fly" compilation model used by ASP.NET Web Site projects does not use namespaces, and namespaces are very important to the operation of MVC.
Another issue is that MVC depends heavily on static assembly references, which is also not the case in Web Site projects.
In general, ASP.NET Web Site projects are poorly supported, have a lot of issues that make them unsuitable for larger projects, and even more unsuitable for use with more advanced frameworks.

Solution for web designer using an OSX to develop an ASP.NET MVC project?

The project is developed using ASP.NET MVC framework and heavily relies on .NET 3.5.
What would be the best solution to allow a web designer, who is using OSX, to develop the site's UI? Basically he would just need to edit the aspx, css and js files, but also run the web application locally.
I've thought of some possibilites:
Install parallels/vmware/bootcamp and set up everything as you would for windows. Bad: it would be slow, OSX user doesn't like working in windows
Set up Mono and run the webapp on that. Use whatever tool you want for editing the front end files. Bad: does mono support MVC framework, .NET 3.5 and database connections? Unfamiliar platform, so possibly a lot of work setting it up, if it even will work.
Run the site on a separate server, and edit the front end files via network drive. Bad: our development server is so slow that seeing the changes takes too long...
Do you have other ideas or comments for these options?
Thanks!
You could try using a virtual machine. VirtualBox is a free one and is quite simple to setup. The only downside is that you need your own copy of Windows...
What you really need to do is have your web designer mock up the pages in static HTML, CSS, and JavaScript first (in their environment of preference.) Once that's done, adapting the markup to the ASP.NET project should be easily doable by yourself or the designer on a Windows machine (or virtual machine, your preference).
The MVC framework is part of Mono. Ares Technica has an article about the MVC framework and running it on Mono.
While it seems that some people were able to hack the framework to work on Mono back in March and April of this year, Microsoft has since released the MVCframework as open source and it is now fully supported by Mono as of the 2.4.2 release.
Here is a link to the most recent Mono releases along with Virtual Machine images that already been pre-configured to give you the best development experience.
Good luck with your project and hope this helps some.

Multiple web projects, (almost) same layout in Visual Studio

Im currently developing an application with two web projects (MVC):
Frontend
Backend
These two are going to have almost the same layout (few minor changes). Therefore I thought about creating a MasterPage, they can share. But since it's two projects in two different locations, where should I put the masterpage, images and javascript?
The images and javascript (static stuff), could be placed on a CDN.
But how 'bout the ASP.NET specific stuff? Any suggestions? Any help appreciated!
A MasterPage is a UserControl under the hood, so any method of sharing UserControls would work for MasterPages. Unfortunately this isn't that great of an experience in ASP.NET as the BuildManager (what compiles and connects the app paths to classes during build-time) only recognizes & processes files within the current project.
Sharing code-behind, or base classes is easy and works well. It is the design surface (.master, .ascx, .aspx) that doesn't have a lot of ability to be shared. You can use a deployment project to compile a web app project into an Assembly that can be referenced, but you will still need some design files in your actual project.
This might also be of help:
ScottGu: Creating and Using User Control Libraries
SO: How do I share user controls between web applications in ASP.NET?
It's possible to include an existing file from another project in a new project. You can do that. So just put it in one project and include it in the other.
Alternatively, you can create a 'core' library, and put things in there, but that doesn't 'play' well with controls and so on, so I'd recommend the first approach.

Can you convert an ASP.NET MVC Application to a Web Site using ASP.NET MVC and what problems might you run into?

I would like to use a WebSite project instead of a Web Application project for an MVC project.
What is the best way to accomplish this and are there signifigant problems that I might run into?
(as a side note, my reasoning for wanting this is because I have graphic designers who put files into SVN but they don't get added to the "project" and don't show up on deployment or deployment testing. My thought was that switching to a Web Site project might prevent this)
You don't need to do anything special if you are not using CodeBehind files (if you're using them, it'll be more complex but anyway, it's an MVC app. If you're using them, don't!). Just take an MVC Web app project and put all source files (*.cs) under App_Code directory of the Web site. That said, I fail to see any advantage for it.
The application project allows you to use the Models folder to embed classes into. This would then be compiled for that web project. A web site does not provide for this directly. It would require that you use an assembly project to maintain all of your classes. Rather than converting from one project type to another (which I am not sure how you wold go about doing that) you can simply attach an assembly project to your web application and not store any classes in the model folder of your application.
Having said this, you should keep your web project as an application as there usually are view specific classes that are required such as a your view model classes that belong in the web project.

Resources