A few days ago I have faced a deployment issue in one of my ongoing project. This was a classic Local environment vs. Deployment environment issue.
In this article I will explain my experiences how I have figured out the root cause of the issue and its solution in step by step manner. Hope This will help you(especially the new Jaxarian) to find out any root cause of an issue and will save time and effort of others if they face this issue.
The solution run in my local machine very well and it builds the solution successfully. But when I try to deploy the code on development server through Cruise Control then the terrible build failed come out to crash my head.
STEP1:(Figure out the problem)
First of all i look in the log file of cruise conrol. You will find it in the left side menu of your project details page in cruise control(see image-1). By clicking on the view build log you can see the log of any build. Best practice is to go at the bottom of the log details to see the error that stoped the build.
I found the error was:
SGEN : error : An attempt was made to load an assembly with an incorrect format: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_22.214.171.124__b77a5c561934e089\System.Data.dll. [C:\Projects\abcProject\Development\Trunk\CodeBase\CRM\CRM.csproj]
solution attempt taken in step 1:
Then looking at this my initial thought was may be there is a dll version problem and I started to find the culprit dll system.data. Then i found really there is a difference between the version of the specific DLL in my local pc and in the utility server.
Then I tried to figure out why there is a mismatch in the version.
Then i found my solution's target dot net framework of version 4.5 (You will find it in the web.config file) and I asked the NE team to confirm the framework version of utility server. They confirmed the version 4.5 is installed during OS installation and is integrated with windows 8.but I found the DLL version in the gac was little different than my local PC.
Then I Synced the version of the local machine and in the utility server but got the same disgusting issue.:(
Then I look into the error message more carefully and found that it is happening in building two project :
Then I look into the assembly reference of the CRM project and Web project and found there is a System.Data refference.both are same and I was sure that there was no problem with this because it worked in earlier build. Again I was hopeless.:(
STEP3(Look for community):
1.Ask other people if the issue is known to others. Then i asked my roommates if they have faced this kind of issue and there was no hope again.:(
2. Do googling.
STEP4(Look for more specific- what new is causing the error):
Then I look into the project file log in Subversion(SVN) to find out what are changes made from last successful build to 1st failed build date time. I found two new DLL was added there.
Temporary workaround to continue build and testing:
As this was killing too much time, I revert the project file and corresponding referred file back to workable version and build successfully. Workaround is very very important when other team member are waiting for the solution and QA testing getting hampered.
STEP5(Find out the actual solution):
Then i start more googling and I will explain in my next article how i have proceed for actual solution.
My main target of this article is to know how we should dig into an issue that we face in our development life.