How to compile a single file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • LP

    How to compile a single file

    Hi,
    I have a site which runs on .Net technology. The site is
    already deployed and running. I need to change 1 file for
    some small enhancement. Please tell me, how can I compile
    that 1 file and merge it to the original DLL (the one
    deployed on the live server) so as to upgrade it. I dont
    want to recompile the whole project for the 1 file

    Regards,.
    LP
  • sandman

    #2
    How to compile a single file

    You can build the one library by selecting it in the
    Solution Explorer window and then either pressing Ctrl-F7
    or select it off the Build Menu. It should show as a
    separate menu item (i.e. Build MyLib as opposed to Build
    Solution). That's the closest I've found to a limited
    build.
    [color=blue]
    >-----Original Message-----
    >Hi,
    >I have a site which runs on .Net technology. The site is
    >already deployed and running. I need to change 1 file for
    >some small enhancement. Please tell me, how can I compile
    >that 1 file and merge it to the original DLL (the one
    >deployed on the live server) so as to upgrade it. I dont
    >want to recompile the whole project for the 1 file
    >
    >Regards,.
    >LP
    >.
    >[/color]

    Comment

    • Richard Grimes [MVP]

      #3
      Re: How to compile a single file

      C# and VB.NET have no concept of 'linking' object files, so if a single
      source file changes in your project then all the source files for the
      assembly have to be rebuilt. I guess Microsoft took this approach to make
      building an assembly a simpler procedure than the two step compile and link
      that occurs with C++.

      Managed C++ does have the concept of linking, so you compile C++ source
      files to .obj files (with cl.exe) and then link them (with link.exe) to get
      the assembly. If one source file changes and the .obj's for the other source
      files exist then building the assembly only involves compiling the single
      source file and linking together the .obj's.

      Neither .NET, nor Win32, have a concept of 'merge [a compiled source file]
      to the original DLL, to upgrade it'. The reason is that when the assembly is
      built the compiler creates a hash value of the module and any modules it
      uses and these are place in the assembly manifest. When the assembly is
      loaded these hashes are created again and compared to the stored values to
      see if the assembly has been tampered with.

      The actual process is not quite that simple, because if you have a multi
      module file modules are only loaded when the types in them are specifically
      requested. In fact, you can use this as a way to get round your problem. If
      you put the code for the types that are likely to change into a .NET module,
      you can recompile this at a later stage and copy it into your app directory
      to replace the old version. However, this will only work for assemblies that
      have not been signed. Once you sign an assembly (provide a
      [AssemblyKeyFile]) the hash for the module is checked when it is loaded, and
      so if you replace it with another version the hash will be different and a
      FileLoadExcepti on will be thrown.

      Richard
      --
      my email evpuneqt@zicf.b et is encrypted with ROT13 (www.rot13.org)

      "LP" <lpatnaik@hotma il.com> wrote in message
      news:0acb01c356 8a$84e08c90$a40 1280a@phx.gbl.. .[color=blue]
      > Hi,
      > I have a site which runs on .Net technology. The site is
      > already deployed and running. I need to change 1 file for
      > some small enhancement. Please tell me, how can I compile
      > that 1 file and merge it to the original DLL (the one
      > deployed on the live server) so as to upgrade it. I dont
      > want to recompile the whole project for the 1 file
      >
      > Regards,.
      > LP[/color]


      Comment

      Working...