Generation of designer file failed: Could not load file or assembly

后端 未结 9 1904
别跟我提以往
别跟我提以往 2021-02-09 15:56

I have an ASP.NET web application project which references another project called ModusCore (or Modus.Core). We\'ve had a variety of controls that use ModusCore up until now wi

相关标签:
9条回答
  • 2021-02-09 16:08

    I'm using ReSharper Platform 6. I was able to resolve this issue by doing the following:

    1. ReSharper (Menu Bar) > Options...
    2. Environment > General > Clear Caches
    3. Restart Visual Studio
    0 讨论(0)
  • 2021-02-09 16:10

    My solution:

    1. Close and reopen Visual Studio.
    2. Is your problem fixed? If not, go to 1.
    0 讨论(0)
  • 2021-02-09 16:11

    Copying the missing assemblies into the Visual Studio\Common7\IDE\Public Assemblies directory gave me more specific error messages than 'could not load file or assembly'. From here I commented out some problematic parts of the page, deleted the .designer.cs file and chose "Convert to Web Application" from the right-click context menu of the .ascx file.

    0 讨论(0)
  • 2021-02-09 16:15

    Well, I've had this very problem for two days. As far as no proposed solution completely solved the problem (it looks very... erratic), I reached the Assembly Information button (or something similar... my VS is in Spanish) in the Application Tab of the project properties. I've only changed the Neutral Language... and now it deploys correctly.

    I have no idea of the correlation, but I reached here after seeing how some errors, related to the assembly information were displayed on the console after "converting to Web Application".

    To ensure that your web application is OK to deploy, you can see the first lines of the aspx files and check if all CodeFiles are CodeBehind instead. If you see "Codefile=...", it will fail on the deployment machine.

    Sorry for not being more explicit, but this is a weird issue to me :S

    0 讨论(0)
  • 2021-02-09 16:16

    I've been struggling with this problem all day, and you wouldn't believe what the culprit was. I disabled ReSharper 5.0 and all of a sudden the errors went away. Unbelievable.

    0 讨论(0)
  • 2021-02-09 16:17

    I had a similar issue but with assemblies that we had created. In our case the version number was very specific, so this may not work if all your files say 1.0.0.0.

    First of all, delete the designer file for the problematic aspx file. Right-click the aspx file and select "Convert to Web Application", similar to what others suggested. Doing it on the file is faster and you get a popup with the error instead of a warning you have to look for. In our case the error was Generation of the designer file for OurPage.aspx failed: Could not load file or assembly 'OurCustomAssembly, Version=1.0.234.567...

    What I then did is use a tool that searches file contents (e.g. Agent Ransack) and pointed it to our source folder (which also has the build/cache files) and searched for files "containing text" with the specific version. For each of the projects that came up, I removed the reference to the assembly that was failing, re-added it, then rebuilt the individual project. Searching again showed that the version was gone.

    I ran Convert to Web Application again and now got the same error but with a different file. This time none of the above worked. I was able to determine that only some of the Register tags were problematic. I removed those register tags, created protected variables on the page's code-behind (since they weren't in the designer file) and recompiled the solution. Afterwards I removed the variables I had created, saved, readded all the Register tags, saved. At that point the designer file generated successfully.

    There may be a more straightforward way to do all this, but that's what ended up working for me. Time will tell, but hopefully this is a permanent fix.

    0 讨论(0)
提交回复
热议问题