I created a custom assembly in C # that will be used by a number of different existing systems, quite a few settings related to making this assembly work with our systems, in order to simplify the task, we decided to create a local NuGet server and collapse the assembly into a NuGet package.
This worked fine, and we were able to add all the dependencies needed for the build, and add the web.config.transform file to merge into any additional required nodes.
Here we hit our first stumbling block ...
Firstly, as I mentioned earlier, the assembly is written in C #, the application we are testing is written to VB.Net. As we use log4netin the assembly, we implemented WebActivatorExit to make sure that it was initialized when the application was launched, that is, we have a class AppStartthat is in the folder App_Start. However, referring to the documentation WebActivatorEx, we noticed that if the project is a website associated with a web application , the class AppStartshould be inside App_Code> and not in the folder App_Start, and should be used PostApplicationStartMethodinstead PreApplicationStartMethod.
Just as the class is AppStartwritten in C # and will sit inside the VB.Net project, we need this conversion to VB only if the target project is VB in order to avoid mess with a lot of configuration files that we are trying to minimize.
In short, the main questions are here :
1.) Can our NuGet package have any conditional behavior , i.e. if his VB.Net project adds a class AppStartto VB.Net, and if it's C #, leave it as C #.
2.) If the project is a website, place this class AppStartin a folder App_Codeand use PostApplicationStartMethod, if the project is a web application, put the class AppStartin a folder App_Startand use PreApplicationStartMethod.
3.) log4net global.asax
4.) , PowerShell NuGet, , , # || VB , 4 NuGet , .
.