為什麼我的項目在沒有變化的情況下構建? (Why do my projects build when there are no changes?)


問題描述

為什麼我的項目在沒有變化的情況下構建? (Why do my projects build when there are no changes?)

我有許多 C# (Visual Studio 2008) 項目,其中一些正在更新程序集,即使沒有任何更改(即使我選擇了構建而不是重新構建)。我的大多數項目都沒有這樣做,只是少數幾個。

我還沒有發現項目之間的任何差異,並想知道是否有人知道是什麼影響了它。需要明確的是,我在構建之前沒有對代碼進行任何更改,但是當我在 Visual Studio 中運行 Build 命令時,仍然會重新創建程序集。

很抱歉,我無法提供更多詳細信息但請讓我知道是否還有其他可以檢查的信息。

有人可以幫忙嗎?我已經為此煩惱了一段時間。

謝謝,艾倫


參考解法

方法 1:

Actually Hans' now‑deleted answer pointed me to the right direction. Cranking up MSBuild's verbosity to diagnostic told me that VS considered a project always out of date because one file had "Copy to output directory" set to "Copy always". And the other projects followed from that because they depended on that project an noticed that the newly‑built DLL was newer than one of their own output files.

Changing "Copy to output directory" to "Copy if newer" resolved that.

方法 2:

There is something called project dependencies.

When one of your project depends on one or more other projects and you build it the other projects that your projects depends on will also begin to be built (if needed). Additionally if the dependencies have changed then the projects dependent on them will always be rebuilt.

You can Right Click on Solution and select Project Build Order to bring up a window which explains the order in which projects are built and the dependencies for each project.

方法 3:

I didn't get to the bottom of this one and ended up reconstructing one of the projects. It turned out that it was all stemming from this one project that was always rebuilding.

I think it had something to do with the embedded resources being rebuilt every time.

Sorry I don't have a definitive answer on this one. Thanks to RobV too for the useful information.

Alan

(by Alan SparkJoeyuser415789Alan Spark)

參考文件

  1. Why do my projects build when there are no changes? (CC BY‑SA 3.0/4.0)

#projects #visual-studio #build #csproj #C#






相關問題

Netbeans 運行我所有的項目 (Netbeans runs all my projects)

Cara berbagi konfigurasi antara Dua atau lebih lingkungan TRAC (How To share configurations between Two or more TRAC environments)

Visual Studio 2005安裝程序項目安裝在終端服務器上崩潰 (Visual Studio 2005 Setup project install crashes over Terminal Server)

XCode 項目詳情? (XCode Project Details?)

Visual Studio 2005項目選項 (Visual Studio 2005 Project options)

布朗菲爾德VS格林菲爾德的發展? (Brownfield vs Greenfield development?)

NodeJS 中復雜系統的架構方法 (Architectural approach to complex system in NodeJS)

使用Wiki作為中央開發項目存儲庫 (Using a wiki as a central development project repository)

開發 Web 服務器的技巧 (Tips for developing a web server)

Visual Studio 解決方案/項目組織 (Visual Studio solution/projects organization)

為什麼我的項目在沒有變化的情況下構建? (Why do my projects build when there are no changes?)

如何使用開源項目改進我的 C++ (How to improve my C++ with open source projects)







留言討論