开发者

Project in my VS 2008 solution rebuilding every time

I have a C# project in VS 2008, that is being rebuilt every time I build the solution, even though nothing in this project, nor any of its dependencies, was changed. This is causing a huge problem, because the solution is pretty large (>100 projects), and this one project is very low down the dependency chain, so it is now causing most of the other projects to also rebuild, when no rebuild should have been necessary. (I am doing "Build Solution" and not "Rebuild Solution.")

I know this one project is the culprit, since I turned "MSBuild project build output verbosity" to "Diagnostic." I then build the solution twice without changing anything in between builds. On the second build, this is the 1st project in the solution that is being rebuilt, as determined by noting that Csc.exe is getting executed.

Here's what I see in the Build Output:

------ Build started: Project: COS.BusinessEntities, Configuration: Debug Any CPU ------

...

Target "CoreCompile" in file "c:\WINDOWS\Microsoft.NET\F开发者_运维问答ramework\v3.5\Microsoft.CSharp.targets":
 Building target "CoreCompile" completely.
 Output file "bin\Debug\COS.BusinessEntities.XML" does not exist.
 Task "Csc"
  Command:
  c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1591,1573,0219,0168,1572,1587,1570,1701,1702 /errorreport:prompt /warn:4 /doc:bin\Debug\COS.BusinessEntities.XML /define:DEBUG;TRACE ...

So it appears that when it gets to the COS.BusinessEntities project, it doesn't find the "bin\Debug\COS.BusinessEntities.XML" file. But I have verified that this file is indeed there after the first build, and I don't believe it is getting deleted and re-created (but am open to suggestions on how to verify this). I tried watching the folder while doing the second build, and I never saw it disappear.

Another clue is that this behavior began on a specific check-in, where a developer added two files to the project: an OptionsEntities.edmx file and OptionsEntities.Designer.cs . The following was also added to the COS.BusinessEntities.prj file:

  <Compile Include="Options\Entities\OptionsEntities.Designer.cs">
   <AutoGen>True</AutoGen>
   <DesignTime>True</DesignTime>
   <DependentUpon>OptionsEntities.edmx</DependentUpon>
  </Compile>

  ...

  <EntityDeploy Include="Options\Entities\OptionsEntities.edmx">
   <Generator>EntityModelCodeGenerator</Generator>
   <LastGenOutput>OptionsEntities.Designer.cs</LastGenOutput>
  </EntityDeploy>

Obviously these entries are necessary for the edmx file, but I'm wondering if some of the values are incorrect, causing this behavior. I know for sure that this is the culprit, as if I get the previous changeset, this problem goes away; the project does not rebuild itself when building the solution after no code changes.

Any help is appreciated! I've been racking my brain for a few days now!

Thanks,

Chris

EDIT: After removing the XML documentation XML file from the project, I'm still getting the same problem, but here's the new output:

Target "CoreCompile" in file "c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CSharp.targets":
  Building target "CoreCompile" completely.
  Input file "C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D36.tmp" is newer than output file "obj\Debug\COS.BusinessEntities.pdb".
  Task "Csc"
    Command:
    c:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1591,1573,0219,0168,1572,1587,1570,1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE ...

...and that temp file is different every time! Yikes! What to try now?

EDIT 2: Here are the relevant portions of the Build Output, related to this temp file (these begin within the BusinessEntities project):

Target "SplitResourcesByCulture" in file "c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
  Task "Warning" skipped, due to false condition; ('@(ResxWithNoCulture)'!='') was evaluated as (''!='').
  Task "Warning" skipped, due to false condition; ('@(ResxWithCulture)'!='') was evaluated as (''!='').
  Task "Warning" skipped, due to false condition; ('@(NonResxWithCulture)'!='') was evaluated as (''!='').
  Task "Warning" skipped, due to false condition; ('@(NonResxWithNoCulture)'!='') was evaluated as (''!='').
  Task "AssignCulture"
    Culture of "" was assigned to file "C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D36.tmp".
    Culture of "" was assigned to file "C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D38.tmp".
    Culture of "" was assigned to file "C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D37.tmp".
  Done executing task "AssignCulture".
Done building target "SplitResourcesByCulture" in project "COS.BusinessEntities.csproj".
Target "CreateManifestResourceNames" in file "c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CSharp.targets":
  Task "CreateCSharpManifestResourceName"
    Root namespace is 'COS.BusinessEntities'.
    Resource file 'C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D36.tmp' doesn't depend on any other file.
    Resource file 'C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D36.tmp' gets manifest resource name 'COS.BusinessEntities.tmp6D36.tmp'.
    Resource file 'C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D38.tmp' doesn't depend on any other file.
    Resource file 'C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D38.tmp' gets manifest resource name 'COS.BusinessEntities.tmp6D38.tmp'.
    Resource file 'C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D37.tmp' doesn't depend on any other file.
    Resource file 'C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D37.tmp' gets manifest resource name 'COS.BusinessEntities.tmp6D37.tmp'.
  Done executing task "CreateCSharpManifestResourceName".
  Task "CreateCSharpManifestResourceName" skipped, due to false condition; ('%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx') was evaluated as ('' == '' and 'false' == 'true' and 'Non-Resx' == 'Non-Resx').
Done building target "CreateManifestResourceNames" in project "COS.BusinessEntities.csproj".

And then a little further down:

Target "_GenerateCompileInputs" in file "c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets":
  Task "Warning" skipped, due to false condition; ('@(ManifestResourceWithNoCulture)'!='' and '%(ManifestResourceWithNoCulture.EmittedForCompatibilityOnly)'=='') was evaluated as (''!='' and ''=='').
  Task "Warning" skipped, due to false condition; ('@(ManifestNonResxWithNoCultureOnDisk)'!='' and '%(ManifestNonResxWithNoCultureOnDisk.EmittedForCompatibilityOnly)'=='') was evaluated as ('C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D36.tmp;C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D38.tmp;C:\Documents and Settings\<my username>\Local Settings\Temp\tmp6D37.tmp'!='' and 'true'=='').
Done building target "_GenerateCompileInputs" in project "COS.BusinessEntities.csproj".

So it looks like there are a few other temp files as well, but I'm not sure why they're being generated, or why they're considered inputs to the project.

Thanks so much for the help so far!


Well, I finally figured it out. Posting the answer for posterity.

In Solution Explorer, I double-clicked the .edmx file that was causing this to open the Model Browser. In the Model Browser, I selected my model, and in the Properties window, I changed "Metadata Artifact Processing" to "Copy to Output Directory."

After that, it works fine (no unnecessary rebuilds)!

Also, I've been told that this doesn't happen in VS2010 (have not tested this, though).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜