Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Smart Build

Smart Build

Scheduled Pinned Locked Moved C#
csharptutorialquestionlearning
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blackthunder001
    wrote on last edited by
    #1

    Everytime I open up a C# project and click build, a new assembly gets created even if none of the source files and references are modified. However, once I build once, then for that session, any further build will not create a new assembly (unless I change something of course). How to make the first build after opening the project to also not build if nothing has changed?

    H 1 Reply Last reply
    0
    • B blackthunder001

      Everytime I open up a C# project and click build, a new assembly gets created even if none of the source files and references are modified. However, once I build once, then for that session, any further build will not create a new assembly (unless I change something of course). How to make the first build after opening the project to also not build if nothing has changed?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Opening VS.NET treats the project like its new/modified. There's no documented way to change this that I've ever seen. If you're concerned about versioning problems, first don't use automatic version incrementing in larger projects with multiple assemblies. Not only does it create problems like this, but it makes deployment and tracking a pain in the arse. You can also facilitate better builds by using project references for projects in your solution instead of assembly references if you're not already. This keep dependencies in sync and keeps the build configuration constant for all projects.

      Microsoft MVP, Visual C# My Articles

      B 1 Reply Last reply
      0
      • H Heath Stewart

        Opening VS.NET treats the project like its new/modified. There's no documented way to change this that I've ever seen. If you're concerned about versioning problems, first don't use automatic version incrementing in larger projects with multiple assemblies. Not only does it create problems like this, but it makes deployment and tracking a pain in the arse. You can also facilitate better builds by using project references for projects in your solution instead of assembly references if you're not already. This keep dependencies in sync and keeps the build configuration constant for all projects.

        Microsoft MVP, Visual C# My Articles

        B Offline
        B Offline
        blackthunder001
        wrote on last edited by
        #3

        Thanks for the info. The problem I have is that I have a library project which gets referenced (yes, project reference) by some exe projects. Everytime I compile one exe project, the library project also gets compiled too. Isn't it better to use assembly references in this case? That way, I only build the library project whenever I change it?

        H 1 Reply Last reply
        0
        • B blackthunder001

          Thanks for the info. The problem I have is that I have a library project which gets referenced (yes, project reference) by some exe projects. Everytime I compile one exe project, the library project also gets compiled too. Isn't it better to use assembly references in this case? That way, I only build the library project whenever I change it?

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          I wouldn't say it's "better", but you sure could. Just make sure that when switching between build configurations you update the assembly reference (if you use pre-proc conditions to change any of the code, for example). The nice thing about project references is that is how VS.NET sets up dependencies (it's odd you can't do this manually like with VC++ projects, though). If your library project changes (and I understand that it will appear to at startup and that's annoying), your apps should recompile it if the recompile is necessary. It will only get built once until the library project changes again (or you restart VS.NET). Again, it's up to you and really doesn't matter, but this is just something to consider.

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups