OK, so with the help of few links provided by Sen Jacob and some more research I've figured out that it is possible to do it all just using web.config.
First of all we need to provide the new path and tell the assembly name since we're steering away from defaults:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Something.Web" />
</assemblies>
</compilation>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bindebug" />
</assemblyBinding>
</runtime>
</configuration>
Now, for some reason everywhere else people suggest specifying privatePath
relative to bin dir (i.e. privatePath="debug"
), however in my case it had to be relative to app root (i.e. as above). Maybe it's a change in .net4 or some other configuration setting I'm missing, not sure; if someone has a better idea feel free to edit/comment.
At this stage, if the server finds the file, and successfully loads the assembly and the class it will start complaining about all the missing referenced files, which I had to add right next to <add assembly="Something.Web" />
:
<assemblies>
<add assembly="Something.Web" />
<add assembly="System.Web.Mvc" />
<add assembly="System.Web.Optimization" />
<add assembly="System.Web.Helpers" />
<add assembly="System.Web.WebPages" />
</assemblies>
From what I've gathered it re-compiles the assemblies on site startup (not sure).
Sources:
1
2
3
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…