我有一个Sharepoint可视化Webpart,它引用了两个类库。这些库协同工作,为Webpart提供值。解决方案构建时没有错误或警告...
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 ==========然而,当我按下start按钮来调试它时,它抛出错误并且不能编译...
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我已经为两个类库项目添加了对Webpart项目的引用。我还在Package...下的Advanced菜单中为两个类库添加了“来自项目输出的程序集”。
<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。
我真的被困在要尝试的事情上了:(我很感激任何人的帮助。
谢谢
发布于 2012-11-01 17:12:22
希望这能帮上忙..
https://stackoverflow.com/questions/13173859
复制相似问题