0

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
TheLethalCoder
  • 6,668
  • 6
  • 34
  • 69
  • 1
    The `obj` folder does *NOT* contain the final binary code, it's essentially a temporary folder. Publishing does *not* use anything from `obj`. How did you publish the web site? What settings did you use? Did you select the wrong folder perhaps? What version of Visual Studio are you using? – Panagiotis Kanavos Jun 30 '16 at 15:13
  • thanks for the reply. VS version 2010 and 2012, no difference at all. Website is published with local publish to filesystem (right click on project name and publish). settings used are: local folder (c:\publish), delete all files prior publish, precompile application – Emanuele Andreoli Jun 30 '16 at 15:14
  • have you cleaned and rebuilt the solution? May sound stupid, but sometimes VS will miss that a DLL has been modified and won't overwrite it. – user1666620 Jun 30 '16 at 15:18
  • @panagiotis: i agree with you that obj does not contain final binary code. nonetheless is used as a temporary store to compile and build the binaries. These should be then put together and "copied" to the publishing folder. In fact, if i don't flag "precompile" the dll version in my publishing folder is exactly the one in obj – Emanuele Andreoli Jun 30 '16 at 15:18
  • @user169... done a milion times. clean and rebuild, switched visual studio version, tried on several different machines, restart.. really man, don't know where to bang my head – Emanuele Andreoli Jun 30 '16 at 15:19
  • 1
    Don't bang your head, don't look for bugs and provide at least *some* info and forget about `obj`. If the dll in `bin` is OK as you say, why do you bother with `obj` at all? Your site would work if the class was in the dll. Post the Visual Studio version and the settings you used. Also post the *full error* – Panagiotis Kanavos Jun 30 '16 at 15:22
  • i really don't understand. what i am saying is: i have a project. added a class file. pressing F6 compiles and debugs correctly. checked the dll with ILSpy and the class is there. when i publish the project, from within visual studio the dll does not contain the class – Emanuele Andreoli Jun 30 '16 at 15:26
  • wait... you said you checked the DLL in the *debug* folder - are you publishing the solution in debug or release mode? – user1666620 Jun 30 '16 at 15:26
  • btw, i'm not looking for a VS bug. I am pretty sure there's something wrong that is NOT a bug. The only thing is i can't understand what it bloody is... – Emanuele Andreoli Jun 30 '16 at 15:27
  • tried both debug and release publishing. it seems that there's no difference at all – Emanuele Andreoli Jun 30 '16 at 15:28

1 Answers1

0

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.

TheLethalCoder
  • 6,668
  • 6
  • 34
  • 69