Converting ASP.NET app to Mono without .csproj and .sln - asp.net

I have an ASP.NET application which I'd like to try running on Mono, just as an experiment. When I bring the application as it is to Mac, start xsp2 on the directory, it runs as I would imagine it should. That is, it crashes on because of the file system path differences (\ vs / in directories).
This is where I would like to open it in MonoDevelop and fix the problems. But since it was website, it doesn't have .csproj file. And it seems that there's no .sln file either, since Visual Studio stores those to some random directory by default. In Visual Studio you could open the project with Open -> Web site... -> Local IIS etc., but I see no such thing in Mono.
Is there a way to open a directory as a web site or somehow generate the .csproj file? I would prefer an answer which won't need Visual Studio or even Windows to help me with that.

Create new project in MonoDevelop in the same directory as your files.
Right click the project in the solution window
Choose Display Options -> Show All Files
Right click a file and choose Include to Project
You can select multiple files at a time (shift or ctrl click) and include them all at once, or include full directories.

Unfortunately you can't open WebSites in MonoDevelop. WebApplications are supported in MD, but WebSites aren't. Michael promised yesterday that he will explain why, you can ping him to touch this topic quicker.
Some more information is available:
http://mjhutchinson.com/journal/2008/08/15/web_application_projects_md_and_vwd
http://mjhutchinson.com/journal/2007/06/04/rethinking_asp_net_project_models
http://mjhutchinson.com/journal/2006/06/10/asp_net_project_models
Probably, in the long run, the best solution for you will be to migrate from WebSite to WebApp.

One option to avoid changing your application settings is to use Mono's built-in path remapping feature, basically do this:
$ MONO_IOMAP=all
$ xsp2
For more details you can read:
http://www.mono-project.com/IOMap

Create a new project in MonoDevelop and import the files into it.

Related

Beginner : Where to copy the asp.net dll file from visual studio?

I can easily write an asp.net code. I hit the visual studio RUN button and I see my website in Chrome or any other browser. But how do I do this without visual studio? I don't get an exe file, only the dll. I think, this must be copied somewhere.
Idea is to run (any) programm, which causes a special page to show my website (with OPC-data) on a local computer. Like an exe file.
To give more detail: I want to run some Web site code in a CEF (chromium embedded framefork) so that it looks like a normal executable. It will run only on a local computer (in fact a machine). This is static. But some information have to be provided dynamically by an OPC client. This will be read with VB and displayed via ASP.NET. The first application reads the data via AJAX. So I think what I need is some kind of local server (like wamp) which has to be started in the background. I found a batch file to start WebDev.WebServer40.exe. But this could not be the right way. A batch file sounds like stone age.
-->c:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0
You have IIS Manger installed, yes? If not, you can go to Control Panel \ Programs and Features and turn this Windows feature on. From within IIS, find the Default Website node and underneath that create a new application (this way it inherits the correct permissions). Point the application's start path to wherever your web app lives on your hard drive (the root folder that contains your app's web.config file). Anyway, that's one way to deploy your app locally.

VB.NET Application - Open website vs project file acts differently

I noticed one weird thing today, and I'll appreciate your input on this.
I was assigned to work on a VB.NET project. I took the project files from the server locally.
I opened Visual Studio and then did open project, the project loaded in the solution and I did build, I got errors, pls check screenshot:
http://gyazo.com/3fe2ea4d5ff8fd073355d43160861e70.png?1348166929
2nd try, I opened Visual Studio and instead open project, I did open website, I selected the folder where the files are located and then open website. I build the solution, it says build succeded and the website runs fine in the browser.
Now I want to know why that's happening, why when I am trying to open as a project I am getting errors, and when I am opening as a website, website starts ok.
Thanks in advance, Laziale
In VS, Projects and Websites are different - a Project is a collection of files managed by a *.proj file (e.g. *.csproj, *.vcproj, *.vbproj), whereas a Website is just a filesystem folder without much in the way of project management metadata.
The second main difference is that Websites have a different Build process - unless you explicitly opt-in to pre-compilation the project is not compiled at design-time, instead everything is compiled by the webserver at runtime, which means you need to distribute all of your source code.
It also means that compile-time errors are harder to detect. You will get the same errors in a Website as in a Project, it just means you need to perform a live website action that uses the same error-prone *.vb files, and you'll get a lovely YSoD error then (rather than in the IDE before you publish it).
"Websites" were introduced in VS2005 as an "easier" alternative to VS2003's ASP.NET Web Applications, but there was a lot of backlash from developers - I wouldn't be surprised if they removed it from a future VS release.

ASP.NET Proper Deployment Procedure

The web application that a company I'm doing consulting for has all the web files (.aspx, .vb, .ascx, web.config, etc.) but no .sln files or anything of that sort to open in Visual Studio and deploy the site and whatnot.
What's the best way to go about using Visual Studio to redeploy changes I make to this type of system?
As the comments have stated, it's likely a web site project (likely I say) and you can use the Open Website option within Visual Studio.
Either that, or you could just use the command line and publish it locally before deploying it somewhere...from the msdn documentation, it might be something like this:
Aspnet_compiler -p "C:\Projects\SomeWebProject\" "C:\Temp\LocalPublishFolder" -errorstack

Making a website/project Portable - Check List

Good evening/morning/after/noon.
I have an ASP.net 3.5 website and I am using vb.net in VWD 2008 Express, I am also using MS SQL Server 2008 Express, I used ajax tabs and a textBox characters counter control developed by https://web.archive.org/web/20211020202742/https://www.4guysfromrolla.com/ The database is attached with MS SQL Server Management Studio Express and the files are stored in the SQL default "Data" folder.
The whole project's code and forms are stored in a folder in my E drive. I need to hand the whole project to another coworker who have to finish it, please describe in steps how can i make my website portable (like i can put it all in a folder that he can carry around in his flash disk).
One more thing, I already finished my side of the project, I need to ship it out to this other programmer.
Can anyone suggest something like a: Checklist or Must Do list to achieve this?
PS: I have had a problem trying to move the project from one server to the other, the project seems to look for the dlls of the AJAX control and the textBox counter where i originally unzipped the folders in which they cam in, which i think was on my desktop, although when i added those controls to the Tools tab, i created a new tab, then i choose the dll from the where i unzipped the controls source code, aint that enough?
Thanks in advance
I use the following folder structure for all my solutions
solution
docs
libs
scripts
sql
src
docs - contains all documentation
libs - contains all non GAC'ed framework dlls that the solution uses. You should copy the dlls in here first then reference them this way they are a relivive reference from the src folder.
scripts - build scripts for designers who don't have VS installed and the build server
sql - all sql scripts for creating your database
src - all source for the solution we break this folder up into the following file/folder structure
solution.sln
project1
project2
website1
website2
etc
Now when you copy the solution folder everything is relative so will work.
I'd advise that you add your project to source control, I'd recommend Subversion/SVN and the TortoiseSVN client

How can I use the "Publish" function in Visual Studio 2008 without erasing the contents of the target folder?

When I use Build->Publish Web Site in Visual Studio 2008, most of the time it compiles the site, and then simply asks me "All files in the target folder will be deleted. Continue?" (or something to that effect). On occasion, however, when publishing a project in Visual Studio, I would get a dialog box that would give me the choice of replacing the folder's contents completely, or simply replacing changed files with newer version.
I much prefer to publish without completely obliterating the folder, because the deployed application creates user files and cache files as it's been used that I don't want to take extra steps to preserve. However, I'm not sure why Visual Studio doesn't always give me this option. Is this a setting somewhere I can change? Is it tied to the version of .NET I'm using?
Any insight is appreciated!
Edit - Followup on 2009-01-20
I still haven't figured this out, but here's some more information.
Here's what the publish function looks like for one ASP.NET project on my Win XP desktop:
And here's what it looks like for a different project on my Vista laptop:
Notice the radio buttons in the second screenshot that allow me to choose to either delete the contents of the folder prior to publishing, or merely to overwrite matching files. I'd like to have these options for every project.
Both computers are running Visual Studio 2008 Professional (version 9.0.30729.1 SP, according to Help->About). The exact same version. And I doubt the OS difference is causing this functionality change. It's got to be a setting somewhere, right? Does anyone know?
John is right, the only difference is one of your projects is a Web Site Project and the other is a Web Application project. You will not see the "convert to web application" option unless you are in a Web Application project. I know... it is very misleading. The reason behind this stems from the the way you convert to a web application project. If you plan on converting it(which can be a real pain in arse, depending on how it is set up) then you need to be aware of a few differences:
In a Web Application project everything is pre-compiled all the codebehind pages will be compiled into a .dll ---- In a Web Site Project nothing in the project is pre-compiled, the compiler will compile everything to ensure it is valid but none of the compiled pages are uploaded. When a user first attempts to access the site each page is compiled into its own dll. This means in a Web Site Project you are able to upload a single codebehind file.
Namespaces - In a Web Application project namespaces are created by default in a Web Site Project they are not. So you may have to spend some time adding them if you plan on converting them.
Project files - you will notice that A Website Project does not have a "cproj" file a Web Application project does.
I have converted a few of these project I find they go fairly smooth as long as there is not a lot of code in the "app_code" folder. You can give it a try and see how easy it is, if it looks like it is going to be a pain, I would suggest FileZilla just FTP it and save yourself some headache.
Good Luck
That dialog is different for Web site projects and Web application projects. In my MVC projects (Web application projects), I see the additional options. In my regular ol' web site projects, I see the first dialog posted.
Not sure if this option will be suitable for you but you could use the copy website function from the solution explorer. Click on the "Copy Website" icon at the top of the solution explorer.
I think the real answer to your question is that you should put your user files and cache files somewhere else.
When publishing a web site Visual Studio is designed to make sure that the target folder contains your web site files, and absolutely nothing else.
Apparently this feature is coming in VS2010 - that's what Vishal Joshi announced at TechEd EMEA in session "PDC307: Microsoft Visual Studio 10: Web Development Futures"
The site has been updated from the site in the updated layer.

Resources