C# 请在类型名称中明确指定程序集 [英] C# Please specify the assembly explicitly in the type name

查看:31
本文介绍了C# 请在类型名称中明确指定程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 umbraco 站点,我希望从一个单独的工作 VS 项目中添加一个 fileuploader.我已通过添加现有项目将其添加到我的 umbraco VS 项目中.

I have a umbraco site where i wish to add a fileuploader from a separate working VS project. I have added it to my umbraco VS project with Add existing project.

然后我将代码从 default.aspx 移动到用户控件,以便我可以将它添加到我的 umbraco.

I have then moved the code from default.aspx to a usercontrol so i could add it to my umbraco.

但是在尝试上传某些文件时出现 500 错误.在我的事件查看器中,我有以下 2 个例外:

But i get a 500 error when trying to upload some files. In my event viewer i have the following 2 exceptions:

异常消息:类型jQueryUploadTest.FileTransferHandler"不明确:它可能来自程序集C:\UmbracoSites\sitename\sitename\bin\sitename.DLL"或程序集C:\UmbracoSites\sitename\sitename\"bin\jQueryUploadTest.DLL'.请在类型名称中明确指定程序集.

Exception message: The type 'jQueryUploadTest.FileTransferHandler' is ambiguous: it could come from assembly 'C:\UmbracoSites\sitename\sitename\bin\sitename.DLL' or from assembly 'C:\UmbracoSites\sitename\sitename\bin\jQueryUploadTest.DLL'. Please specify the assembly explicitly in the type name.

指定用于缓存压缩内容的目录 C:\Users\name\AppData\Local\Temp\iisexpress\IIS Temporary Compressed Files\Clr4IntegratedAppPool 无效.正在禁用静态压缩.

The directory specified for caching compressed content C:\Users\name\AppData\Local\Temp\iisexpress\IIS Temporary Compressed Files\Clr4IntegratedAppPool is invalid. Static compression is being disabled.

什么意思?当 dll 等在构建时从 jQueryUploadTest 复制并且与 sitename.DLL 无关时,它如何来自 sitename.DLL.

What does it mean? How can it come from the sitename.DLL when dll etc are copyed from jQueryUploadTest on build and have nothing to do with sitename.DLL.

推荐答案

您肯定在两个程序集中都有 QueryUploadTest.FileTransferHandler 类型.

You surely have the type QueryUploadTest.FileTransferHandler in both assemblies.

确保 sitename.dll 没有类似的类型名称,或者,为了确保此问题不会在其他时间发生,请更改其中一个项目的命名空间.

Make sure that sitename.dll doesn't have a type name like that or, to make sure this problem won't occur other times, change the namespace of one of the projects.

为不同的程序集使用不同的命名空间是一种很好的做法,正是为了避免此类问题.

It's good practice to have diferent namespaces for diferent assemblies, exactly to avoid this kind of problem.

这篇关于C# 请在类型名称中明确指定程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆