Search code examples
c#web-publishing

Visual Studio When publish some class is missing from DLL


I have a solution containing a website, with lots of files.

It recently happened that a new webpage had to be added to the site. When building the solution with the new files, everything works. When trying to use the Web Publishing Wizard, the process breaks up.

Basically, this is what happens:

  • new page (e.g. myPage) added to the webproject
  • build locally in visual studio, everything is all right. Final assembly has all the classes included in code base.
  • publish the website to filesystem (right click and Publish from CSProject), precompilation throws error saying that class "myPage" is missing.

I've checked the Dll version (e.g. myWebSite.dll) in the three usual locations:

  • \bin -> compiled code is complete, including "MyPage" class
  • \obj\Debug\Package\PackageTmp\bin -> compiled code is NOT complete, new classes are MISSING including "MyPage" class
  • \obj\Debug\AspnetCompileMerge\Source\bin -> compiled code is NOT complete, new classes are MISSING including "MyPage" class

Solution

  • Solution is designed like so, with circular references:

    MySolution
        Project A
        Project B
        Project C
        ...
    

    Project A references Project B, which references assembly output from Project A.

    When building locally, everything worked because the assembly generated from A was ProjectA.dll and was regenerated. It looks like when using "publish" from within visual studio (Web Publishing, not TFS build and publish feature) it messes up with references and the resulting Dll is missing of some parts.

    This defect is caused because the referenced circular assembly was not the latest one, but an outdated one.