Necessary files to deploy for website using linq - asp.net

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.

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

How can I change any app code class after publishing the website?

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.

Visual Studio 2010 - Partially Publish Web Site?

I just completed a website that is image heavy and I'm publishing the site to an FTP server. The publish time takes ~5 minutes. Is there a way for me to configure which file types get published? I'd like to push out changes only if the file extention is: (.config, .aspx, .cs, .asmx, .js, .html, .css, .master).
Is this possible?
No, the publish process publishes the whole website.
Publish it on your local computer first and then use an FTP tool (Filezilla, CoreFTP...) to selectively upload your files to the server.
Unfortunately No, it is not possible. Publish operation is either-all-or-none operation.
Even though, I sometimes only copy the DLL assembly (from bin directory to IIS website folder) if the change is only in the code-behind files and the markup/images/other-content have no changes.
you can set the Build Action for whatever you don't want published to None
These won't get copied to the deployment directory
I have just confirmed that it works (I tested on a MVC3 site)
so you'll have to change the setting for each file you want to exclude but you can change the setting of multiple at one time and folders can't be excluded

Can you precompile and merge part of an ASP.NET website and then continue development?

A big part of the web site is precompiled and merged, since it's almost never going to change. The precompiled bits can be replaced in case of updates to the original. I want to continue development of new pages, but when I browse to a new page I get the following error:
The file '/Website/Test/Default.aspx'
has not been pre-compiled, and cannot
be requested.
Is there any way around this?
Edit:
If I remove the precompileApp.config file I get the contents of the marker files when I browse them:
This is a marker file generated by the precompilation tool, and should not be deleted!
Have you looked at the precompile with updatable UI option? This compiles all the source code and resources into a DLL but allows you to continue making changes to your .aspx pages after deployment.
Another option could be to precompile the website in place on the server instead of precompiling it then deploying it to the webserver.
Both options are addressed in this MSDN article:
http://msdn.microsoft.com/en-us/library/bb398860.aspx

Resources