简体   繁体   中英

referencing dotnetnuke.dll from another folder on asp.net

I have dotnetnuke portal on server in /root/dnn and I am creating asp.net app in c# VS2008 that I need to upload on /root/app.

when I deploy my app, it needs to reference dotnetnuke.dll assembly from /root/dnn/bin instead of /root/app/bin.

how can I manage that, without putting app files in /root/dnn?

I tried to set auto-refresh path and then after upload deleting the /root/app/bin/dotnetnuke.dll so that the app tries to reference the missing assembly in ../dnn/bin/dotnetnuke.dll but the "application is not pre-compiled" error pops, so I tried to upload it without pre-compiling, but still the reference couldn't be found.

Why not give your app it's own copy? That would solve all problems...

In other words, why the cross-app reference? It goes against all security mechanisms of IIS and ASP.NET

As Purple Ant said above, either

  1. load the DotNetNuke assembly into the GAC (which is troublesome because it precludes you from being able to XCOPY upgrade DNN later)
  2. Put your app into the DNN application folder (sounds like what you did)
  3. Copy the DNN dll into your app folder. (the most common solution)

What you're thinking of is the <probing privatePath="" /> element of the config file. But I don't think it's available to be used in web apps and (according to the documentation) only works for subfolders.

<configuration>
   <runtime>
      <assemblyBinding>
         <probing privatePath="bin;bin2\subbin;bin3"/>
      </assemblyBinding>
   </runtime>
</configuration>

After all, I had to upload .aspx and .aspx.cs files in portal folder and bin files in dnn's bin folder, add the few lines from my web.config to dnn's web.config, and change queries to database by writing them from code instead using dataset objects, that is .xsd, .xss files. I also had to copy the code from my App_Code into my .cs files before upload because C# and VS cannot be compiled together in dnn's App_Code.

I think your best bet with what you are trying to do is to install the DotNetNuke.dll into the GAC on the server. I don't believe that ASP.NET/IIS will allow access to any assemblies outside of the current websites folder structure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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