简体   繁体   中英

VS2010 DLLs not updating

I have a solution (ASP.NET, .NET 4.0) that doesn't seem to be updating its dlls properly. I noticed that, when I compile it after making changes, it doesn't see the additions that I've made.

I recently switched the targeted platform on the solution to x86, because we're now deploying it onto a x64 server and I am now maintaining it on a x64 Win7 machine. (I don't know if that might have something to do with it, see below.) After I isolated the problem, when I was testing, I found out that if I chose "view in browser" on one of the aspx files, it suddenly saw the changes that I had made earlier. I combed through the directories in the main project's bin folder, and I noticed dlls were being saved to two different places: the root of the bin folder, and bin/x86/debug/. The first location was getting updated when I simply compiled the solution, and the second was getting updated when I used "view in browser" on one of the aspx files.

Does anyone know of an errant setting which might cause this behavior?

Update: The answer provided by @Vinkal leads me to believe that Debug is looking at the bin/ folder for compiled code rather than bin/x86/debug/ , where the code is being compiled to. Is it possible that could be the core problem?

I combed through the directories in the main project's bin folder, and I noticed dlls were being saved to two different places: the root of the bin folder, and bin/x86/debug/. The first location was getting updated when I simply compiled the solution, and the second was getting updated when I used "view in browser" on one of the aspx files.

Check Configutation Manager as to what platform is selected as shown in the below screen shot#1.

Screen shot #1: Configuration Manager

配置管理器

if you create the new platform (here x86 ), Output Path is automatically set to bin\\x86\\Debug\\ . See the screenshot below.

Screen shot #2: Build Settings when Project Properties is selected

从项目属性生成事件选项

So when you compile the project, Binaries will be copied according to Output Path (here in my case, bin\\x86\\Debug\\ for the Platform x86 which is set in Platform Target ). Confirm as shown in the screen shot below, where all binaries are copied when you compile. As you have mentioned, when you compile the solution, Root of the bin folder is getting updated. So your project Output Path must be set to Root of the Bin folder for the whatever Platform (Any CPU, x86 or x64) you have set in Platform Target

Note: If Post-Build event commmand is set to copy Binaries, it will also be copied to the Path specified in Post-Build event command .

在此处输入图片说明

View in Browser: When page is opened using View in browser , page will again be compiled and Binaries are copied according to the Output Path specified in Project Properties as shown in the screen shot #2 . As you have mentioned that bin\\x86\\Debug\\ is updated when you view the page in Browser, it indicates that Output Path is set to bin\\x86\\Debug\\ in your Project Properties , In the screen shot shown below, when page is opened using View in Browser , Binary is going to Bin folder and Platform is selected as Any CPU

在此处输入图片说明

Post-build event command: if you have also set the Post-build event command , as shown in the screen shot below, to copy the path in different location, in both the cases (ie when you compile and View in Browser ), it will be copied to the Path specified in Post-build event command

在此处输入图片说明

EDIT:

As mentioned here , use the <probing> Element:

You can use the element in the application configuration file to specify subdirectories the runtime should search when locating an assembly . The following example shows how to specify directories the runtime should search.

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="bin;bin2\subbin;bin3"/>
      </assemblyBinding>
   </runtime>
</configuration>

The privatePath attribute contains the directories that the runtime should search for assemblies . If the application is located at C:\\Program Files\\MyApp, the runtime will look for assemblies that do not specify a code base in C:\\Program Files\\MyApp\\Bin, C:\\Program Files\\MyApp\\Bin2\\Subbin, and C:\\Program Files\\MyApp\\Bin3. The directories specified in privatePath must be subdirectories of the application base directory

So in your case, modify the web.config as shown below

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="bin;bin\x86\debug"/>
      </assemblyBinding>
   </runtime>
</configuration>

您可以尝试通过在“工具”->“选项”->“调试”->“符号”中更改不同的配置来解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM