Where is the compiled dll for a Website project - asp.net

One query regarding a Web-Site project in Visual Studio -
I did following steps -
Created a WebSite using VS 2010
Added a custom class in App_Code folder and consumed it in default.aspx
Run the application and I can see the result
Any changes made in server code are reflected on the browser without doing any recompile (website feature)
So, when dynamic recompilation takes place for a web-site, somewhere .net run-time will be storing the compiled dll, isn't it?
Can anyone please guide where I can find the dll being generated during dynamic build are stored? (I just want to know this out of curiosity :-))
Thank you!
P.S. I also did a 'Publish Website' and I can see a bunch of compiled dlls in the publish folder. So, my Question is only regarding dynamic build.

The dynamic created files for your web site are stored on
c:\WINDOWS\Microsoft.NET\Framework\version\Temporary ASP.NET Files\
You can change this directory on the web.config. The asp.net check if any file change on your site and if can find any changes is start the recompile. Also many parameters of the recompile can change on web.config.
How to change this directory
<compilation tempDirectory="" ...>
and this is the rest of the compile options: http://msdn.microsoft.com/en-us/library/s10awwz0(VS.100).aspx

You may find the name & location of Code Gen Directory via property of HttpRuntime.CodegenDir programatically.

Related

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.

What ASP.NET MVC project files should I not add to Subversion

this is likely a naive question, but I want to do this right the first time.
I have a MVC solution which has the following:
Data project - C#
Services project - C#
MVC Web Project - ASP.NET MVC
Test Project
Currently, I am using the MVC2 source as a means to debug my own code. I do not plan on checking that in, but I realize once I go back to the MVC2 DLL, my solution will change.
I'm pretty sure I just shouldn't check in stuff that changes with each build: the bin folder on the Web project, for example.
Is there a list of what not to commit to source control? :)
Exclude the bin folder. Also be on the look out for .user or .suo files. Those file store your own settings and will change from user to user so it shouldn't be in source control.
If you're using a database stored in the App_Data folder, be sure to ignore that as well (the database file, not the App_Data folder).
Generally, I exclude the bin and obj folders of every project from source control. I can't remember needing to do anything else.
do you use ankhsvn?
i think ankhsvn automatically exclueds directories which are not needed in subversion
cheers

Updating a DLL in a Production ASP.NET Web Site bin folder

I want to update a class library (a single DLL file) in a production web application. This web app is pre-compiled (published). I read an answer on StackOverflow (sorry, can't seem to find it anymore because the Search function does not work very well), that led me to believe that I could just paste the new DLL in the bin folder and it would be picked up without problems (this would cause the WP to recycle, which is fine with me because we do not use InProc session state).
However, when I tried this, my site blows up and gives a FileLoadException saying that the assembly manifest definition does not match the assembly reference. What in the world is this?! Updating the DLL in Visual Studio and re-deploying the entire site works just fine, but it is a huge pain in the rear. What is the point of having a separate DLL if you have to re-deploy the entire site to implement any changes?
Here's the question: How can I update a DLL on a production web site without breaking the app and without re-deploying all of the files?
The thing to remember is that there are web sites and web applications as far as Visual Studio and ASPNET is considered.
Web Sites typically have all of the aspx and vb files published to the live server and ASPNET Worker Process recompiles the app every time before presentation.
On the other end is the web application, where all of your code behind files get compiled down to a single DLL file and you simply deploy your aspx pages and you bin folder with the DLL file to production.
There is also a "hybrid" known as "Precompiled Web Sites" (see the link for the official MSDN overview) where you don't have the single DLL layout of a web application, but all the compile work of the website is done for you. There are several "modes" to this depending on your needs.
It seems to me that your error is caused because your site is set up as a web site with some kind of precompilation in place. Using the pre-compiled model is a little more "strict" in that is assumes certain files/signatures are in place. Having an updated version of the DLL file causes a break since the precompilation wants a name and a version of the file.
If possible, your best bet would be to convert to a web application, since you can add the additional DLLs into production without a problem. Otherwise, take a look at this matrix to see what form of precompilation you need for your application.
Look at this SO post, might be what you are referring to. The located assembly's manifest definition does not match the assembly reference
Have a look at your reference. Does it say "specific version = true" ? Set it to false, republish your app (you have to do it once, because now your app is still looking for an assembly with a specific manifest) and try it again.

Running an ASP.NET Web Application on Apache with Mono

I have developed an ASP.NET web application that has the following files (after being published): Default.aspx, Web.config, .dll (in bin folder), .pdb (in bin folder), and an App_Data folder that currently has nothing in it. This application runs well in Visual Studio.
My company uses Apache so the IT department decided to try Mono to run my application. Unfortunately, the application does not run. A question that was asked of me was where the .cs file was located. Out of the output files, after publishing, I cannot seem to find the .cs file that the .aspx file is suppose to refer to. Am I missing a file out of the list that I provided above?
Also, does anyone know soem rules of thumb or processes for getting an ASP.NET web application to run through Mono. I just need some direction.
I really appreciate everyone's feedback on this.
Thank you,
DFM
You need to install mod_mono on Apache. There is more information about this on the Mono ASP.NET page. The .cs is compiled into the DLL is not needed at run-time.
The .cs files would be compiled into the DLL, so they are not needed for deployment. Other than that, we would probably need some more information to figure out why the app won't run under Apache/Mono.

ASP.NET Web Deployment Projects: getting rid of .compiled files

I'm using a Web Deployment Project in Visual Studio 2008 in order to prepare my ASP.NET application (ASP.NET web application, not ASP.NET web site) for being copied to several servers. I have to copy the files on local staging servers, on different servers via FTP and sometimes I have to fetch them from customers' servers.
So, it would be nice to have all files for deployment in a compact form without the necessity of doing a lot of comparing between source and destination. Web deployment projects have this nice feature: compile all your aspx and ascx files into a single (additional) assembly.
I somehow found out how to get rid of aspx placeholder files on the server, now I'd like to know if there is a (maybe self-made) way to get rid of these .compiled files.
From Rick Strahl's blog:
The .Compiled file is a marker file
for each page and control in the Web
site and identifies the class used
inside of the assembly. These files
are not optional as they map the ASPX
pages to the appropriate precompiled
classes in the precompiled assemblies.
If you remove the .Compiled file, the
page that it maps will not be able to
execute and you get a nasty execution
error.
Anybody out there with a creative idea, maybe using a module/handler which intercepts the check against the .compiled files in the bin folder?
The .compile file comes from pre-compiling on deployment. So you basically have 3 options:
Keep the .compiled file
Don't pre-compile and deploy source code
Turn this in to a Web Application instead of a Web Site and compile as an assembly
I have run in to the same problem myself. I actually choose #1 in most cases when dealing with deployment of Web Sites, but on the rare occasion when I know I am going to have to maintain the site for an extended period of time, I take the time to upgrade it to a Web Application.
I don't like the .compiled files either, but nobody gets hurt if they're there. So why bother?
You might want to take a look at Virtual Path Providers (KB how to here) in ASP.NET.
Credit for this suggestion must go to Cheeso and his self answered question here:
Can I get “WAR file” type deployment with ASP.NET?
I don't know about the .compiled files, but you could set up your servers to update their files with subversion instead of manually copying the files when you compile.
So you would compile the files using the Web deployment project (not into a single assembly), put them in a repository you created for this purpose, and on each server, just do an svn update to fetch and compare the files automatically.
I know it's not what you asked for directly, but it may be a path to explore.
Add "Exclude Filter" to your deployment project:
In the Deployment Project.
Right Click on Content Files.
Click on "Exclude Filter".
Add "*.Compiled"
click OK.
and thats it.
I remember at the days when I cant do Web Application with VWD Express, I use nant script to compile the project into a single dll and deploy, that would work (so I dont need the full VS to do dll deployment too), so if you really don't want to mess your project to Web Application, maybe this is a path to check too.
You can get rid of the .compiled files by using the aspnet_merge tool with the -r option.
Removes the .compiled files for the main code assembly (code in the App_Code folder). Do not use this option if your application contains an explicit type reference to the main code assembly.
If you publish your code as updateable (in publish settings) these files are generated. Uncheck that value and republish. This is an old question I know, but no answers are clearly defined for this here.

Resources