How can I change any app code class after publishing the website? - asp.net

I upload the website after publishing it, now I want to change a line of code in a class which resides in app_code folder. After changes I again publish the website and upload the new app_code.dll to replace the old one but its not working. The whole functionality of app_code is not working. Is there anybody to solve my problem? thanx in advance.

The App_Code folder will parse any source files you drop in there, e.g. MyClass.vb or MyClass.cs. If you are compiling classes into a DLL, you want to put the DLL file into the bin folder instead.
If the classes are contained in your project and have their build action set to compile, they will automatically be compiled into the web application's DLL when you run a build, and should update every time you publish the site as a publish automatically builds the project/solution.

Related

Changes not working after deploying

I have made some changes to .cs file and copied the file into server where web application is hosted. But the changes I did are not reflecting. Please suggest a solution.
I tried copying .cs file alone also copied entire application files.
Did IISRESET and app pool recycle as well. But nothing works.
Most of the time when you're dealing with .cs files, you need to compile and copy the results of your build to the webserver. A combination of the .aspx/.cshtml files and bin directory including the .dll files
Here is a procedure that you can follow.
Create the app_offline.htm file on the root of your site, so the site will be off
Upload the updated files.
Now when you upload your files, if you have an Updated DLL, for your bin all is ok. You can even copy at least one dll on the bin, even if its not updated.
If you do not have that, update the web.config even with an empty line on the end, to give a signal to the site that needs some update.
Rename/remove the app_offline.htm from root and make the site online again

mvc which files are needed for deployment?

I've been working with webforms and recently started to work with mvc. With webforms, when we use to push to the qa/prod server, we alway copied over the files. leaving behind the .cs files, so just the .aspx, bin folder, along with associated js/css files would go.
with mvc, if we are copying the directory over from our pc (where we develop), what files are needed, do we need the .cshtml files for example? I just want to avoid having to push all the files if they are not needed.
They are definitely not all required. What you are going to want to do is setup a way to publish, this ranges from doing a "bin deploy" to feeding in ftp settings and using a "single click deploy" approach.
What it all boils down to though is this. You will need
A bin folder with every relevant .dll
A content folder with relevant images and css files
A script folder with relevant .js scripts
A views folder with nested folders for views with relevant .cshtml files
A .webconfig file in the views folder and also one at the very root
The packages.xml file at the very root
The global.asax file with markup pointing to the application starting in global.asax.cs
What this excludes is every single .cs file. These will all be composed into your projects .dll. So if you are developing FunWebApp, then all your c# will be rolled into FunWebApp.dll in your bin folder.
Use the Visual studio "Publish" option available on your UI Project. This will generates all the required files you neeeds includes, bin folder, Views folder(which will have the .cshtml files),Content folder,Script folder, Config file(web.config) etc.
Right click on your project and select "Publish". You will be shown a wizard where you can define what kind of publish you want. You have different options like FTP, File system etc.
You will not see the Controllers folder / Other class files because code inside that folder is compiled to your assembly which is in the Bin folder

reference app_code classes in web application project

I have created an asp.net website, with the accompanying app_code folder.
In the same solution I added a web application project, and I want to use the classes that are in the website app_code folder.
I tried adding a reference, and then adding the project (the website), but the list of project is empty...
Thanks.
You are doing it wrong. Create a class library project and move all those classes from the app_code folder to the new project. Then reference this project from both website and web application project.
Very late, but sometimes classes in App_Code may need to stay in the same project, then
Create a new folder (say "code" )in web application, and add class files from app_code as links to this folder. This lets you have a single copy.
2) Ensure Build Action for each of these imported files are "Compile" in the file property folder if need be.
3) Exclude App_Code folder from web application.
More information and reasons - please see here:
http://vishaljoshi.blogspot.in/2009/07/appcode-folder-doesnt-work-with-web.html

How to prevent an html-template sub-folder from being refreshed during build?

I placed my AMFPHP folder inside my htmltemplate project folder, but now everytime i build it wants to 'refresh' the folder which takes forever. Is there a way to set it so that folder does not refresh each time? I put the AMFPHP folder in there so I can have a unique copy for my debug builds and leave the production build one alone.
I'm not sure what you mean by 'refresh'
The HTML-Template folder is just a template. During build all files/folders in the template folder are copied to the bin-debug (or bin-release) folder. Is this 'copy' the refresh your talking about?
If you don't want these files copied over every time; just put them in your bin-debug / bin-release folders directly instead of the template folder.
If your AMFPHP folder contains config files; and nothing else, then you probably don't need those files in the html-template, bin-debug, or bin-release folders. You can compile them into the SWF using the services compiler argument.
There is also a setting in the Flash Builder Project Properties that may help. Under Flex Compiler, uncheck 'copy non-embedded files to output folder'. However, I think this relates to files int he source directory; not the HTML Template directory.
Does any of this help?

Necessary files to deploy for website using linq

I'm new # linq and can't find anywhere where it mentions if the dbml or other files are necessary to deploy with a website.
Just use the Publish command on the web site. It knows what needs to be deployed.
That's actually compiled into the dll generated for the site, so even if you deploy your site with all the files if you change any of the .cs or .vb code files directly on the deployed folder nothing changes, the only things that you can alter and change the behaviour of the website are the .aspx, .master, .css, .js (and some other non compiled files)
Notice that you deploy with the option "Only the Necessary files", those pages won't even go to the deploy directory.

Resources