Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class WebApiApplication : System.Web.HttpApplication
- {
- protected void Application_Start()
- {
- CheckAddBinPath();
- GlobalConfiguration.Configure(WebApiConfig.Register);
- }
- public static void CheckAddBinPath()
- {
- // find path to 'bin' folder
- var binPath = Path.Combine(new string[] { AppDomain.CurrentDomain.BaseDirectory, "bin" });
- // get current search path from environment
- var path = Environment.GetEnvironmentVariable("PATH") ?? "";
- // add 'bin' folder to search path if not already present
- if (!path.Split(Path.PathSeparator).Contains(binPath, StringComparer.CurrentCultureIgnoreCase))
- {
- path = string.Join(Path.PathSeparator.ToString(), new string[] { path, binPath });
- Environment.SetEnvironmentVariable("PATH", path);
- }
- }
- }
Add Comment
Please, Sign In to add comment