Igor Kitsula .NET Developer

A Web Programmer Reference

 

How to remove bin and/or obj folder before the build or deploy

In one of my previous articles, I explained How to: Turn on MVC compiled views or Turning on views compilation which can be very useful to detect potential errors in views code.

However, once I’ve converted my projects to Visual Studio 2013 I star receiving error on build or deploy:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.

Read more...Read more...

How to exclude xml doc files from msbuild

Many of project assemblies has xml document files, which msbuild includes in the deployment build and copy them into bin folder. To exclude these files:

Read more...Read more...

How to deploy ASP .NET MVC 4 app to remote hosting

I’ve recently upgrade my MVC apps to MVC 4 version. How to upgrade solution to MVC 4 is pretty clear from MVC Release Notes white paper, but what’s the list of MVC 4 DLLs have to be deployed with the solution if remote hosting doesn’t have installed MVC 4 assemblies. Here is my minimum list of DLLs that should be deployed with an app (it’s even shorter than MVC 3 !):

  • Microsoft.Web.Infrastructure.dll
  • System.Web.Helpers.dll
  • System.Web.Mvc.dll
  • System.Web.Razor.dll
  • System.Web.WebPages.dll
  • System.Web.WebPages.Deployment.dll
  • System.Web.WebPages.Razor.dll
Read more...Read more...

Create command line automated build for MVC app with msbuild 4 OR Visual Studio 2010 Publish command for msbuild Command line

I always wanted to have ability build or deploy my website with one run of the .bat or .cmd file. Of course there is software for this like Cruise Control or AntHill for example. But just for one small blog or website you don’t want to spend a lot of time for installing and configuring of these heavy tools.

So I always wanted to have "Publish" function from Visual Studio as a command line. And I found it! So let me share with you my experience how to build command line automated build for MVC web app.

Read more...Read more...

Versioning JavaScript and CSS files or How to update static files on client side

If you have enabled expiry headers, entity tags, etc. (and even if not), anyway most of the browsers have enabled cache. But how can we force client browser to load new version of JavaScript file or CSS static file? Especially if you did a change in any site specific static file. File from browser cache can broke behavior of website or/and design. So how to tell browser to load updated static file?

Read more...Read more...

How to Deploy an ASP.NET MVC 3 App to Web Hosting with "\bin Deployment"

If your hosting provider don’t support MVC 3 but have MVC 2 installed you still can deploy your web app. Solution is simple – MVC 3 files should be in Bin folder of your solution. Here is the list:

Microsoft.Web.Infrastructure.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Razor.dll
System.Web.WebPages.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.Razor.dll

Read more...Read more...

Favicon and robots.txt or What deployment begins from

Before the first deployment of new website you add Google Analytics tracking code on it and want to search engines start to indexing it. Of course you don't want to have any errors on first indexing. My experience shows that one's of important files that search engines trying to get are robots.txt and favicon.ico. First tells robots about possible restrictions, second - just an icon of website (which is shows in address bar of browser).

Read more...Read more...