简体   繁体   English

解决方案中的项目之间共享MasterPage的问题

[英]Issue with sharing MasterPage between projects in Solution

My team has multiple web application projects that have common components. 我的团队有多个具有通用组件的Web应用程序项目。 In order to keep from having multiple instances, we have setup a common source that contains common classes and web project. 为了避免出现多个实例,我们设置了一个包含通用类和Web项目的通用源。 In the web project, we would have MasterPage, pages, and user's controls that are shared as linked files from the main web application. 在Web项目中,我们将拥有MasterPage,页面和用户控件,这些控件作为链接文件从主Web应用程序共享。 each of the shared projects are included as part of the solution. 每个共享项目都包含在解决方案中。 The solution builds successfully, but when I open the page of the web app, I'm getting server stating that "The type 'Common.Controls.Master' is ambiguous: it could come from assembly 'C:....\\bin\\Common.Controls.DLL' or from assembly 'C:....\\bin\\AppWeb.DLL'. Please specify the assembly explicitly in the type name." 该解决方案构建成功,但是当我打开Web应用程序的页面时,服务器提示“类型'Common.Controls.Master'不明确:它可能来自程序集'C:.... \\ bin”。 \\ Common.Controls.DLL”或程序集“ C:.... \\ bin \\ AppWeb.DLL”。请在类型名称中明确指定程序集。”

The actual Common.master resides in the Common.Controls project at the root. 实际的Common.master位于根目录的Common.Controls项目中。 The link file to the master page is in the AppWeb project. 母版页的链接文件位于AppWeb项目中。

I've looked for solution and found this How to share Master Pages between my projects which is pretty much what I'm doing. 我一直在寻找解决方案,并找到了如何在我的项目之间共享母版页,这几乎就是我正在做的事情。

Another option I found was What is the best way to share MasterPages across projects . 我发现的另一个选择是什么是跨项目共享MasterPage的最佳方法 I haven't tried the methods in this one. 我没有尝试过这一方法。

I was certain that using the linked file would work. 我确定使用链接的文件将起作用。

Thanks in advance in helping me resolve this error. 在此先感谢您帮助我解决此错误。

I faced a very similar issue recently with a different shared class. 最近,我在另一个共享类上遇到了一个非常相似的问题。 Is it possible that the initial location of the MasterPage was under AppWeb project and then moved under Common.Controls project? 母版页的初始位置是否有可能位于AppWeb项目下,然后又移至Common.Controls项目下? In this case a build would not clean the previous dlls and would cause the error you are looking at. 在这种情况下,生成版本将无法清除以前的dll,并会导致您正在查看的错误。 If this is the case, a simple manual deletion of all files under the bin folder of your projects and rebuild should solve the issue. 在这种情况下,只需手动删除项目的bin文件夹下的所有文件并进行重建,即可解决此问题。 I hope this helps 我希望这有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM