Precompiled Web App still uses "Temporary ASP.NET Files" folder - asp.net

OK, I'm totally confused. I need to update an old ASP.NET Web Application but I'm totally unfamiliar with Visual Studio...
The updated web app uses some DLLs which are compiled as part of the solution and placed in the web app 'Bin' folder. Two of these DLLs require other files in the same folder.
My problem is that, even though I publish the web app (locally for now) with the option "Precompile during publishing", at run time these DLLs are copied to the "Temporary ASP.NET Files" folder without their supporting files.
Is there a way to have ASP.NET use the DLLs in the 'Bin' folder without copying them somewhere else? Or is there a way to 'attach' the supporting files to the DLLs so that they get copied as well?
And no, I have no idea what I'm doing at this point...
I found this unanswered question that is essentially the same thing (answers talk about properties I don't have).

We ended up adding an appSettings key/value to web.config that the DLL use to find the required files.
<configuration>
...
<appSettings>
<add key="sExeFolder" value="C:\Project\Support_Files"/>
</appSettings>
...
</configuration>

Related

Relocating config files of depending assemblies

My application uses NLog as a logging framework hidden behind a facade in MyLogging project. The project is referenced by a number of web sites to not make them directly dependent on NLog. After compilation NLog.config from the logging project ends up in bin folders of each site and NLog manages to find it automatically during startup. That is understandable and pretty much OK. However, editing any file within bin folder forces ASP.NET to restart the working process so I'd like to have NLog.config one folder up beside regular web.config.
Things I'm trying to achieve\avoid:
Keep NLog configuration in a single file `cause it's the same for all of my web sites
Not to embed it into sites web.config (to not trigger ASP.NET auto-restart)
Just moving the file after building projects with msbuild command is not an option because the sites are deployed to Azure (moved files won't be packaged during publishing process)
I'd like to avoid messing with post-deployment scripts and hard coding things like E:\siteroot\0
The issue is not actually NLog specific as I'd have same trouble with standard app.config files. What are my options here?
For ASP.NET applications, it's recommend to set:
"Build Action" to "content". Otherwise it won't be copied to the root folder (folder with web.config)
"copy to Output Directory" to "none". Otherwise it will be copied to your bin folder.
See:

Publish dll with website to Azure using Visual Studio

My (C# Asp.net) website works locally, but when I publish it to Azure, it is missing a dll (OpenXML SDK).
After extensive googling, I found that I should set the Copy Local property to True. The thing is though, there is no references node in my solution explorer. Even if I create a new project, and add a few references, there is no references node there. (MS Visual Studio Express 2013 for Web)
Here is the error:
Parser Error Message: Could not load file or assembly [...] The
system cannot find the file specified.
The error is caused by this line (in my Web.config file):
<add assembly="DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Please help me to either:
display the references node
or manually upload the needed dll (feels odd)
or add some magic command to my Web.config to make it automatically upload the used dll-s.
The references node was missing from my Solution Explorer because I chose to create a Web Site, not a Web Application. For Web Sites, the actual physical folder structure is what gets synced to the server. It doesn't have a References node (and, by the looks of it, many other things are missing, since the basic idea is bit different - see this discussion for more details).
There were two solutions for the problem:
Converting my Web Site project into a Web Application project (instructions here)
Adding a Bin folder in my project folder (that is the folder with the project name, the on that has my .aspx files in it), and including the necessary dll in that folder
I chose the latter. After publishing the site again, Visual Studio automatically uploaded the Bin folder with the dll inside it, and it worked like a charm.

Web Api referencing old assemblies in temporary ASP.Net files

I have a Silverlight client that's hosted in an ASP.Net Web Api. If I run my project I get the following:
I have recently restructured and cleaned up my solution but broke a couple of references which I managed to fix again. Clearly I missed something - why is the project referencing a file from the
AppData\Local\Temp\Temporary ASP.Net Files\
directory which is using an old assembly name?
I've checked all references in web.config, cleaned up all my .Net temp folders, cleaned my solution and rebuilt however the problem persists. I've also deleted my bin\ and obj\ folders just to make sure but same error.
Can anyone guide me on how to solve this?
There are 2 options for the issue you described:
The new WebApi.dll needs to be copied over in your bin directory and your web.config should not include, version, culture and PublicKeyToken details.
or
Your new WebApi.dll needs to be in the GAC (C:\Windows\Assembly) and your web.config should contain at least a valid PublicKeyToken.
Unfortunately the only solution I could muster was to recreate the web project.

Deploying a asp.net mvc4 application to godaddy

I created an ASP.NET MVC4 application using C# on Visual Studio 2012. But facing a hard time deploying it. I uploaded all the folders of my project onto my server (godaddy). But still cant view my website running.
My question: Is this enough to deploy my site ? Or anything else needed?
You can bin deploy an MVC4 app to GoDaddy.
Just copy the relevant MVC4 related DLLs that you need to your production bin directory.
Alternatively, you can set "Copy Local" equal to "true" in the Properties window for any of your MVC4 related project references as described in this blog post. Then when you do a Publish of your application, all of the needed assemblies will be included automatically.
You probably won't need all of these, but in an MVC4 app I currently manage on GoDaddy, I needed to manually include the correct versions of DLLs for:
System.Web.Abstractions.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Optimization.dll
System.Web.Razor.dll
System.Web.Routing.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll
sure, you can deploy your MVC 4 application. Godaddy supports MVC 4.
What I have done to deploy my MVC 4 application is:
1. I included DLLs such as:
System.Web.Mvc
System.Web.Routing
System.Web.Abstractions
2. I edited web.config file. I put next strings:
<system.web>
<trust level="Medium"/>
.....
</system.web>
3. Then I used the File System publish method and then I used FileZilla to transfer the files to the GoDaddy. I copied all files to httpdocs directory. You must copy just to *httpdocs directory.*
That's all. Good luck.

ASP.net Bin directory - dll loading

I need to use a dll in my asp.net application. How do I load a dll not from a bin directory?
Perhaps I should mention that the application is a mixture of asp code and asp.net code.
so, when I develop it on my machine, I place a dll in the bin directory, but after I move the code to the live environment, I don't want to have a separate bin directory for every piece that's using asp.net.
All I am moving is .aspx and .aspx.cs files. Is there a way to load a dll NOT FROM /bin (specify it with "using" statement)? Looks like it automatically looks in the /bin....
You can either place the DLL in the bin folder of the root of your application, or install it to the Global Assembly Cache (GAC) using gacutil (which requires the assembly to be strong-named and signed).
I would just keep it in the bin.
.net app looks in the /bin of the project, and the GAC (Global Assembly Cache) where you put system shared DLL-s.
If your app is one .net app (configured in IIS as one app), but you have aspx files in subfolders, they should see the root /bin folder. i'd stick with keeping dlls in /bin, if that isn't several tenths of bins (which would mean that you have a problem with your app organization).
GAC and bin are the only usual options.
You might also be able to configure your other folder as an additional bin folder, but I wouldn't hold my breath — this is from 1.1 and you still need to be within the same vdir as the main application.
Simply add the other dll's directories to your path environment variable. Must restart asp.net process / visual studio for the change to take effect. Worked for me.
that's the thing: because it's poorly organized (its a mix of asp and asp.net) it's certainly NOT configured properly....I think it's best to have "10 thousands bins" for now.
Thanks guys!

Resources