2012-11-01 54 views
1

我有一个引用两个类库的Sharepoint可视Web部件。这些库共同为Web部件提供值。该解决方案基于没有任何错误或警告....Sharepoint编译项目包含两个相互引用的类库

1>------ Rebuild All started: Project: ClassLibrary1, Configuration: Debug Any CPU ------ 
1> ClassLibrary1 -> c:\Projects\TempWebPart\ClassLibrary1\bin\Debug\ClassLibrary1.dll 
2>------ Rebuild All started: Project: ClassLibrary2, Configuration: Debug Any CPU ------ 
2> ClassLibrary2 -> c:\Projects\TempWebPart\ClassLibrary2\bin\Debug\ClassLibrary2.dll 
3>------ Rebuild All started: Project: TempWebPart, Configuration: Debug Any CPU ------ 
3> TempWebPart -> c:\Projects\TempWebPart\TempWebPart\bin\Debug\TempWebPart.dll 
========== Rebuild All: 3 succeeded, 0 failed, 0 skipped ========== 

然而,当我按下启动按钮来调试它引发错误并不会编译...

1>------ Build started: Project: TempWebPart, Configuration: Debug Any CPU ------ 
1> TempWebPart -> c:\Projects\TempWebPart\TempWebPart\bin\Debug\TempWebPart.dll 
1> ClassLibrary1 -> c:\Projects\TempWebPart\ClassLibrary1\bin\Debug\ClassLibrary1.dll 
1>c:\Projects\TempWebPart\ClassLibrary2\Class2.cs(5,7,5,20): error CS0246: The type or namespace name 'ClassLibrary1' could not be found (are you missing a using directive or an assembly reference?) 
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ========== 
========== Deploy: 0 succeeded, 0 failed, 0 skipped ========== 

我也得到了以下错误和警告。

Error 1 The type or namespace name 'ClassLibrary1' could not be found (are you missing a using directive or an assembly reference?) c:\Projects\TempWebPart\ClassLibrary2\Class2.cs 5 7 TempWebPart 

我已经添加到Web部件项目引用两个classlibrary项目。 我还添加了“从项目的组件输出”两个类库中包下高级菜单...

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="0a8bd835-ad91-49a1-a82d-61e22081fbe6" SharePointProductVersion="14.0"> 
    <Assemblies> 
    <Assembly Location="ClassLibrary1.dll" DeploymentTarget="GlobalAssemblyCache" /> 
    <Assembly Location="ClassLibrary2.dll" DeploymentTarget="GlobalAssemblyCache" /> 
    <Assembly Location="TempWebPart.dll" DeploymentTarget="GlobalAssemblyCache"> 
     <SafeControls> 
     <SafeControl Assembly="TempWebPart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ef7e45135ca6bea" Namespace="TempWebPart" TypeName="*" /> 
     </SafeControls> 
    </Assembly> 
    </Assemblies> 
    <FeatureManifests> 
    <FeatureManifest Location="TempWebPart_Feature1\Feature.xml" /> 
    </FeatureManifests> 
</Solution> 

我的图书馆简单只是为了测试这种情况下..这里是代码.. 。

namespace ClassLibrary1 
{ 
    public class Class1 
    { 
     public String Hello = "Hello"; 
    } 
} 
using ClassLibrary1; 

namespace ClassLibrary2 
{ 
    public class Class2 
    { 
     public String Hello = new ClassLibrary1.Class1().Hello; 
    } 
} 

的组件签署。我曾尝试在WindowsForms应用程序,并正常工作。我已经尝试了VB库,并且出现了类似的消息。我想我错过了某个步骤。我正在使用vs2012。

我真的很憋屈的事情,试图:(我希望得到任何帮助。

感谢

+0

不...目前还没有:( – Sprouts

回答

0
  • 什么是类库的目标框架?应该是.NET Framework 3.5?
  • 您可能需要在Web部件项目在package.xml中这些程序集。

希望这有助于..

+0

这两个类库都是3.5。 我已经包含了组件。 下面是XML ... \t \t <汇编位置= “ClassLibrary1.dll” DeploymentTarget = “GlobalAssemblyCache”/> \t \t <汇编位置= “ClassLibrary2.dll” DeploymentTarget = “GlobalAssemblyCache”/> – Sprouts

相关问题