Link to home
Create AccountLog in
Avatar of yknotup
yknotup

asked on

How to determine if an assembly changed after compile?

We are about to do an initial deployment of our fixedname ASP.Net app and we are contemplating the bug fix process.  With each fix, we would like to release only the files affected.  Rather than rely on the developer to track which files changed for the fix, we would like to automate the process as much as possible.  This was pretty easy to do in classic ASP but in DotNet we are choosing to release only DLLs which means that the whole site is recompiled even though only one page changed.  The end result is that all assemblies have different timestamps as well as different binary signatures (the CRC on the binary is different even though the source code did not change).  How do we programmatically determine which assembly (dll) changed as the result of code change?

I know the easy answer is to use the DLL timestamp but this does not work for us since the Aspnet_compiler does not seem to operate as advertised.  In otherwords, when we exclude the -c option only the changed components should be recompiled but my whole destination site is deleted and complied each time.  Does this work for anyone else?

Below are the compile options we use.  Note that we are using strong names with the hope it will discourage application tampering.

aspnet_compiler -v myApp  -p "C:\temp\myApp" -f -d c:\App -nologo -fixednames -errorstack -keyfile c:\temp\MyStrongNameKey.snk aptca

A related question is how do we inject version numbers into page assemblies (and App_Code.dll) and can we use these version numbers to determine if a file changed?  

Are these legitimate questions or is there an easier way to go about doing what we are trying to do?

Another question: is it appropriate to place all our business logic in App_Code or should we manage it externally and place separately compiled dlls in our bin directory?


Thanks,

Derek
Avatar of Qaiser_Mehmood_Mughal
Qaiser_Mehmood_Mughal
Flag of Pakistan image

If you want to just know using some tool, is the assembly is change or not.
then use following tools for this.

1.ExamDiff.
2. Compare Suit.

These two tools are very best for checking the changings.

QMM
Avatar of yknotup
yknotup

ASKER

Hi QMM,

Thank for the suggestion.  Let me research these tools and I'll get back to you.  

Derek
Avatar of yknotup

ASKER

QMM,

Unfortunately, file compare utilities like examDiff.exe and Compare Suite are not what I'm looking for since file comparisons against compiled code will always show differences between different compiles even if the source code has not changed (at least using the aspnet_compiler.exe).  The only thing that is the same is the file size.  

I did a bit more research and what does help me a little is placing the following code in my web.config file.

      <system.codedom>
            <compilers>
                  <compiler language="c#;cs;csharp" extension=".cs"
            type="Microsoft.CSharp.CSharpCodeProvider, System,
      Version=2.0.3600.0, Culture=neutral,
      PublicKeyToken=b77a5c561934e089" warningLevel="0"
                          compilerOptions="<dir>\AssemblyInfo.cs" />
            </compilers>
      </system.codedom>

I understand this file is automatically created for Web Application Projects and is located under the Properties directory but since we manage our site by just opening the website, we have to manually create and reference this file.

As far as I can tell, this is only a partial solution since this gives us the ability to version App_Code DLLs but not our individual page DLLs (since we compile each ASPX file to individual assemblies).  Now I can us this App_Code DLL version to programmatically determine which DLLs have changed and, therefore, which DLLs to include in my fix release.

Does anyone know how to version individual assembly ASPX DLLs?

Thanks,

Derek
ASKER CERTIFIED SOLUTION
Avatar of yknotup
yknotup

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer