在 .net 2.0 中构建提供程序

发布于 2024-08-07 19:57:21 字数 234 浏览 5 评论 0 原文

如何确定我的构建提供程序正在构建的类型(类)的实际文件名(App_Code_xxx.dll)。

例如,我有一个构建提供程序,它根据某些配置注入类。说 MyNameSpace.MyClass。当 Web 应用程序使用此构建提供程序时。我只想知道临时文件中的 asp_net.dll 在磁盘上编译的实际文件(.dll)。

从真正意义上来说,我什至想控制这个文件的命名。

提前致谢。

穆罕默德

How can I determine the actual filename (App_Code_xxx.dll) of the types (classes) which is being built by my build provider.

For instance I have a build provider which injects classes based on some configuration. Say MyNameSpace.MyClass. When this build provider is consumed by the Web App. I just want to know the actual file(.dll) which was compiled on the disk by asp_net.dll in temporary files.

In true sense I even want to control the naming for this file.

Thanks in Advance.

Mohammed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

偏爱自由 2024-08-14 19:57:21

我从来不喜欢 Visual Studio 2005 附带的网站构建方法,每次构建时都会创建一个名为 App_Code_xxx.dll 的新文件,使用它非常痛苦。

Visual Studio 2005 SP1(及更高版本)有一个 Web 应用程序,它将您的项目构建为单个 .dll(就像在 .net 1.1 中所做的那样)并且更容易使用,我建议将您的网站转换为 Web 应用程序。教程可在此处此处

这样您就不必担心写入磁盘上的文件名

I never liked the website build approach that came with Visual Studio 2005 that created a new file named App_Code_xxx.dll every time you build, it's just pain to work with it.

Visual Studio 2005 SP1 (and later versions) have a web application which builds your project into a single .dll (like was done in .net 1.1) and is much easier to work with, I would recommend comverting your website to web application. Tutorials are available here and here

This way you don't have to worry about the filename that was written on disk

゛时过境迁 2024-08-14 19:57:21

假设YourClass是在YourDll.dll中定义的,那么你可以使用以下代码:

  var assembly= Assembly.GetAssembly(typeof(YourClass);
  string dllName=assembly.GetName().Name;  
  Assert.AreEqual("YourDll", dllName);

Assuming that YourClass is defined in YourDll.dll, then you can use the following code:

  var assembly= Assembly.GetAssembly(typeof(YourClass);
  string dllName=assembly.GetName().Name;  
  Assert.AreEqual("YourDll", dllName);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文