While working on an ASP.NET MVC application, I meet the good old "The current source code is different from the version built into App_Web_blahblah.dll" when I'm trying to debug a CSHTML file, whatever I do (deleting Temporary ASP.NET files, PDBs, cleaning and rebuilding, etc).
What's more disturbing is that the related CSHTML page isn't compiled anymore. I mean, the application keeps showing an old version of the page, even if this one has changed.
There's no errors on this page (the same source code works OK on another machine). Even if there were, I would get a YSOD and that's it.
More importantly, it keeps displaying data that isn't in the source code anymore, and even if I cleaned the temporary files and DLLs everywhere before, so I can't work on this page anymore.
I checked there and there, but none of the answers solved the problem.
So my question is simple : where can the application find code that isn't anywhere (AFAIK) ? Is there another location that I'm not aware of where compiled files can be stored ? What's happening ?
My comment helped so I will write an answer.
This error was caused adding to project file from another destination. You were modifying file which wasn't in correct folder, but old one was still there. Application was running the old one, because it isn't looking at csproj file, but only at files there are placed exactly in Views folder.
Related
I'm new to ASP.NET, and making a small update to a site that already exists. I am confused about the differences I see on the production server vs. the source code I've been given, and would appreciate any explanation or advice. Normally I would just continue reading and researching until I understood fully, but in this case I've been asked to make a small update to something ahead of my understanding. All I need to do is change one element in a form.
On the production site, there are files like \contact\survey.aspx; no .cs files exist in the directory alongside them, and there's no CodeFile directive. Instead, there are a multitude of DLL files corresponding to these pages, like bin\App_Web_survey.aspx.fdf9difs9.dll.
When I was given the source code of the site to edit, I see something different. The bin folder is entirely lacking in these DLL files corresponding to pages; instead, each aspx file has an aspx.cs file sitting next to it in its folder, a code-behind. Fair enough, I think; the site can run in its interpreted mode, like this, or compiled to DLLs.
Problem is, for the life of me I cannot work out how to do that; I've read dozens of pages on the MSDN library and gotten nowhere.
I am using Visual Studio Express 2013 for Web, and I've opened the source code folder as a website. When I run 'build', it succeeds, but no DLLs are made, not even in the Debug folder. This MSDN page has instructions for compiling web application projects, but the options don't correspond to the available options for me, so I'm guessing that either web application and web site are distinguished or that Visual Studio 2013 (which I also tried using and had no luck with) is distinguished from VS for Web. I'm at a loss.
tldr: Can anyone quickly sum up for me the process of compiling an ASP.NET website in a way that results in multiple DLL files in its bin directory?
You might need to use aspnet_compiler:
aspnet_compiler -p sourceCodeRoot -v / targetRoot
See How to: Precompile ASP.NET Web Sites for Deployment (MSDN).
I am trying to modify the string values for a resx file of an existing application. I have done nothing else apart from just changing the string value to replace a word (from "technician" to "agent"). File name and permissions are same, even the structure and naming convention is same.
Now, these changes do not reflect in IIS. I have restarted app pool, refreshed the application, double checked the permissions. Nothing seems wrong anywhere. I even tried the suggestions in older similar questions, but no luck.
I am not sure, if I need to recompile the whole solution, although, I believe that should not be the case. Do I need to do that? Also, will I have to republish the website from scratch, or can I just replace recompiled files in the IIS folder?
Or is there some other step I am missing?
You need to do a clean build and then just replace the main dll for your site in the bin folder. Sometimes Visual Studio doesn't see the change in resources and, in turn, it doesn't trigger a rebuild on your DLL. Clean build ensures the changes are built.
As per /u/Markus suggestion, I tried to build the code again. After changing the main dll file, and copying the resources folder again, it works.
I have ASP.NET v3.5 website project. My project works at visual stduio on server.But after the publishing, i get error.
"Could not load the assembly 'App_Web_wkfb1ehc'. Make sure that it is compiled before accessing the page."
i think this is an Application Pool problem but i don't know how to fix
This is annoying since I have seen this before and I'm trying to recall how we fixed it.
One thing we did do we totally delete the contents of the site's bin folder on the server, then re-deployed. Basically when you compile your site's code, VS will generate these "App_Web_*" names for the DLL files and sometimes a new DLL file is compiled for a page code-behind, but an old DLL for that page is hanging around in the bin folder, which can cause the error you are seeing (at least I think that's was we thought the problem was :) )
Another thing you could do is to set fixed DLL namings for your project. Info on how to do that can be found here: http://msdn.microsoft.com/en-us/library/aa992037(v=vs.80).aspx. If you still get problems after changing that setting, then have a look at this SO question:
ASP.NET WebForms Deployment - Setting the compiled \bin directory DLL names
I've got a Silverlight application with one Silverlight project and a host web project.
I renamed the namespace of the Silverlight application where the App.xaml is in. I did this via a refactoring tool. Afterwards the debugger just ignored the breakpoints. It's popping out the error shown in the title of this thread.
So I thought that maybe the refactoring tool fails, so I recovered the project with the old namespace in and renamed everything by hand (find in files). The app works, still, but I get the same error.
What the heck is this?
It sounds like the xap file name changed and you need to update the javascript to reflect the new name change. ;-)
Okay I solved this problem. My refactoring tool renamed everything fine. Even the name of the actual .xap file, which gets generated. The only thing which the refatoring tool did not fix is this line:
<param name="source" value="ClientBin/OldXapFileName.xap"/>
This was the reason, why the hosting project loaded the old xap file, everytime is started the application.
#Andrei Schneider: Thanks anyway. Your comment got me to deleting the ClientBin folder. So I've been asking myself why my application crashes, even though the new xap file got copied into the ClientBin folder.
I have an issue where a dll shown twice in the Modules debug window for my WCF service (hosted by an IIS Project).
They are both loaded from my "Temporary ASP.NET Files" folders.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\d9bf3211\b2544e2b\assembly\dl3\4cfa5823\28f464b9_9a03cd01\InversionOfControl.DLL
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\d9bf3211\b2544e2b\assembly\dl3\4cfa5823\2457a584_9803cd01\InversionOfControl.dll
The paths are almost exactly the same, but the folder name that holds the dll is different.
So here are my questions:
What is "Temporary ASP.NET Files" for?
Why not just reference the dll that is in my build folder.
How could I have gotten two?
How can I prevent it from happening again?
If I just delete them will this problem be "fixed"?
The ones in bold are the answers I am most interested in.
You can feel free to delete anything below Temporary ASP.NET Files. All of the contents will be generated again (albeit with an initial performance penalty).
Also note that it is easier to use explorer to do this if you kill IIS temporarily. (iisreset /stop, delete the files, iisreset /start).
All you need to know different approaches for compiling your code by asp.net.
Do pre compile your code in order to avoid compiling and storing compiled files in temporary folders.
Hope this article will give you better answer for your questions. http://www.asp.net/web-forms/tutorials/deployment/precompiling-your-website-vb
Deleting them has no negative impact to your system.
.Net will just keep creating them slowly but surely filling up the drive. On dev machines, there are a lot of them. On servers... well, you shouldn't be deploying code to the server that requires compilation anyway.
Regarding whether it will fix your problem... maybe. Go for it.