MSBuild错误CS0012

时间:2014-01-07 15:37:50

标签: c# wcf svn visual-studio-2012 msbuild

我在dotNet framework 4.0中遇到msbuild错误。我可以在VS2012中本地构建而没有任何错误,但是当我将代码推送到构建服务器时它失败并出现以下错误:

error CS0012: The type 'CS.Framework.Services.IRequest' is defined in an assembly that is not referenced. You must add a reference to assembly 'CS.Framework.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0decfeffa518e9a9'.

以下是来自msbuild的日志记录,您可以看到列出的相关项目:

<task name="msbuild">
    <message level="Info"><![CDATA[CS.Framework.Enums -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.Framework.Extensions -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.Entities.Common -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.Framework.Common -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.Framework.Services -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.DataContracts.Services.Core -> e:\CCNet\SVNCheckouts\]]></message>
    <message level="Info"><![CDATA[CS.DataContracts.NetSuiteService -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.ServiceContracts.NetSuiteService -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.DataContracts.Authorization -> e:\CCNet\SVNCheckouts\]></message>
    <message level="Info"><![CDATA[CS.ServiceContracts.Authorization -> e:\CCNet\SVNCheckouts\]]></message>
    <message level="Info"><![CDATA[CS.Entities.Services.Core -> e:\CCNet\SVNCheckouts\]]></message>
    <message level="Info"><![CDATA[CS.Framework.Caching -> e:\CCNet\SVNCheckouts\]]></message>
    <message level="Info"><![CDATA[CS.Framework.Wcf -> e:\CCNet\SVNCheckouts\]]></message>
    <message level="Info"><![CDATA[CS.Framework.Services.Core -> e:\CCNet\SVNCheckouts\]]></message>
    <message level="Info"><![CDATA[CS.Services.NetSuiteService -> e:\CCNet\SVNCheckouts\]]></message>
    <message level="Info"><![CDATA[c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "CS.Framework.Services". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. ]]></message>
    <message level="Info"><![CDATA[ServiceTests.cs(41,13): error CS0012: The type 'CS.Framework.Services.IRequest' is defined in an assembly that is not referenced. You must add a reference to assembly 'CS.Framework.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0decfeffa518e9a9'. ]]></message>
    <duration>1000.0256</duration>
  </task>

该项目引用了CS.Framework.Services项目,所以不确定为什么它说不存在。

2 个答案:

答案 0 :(得分:3)

就在那里:

warning MSB3245: Could not resolve this reference. 
Could not locate the assembly "CS.Framework.Services".
Check to make sure the assembly exists on disk.

在本地你有磁盘上的程序集,但如果从SVN获得它,那么这个程序集就不存在了。您需要确保您的构建服务器可以访问此程序集。

答案 1 :(得分:0)

我最终删除并重新添加了引用,这似乎解决了这个问题。