publish asp.net website into single dll file - asp.net

I got a asp.net website from my client that need to be modified. The problem is that the old company was uploading the project as a release which means no code but a sinlge dll file.
We can make a single dll file the project type is web application not a website!!
Can you adivse how to publish sinlgle dll fiel.
Regards,
Moayyad

If you want a single DLL, then convert your website into a web application. Once you convert, everything inside your project will be compiled into a single DLL file.But still, any external assemblies will be inside their own DLL files.

Related

how can I add the reference to a third party library when the web application is already in the webserver

I am working on a web application built with vb.net and asp.net. the web application is already stored in the web server. I am creating some new features in the web app.
If have to include new third party library (e.g; itextsharp etc) in the project how can I add reference to the dll files in the web server?
Will it work if I just copy the dll files in bin folder (in the web server)?
Add your dll file in bin folder and it should work properly.Adding third party dll is same as your own dll jsut add it in bin folder and reference it in your page where you will need it.

It is only able to refer the class files inside App_Code folder in a file in ASP .NET website application

Only the class files inside App_Code folder is able to refer in a file in ASP .NET website application. Why its so?
Only the class files inside App_Code folder is able to refer in a file in
ASP .NET website application. Why its so?
The answer is very simple Website application working as designed.
App_Code folder is a special ASP.NET RUNTIME folder.Any files in this folder are compiled by ASP.NET when your site is actually running on the server.
This essentially allows you to drop random class/code files in this folder to be compiled on the server side. For this very reason if you drop something new into the App_Code folder of your running web site, it is like resetting it coz ASP.NET runtime now recognizes that there is a new class which needs to be kept in consideration during running the site. This magical folder brings with itself various connotations when it comes to different project typescourtesy
ASP.NET decide at runtime which compiler to invoke for the App_Code folder based on the files it contains. If the App_Code folder contains .vb files, ASP.NET uses the VB compiler. if it contains .cs files, ASP.NET uses the C# compiler, and so on...
You can refer the following resources too.
Web Application Projects versus Web Site Projects
Shared Code Folders in ASP.NET Web Site Projects
There's a difference between ASP.NET WebSite and ASP.NET Web Application. It appears that you created a WebSite in which code files are stored the App_Code folder. If you create a web application you can place the code wherever you want an they will be compiled to assemblies that will be copied to the bin folder. This way you don't need to deploy your source code on the web server.

asp.net single file publish

i have publish my website. using publish website in vs 2008.
Now i want to update a single file.
So do i need to recompile the whole web-site and upload it to the server again, or i will just publish this single file and upload it to the server.
if i can compile a single file then how to do it, also how to update it to the server?
Depends on whether your web project is a web application project or web site project. If its a web site, then you can just copy your updated file to the server and ASP.NET will recompile it for you.
If your web project is a web application project, and you made changes to the code behind, you'll need to recompile the project, and redeploy the DLL.
Also, if you're just updating an ASPX page (not the code behind, ASPX.cs), you should be able to deploy it without compiling.
If you frequently update your website, I recommend to Check
Use fixed naming and single page assemblies checkbox.
This will generate seperate DLL for each code behind page,
Although you have to compile full project but you can upload only relevant file.
This is very helpful in case if many people are working in single project, everybody can change in their respective .cs file and publish their .cs file's DLL , this will not affect other people's DLL and thus functionlity will not break, unless DLL's or codebehind clashes with each other.

ASP.NET Without Project File

I've got a ASP.NET project without the .proj file. How do I recreate the project file, so I can work on it on my machine?
Is this possbile?
Are you sure it's not a Web Site Project, as opposed to a Web Application Project? Web Site projects do not have project files - you open a folder rather than a project file. See here for the differences between the two.
To check, each page of a Web Application project will have a .aspx, a .aspx.cs and a .aspx.designer.cs, whereas the Web Site project pages don't have the designer files.
You can create a new project and then you can use the "Add Existing Item" and add each of your files (you can select multiple files).
EDIT:
Or your can drag and drop the files into the "Solution Explorer"
First of all, you need to run VS2005 SP1 or later. In VS2005, they removed the project file. They reintroduced it again in SP1.
If you don't have a project file, your project is called a "Web Site". If you have a project file, it's a "Web Application". One difference between the two is also that in a web application, you compile all code-behind files to a single .dll. In a web site, each code behind file goes in its own dll (or are compiled dynamically at runtime)
I believe that if you right click the project in solution explorer, there is a "Convert To Web Application" menu item.
Note, you must rename the App_Code folder to something else, otherwise it will be compiled both at compile time, and at runtime.
Personally I much prefer web applications to web sites

VS2008 Web Deployment Project Section Replacement with Elmah

I'm using a web deployment project and want to do some section replacement with the emlah/errorMail section. I don't want to send emails in debug build mode.
I have created the custom section and put it in an errorMail.config. In the properties of web deploy project under replacements, I have elmah/errorMail=errorMail.config.
The error I'm getting is An error occurred creating the configuration section handler for elmah/errorMail: Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified.
I'm guessing this is happening because Elmah is not in the GAC or it's not one of my projects. The Elmah.dll file does copy to the output\bin folder just fine though.
Is there a way to have section replacements work with 3rd party dlls?
[EDIT]
I found that if I drop the dll in question into the project folder for the web deployment project, that it will work fine. This is less than optimal.
So now my question is, how can I get this to work without having to put the dll in the GAC or having to copy the dll into the web deployment project folder?
If you add a reference to the elmah dll from your webproject, then it will automatically copy the dll to the output folder when you build it.
Those are the only 2 options though: to have the dll copied to the output directory or to put it in the GAC
A technique proposed here dynamically loads an assembly during the web deployment build process so that it doesn't have to be in the GAC. I tried, but was unable to get it to work, though.

Resources