Team Build, SGen & Mixed mode assembly

家住魔仙堡 提交于 2019-12-09 15:18:28

问题


Bit of a strange one here guys.

We have a fairly complex (111 projects spread across asp.net, silverlight, WFC, Ria Services etc) solution, which builds correctly on my dev box (2010). If I fire up VS on our build machine, I can also build the solution correctly. However, when I queue a build, it almost makes it through, until it attempts to run SGen - at which point I get the old "Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information." chestnut.

I've googled to try to find a solution, but nothing appears to do the job - the error is occurring at complile time rather than runtime, and I've added the v2 activation key to Team build host's config file to no effect. There are no tests in the solution which might cause things to be loaded.

Any ideas? Anyone? Particularly confused that VS can build ok on the server, but team build fails.


回答1:


The following trick has worked for me (ref.)

Edit (or create if it does not exist) sgen.exe.config which should be located under:

  • C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\

or on a x64 OS:

  • C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\

Then add:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

As far as I understand, adding the same snippet in the app.config of the project might no be sufficient as it's not read by the sgen tool :(



来源:https://stackoverflow.com/questions/3749368/team-build-sgen-mixed-mode-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!