Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

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
0
yknotup
Asked:
yknotup
  • 3
1 Solution
 
Qaiser_Mehmood_MughalCommented:
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
0
 
yknotupAuthor Commented:
Hi QMM,

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

Derek
0
 
yknotupAuthor Commented:
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
0
 
yknotupAuthor Commented:
The route we will be trying will be to convert our web site into a web application and break up our AppCode directory into as many separate C# Library projects as we deem appropriate.  It takes a little bit of code restructuring  but not much.  In the end we will have a VSS Solution project with a few c# librariy projects and a web application project.  The Web Application Project will reference the C# libraries via project references.

In case of fixes to a released sited, since everything is in vss we know what files changed and therefore can release the minimum amount of files and/or dlls.

Derek
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now