In Visual Studio 2010 why is the .NETFramework,Version=v4.0.AssemblyAttributes.cpp file created, and can I disable this?

后端 未结 6 1972
遇见更好的自我
遇见更好的自我 2020-12-15 05:45

I\'ve recently upgraded to Visual Studio 2010. Now when I build projects I get a line that reads:

1>  .NETFramework,Version=v4.0.AssemblyAttributes.cpp
         


        
6条回答
  •  庸人自扰
    2020-12-15 06:17

    Firstly, @Brian's answer remedies the condition and I issued 4x+1s for the other helpful answers which assisted in a speedy diagnosis and resolution of an issue I experienced.

    Wanted to include a dump of a problem I diagnosed in my context based on this.

    This feature synthesizes a source file in the project's language which creates an assembly:attribute into the compilation stream.

    This file/process is necessary when WAS or other hosting environments need to be able to infer a target framework and other such cases. Example MSDN article (relating to usage with WAS). It's only an attribute, so it's inert and not much to worry about...

    In cases where no such reliance will come into play, it gets more interesting. Aside from being redundant, making larger binaries and heating the processor, in TeamCity, the cleaning procedures when configured for incremental builds remove this file before a re-build. However the unfortunate side effect is that the build's dependency checking then incorrectly infers that a rebuild is necessary as illustrated by this sample message when turning the logging up by specifying /v:d[etailed]:-

    [CoreCompile] Input file "C:\BuildAgent\temp\buildTmp.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.cs" is newer than output file "bin\Debug\DLLNAME.xml".

    Bottom line is that CSC gets invoked inappropriately (and in our case there are significant downstream effects from there)

    Other notes:

    • Must look in the MS Targets to see if this only applies to particlar Profiles [as alluded to in @AlainA's answer] (my specific case was a use of .NET 4.0 Client Profile)

    • As illustrated in the above message, one subtlety that may be involved is the presence or absence of XML docs, which is the case in my context.

提交回复
热议问题