TeamCity compilation failure because of excluded files - asp.net

I have a VS2010 solution with web-site project.
It has some excluded files.
When I build the solution with TeamCity,
compilation fails because it misses some files which are excluded.
TeamCity error:
/BT.Account.csproj/Controls/Panels/TogglePanel.ascx(1, 0): error
ASPPARSE: Could not load type
'BT.Account.Controls.Panels.TogglePanel'.

Do a fresh checkout to a new local directory and try to build that. Any error arising in TeamCity should be present in the new checkout. There you can see what really happens. My guess is that the .ascx file is still included in the project.

It depends what your TeamCity does when it runs a build.
If it runs an aspnet_compiler.exe job then you might get this error if your ASPX markup (not the codebehind) has an error in it. I've seen this many times in some of my own TC projects :)
Normally ASPX markup errors are basically ignored until the page is visited (then resulting in a YSOD), but when you do an ASP.Net compile (or a publish) the markup will be compiled down into a DLL in the bin folder. Hence any mistakes will cause a compilation error and make the build fail, with an error similar to yours.
If that's the case, have a look at TogglePanel.ascx and see if there are any errors.
If not, I hope you are able to solve the problem quickly and easily. Good luck :)

Related

TeamCity won't build with NUnit class library

I have a .NET solution set up that has the main ASP MVC project and then a class library project that has had NUnit added to it for unit tests.
When I build the solution in TeamCity the main project builds fine but then when the test project builds I get these errors
error BC30002: Type 'TestFixture' is not defined.
error BC30002: Type 'Test' is not defined.
error BC30389: 'System.Diagnostics.Assert' is not accessible in this context because it is 'Friend'.
I assume it can't find the NUnit.dll or something but the dll is in the solution packages folder. I've tried doing package restore first in case it was that but it still did the same.
Update
Ok, just to test it I added Moq to the project to see if it would pick up the references. It did and worked fine, it seems to be only problem when I try to use NUnit functions. I could disable it from building but surely the NUnit tests won't be picked up in Team City?
Thanks!
Finally fixed the issue and it was my own stupid mistake. Thanks to DevOps for suggesting going through the MSBuild logs, it helped my track down the problem.
The actual DLL wasn't getting checked in to source control because the dev machine that added the test project had a global ignore file to ignore all DLL's. So I thought it was there but it was just the .xml file and I mis read it.
Anyway it now builds and runs the tests.
Thanks for the help everyone

Could not load file or assembly or one of its dependencies for all packages in project

My pc crashed while my asp.net web application began to run. It did not fully load when this happened. When my pc was restarted, the web application would no longer run. I kept getting 'Could not load file or assembly 'name' or one of its dependencies' for all my packages. First time I got the error for one package so I re-installed it and ran the web application again, then a got the same error with a second package and I did the same. This was a continuous cycle and I could not do this for each package I have installed in the project because there are so many.
I tried many solutions that were posted for a single occurrence of this error such as here, and others but these have not solved my problem.
Does anyone have a solution to this problem? Or know why it has happened?
Sorry my friend... this sounds like corrupted manifest files to me (I recently had the same issue). Unfortunately I could not find an elegant way to fix it, although I do have some tips on how you can fix it (albeit an arduous process):
Make sure all your assembly bindings redirects to the latest versions of all your assemblies. MSDN Article on assembly binding redirect Another MSDN article on assembly binding redirect
Set build output to verbose (In VS2013 > Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity. You then need to evaluate the build output from your Visual Studio output window during build to determine the causes of assembly conflicts within your solution as well as were you might find the conflicting assemblies within your solution.

MSBuild fails on temporary ASP.NET files

I'm trying to set up Jenkins with MSBuild plugin. I got Jenkins to check out solution from repository and run a build. But every build fails with several
error CS0433: The type 'CustomControls_WarningPopup' exists in both (...)
WarningPopup is an .ascx defined twice - once per web site project, and there are two website projects in the solution. The thing is this never rises any problems when compiling whole solution from VS2010. Should I run MSBuild with some specific parameters to make it behaving like VS?
I already tried moving Temporary ASP.NET files to custom folder (like in this answer) and it didn't help. Probably I'm missing something obvious to CI experts here...
I found the cause. There was another UserControl in second project which accidentally inherited class of the same name. Both controls were in the same directory and nor Visual Studio during compilation nor ReSharper saw anything wrong with this. Moreover MSBuild threw errors in both Web Projects despite the duplicated control was in only one of them. The funniest part is that this situation was like this for months and never rised any problems...
Anyway changing class of this control solved the issue and finally automated build succeeded!

Errors while compiling asp.net website

Hey guys,
i have a website, i want to place the compile code on the production server, now i took the code on the local machine and trying to compile source code on local machine, but whenever i compile the code, in one of my control(ascx.cs) file i am getting error that the control does not exists in current context, i checked everything, Inherits, CodeFile, even in the code behind(.cs) file, everything is perfect, even i get the control id in the intellisense, when i remove the control and again add the same using intellisense, the errors gets removed but after i publish site, the same error comes again....
Please reply with some suggestion/solutions.
I've had this issue before when referencing another project. It would give it intellisense, but then trying to compile would cause errors and take away intellisense. Removing and re-adding it would give me intellisense back.
The problem ended up being the target framework. The project was referencing .NET 4 Client Profile, whereas the project it was referencing was just .NET 4. Apparently this difference is subtle enough to trip up visual studio in the confusing way described above.
So take a look at your project's target framework, maybe you'll get lucky.
Definitely check your Inherits or CodeFile. I've had this happen before where I had them pointing at the wrong files.

System.MissingMethodException: Method not found

I have some user controls in the project kept under a folder UserControls.
I'm using one of the user control from that folder in my master page and one on Default.aspx. The default.aspx uses that master file.
The problem is that everything was working fine until something happened and it seems user control is not getting compiled. The user control calls a method from Business Logic which was parameterless before (when everything was working fine) but when I changed it to accept parameters and of course its calls too, it started giving the error. It is still searching for that parameterless method..!! :(
I did tried manually deleting the DLLs, deleting the user controls and again creating them. But nothing worked.
Anyone has any idea what I did wrong or what am I missing??
Try checking the build configuration manager (Visual Studio 2008 -> Build -> Build Configuration Manager). I ran into a similar issue and it turned out that one of the projects I was referencing was not marked to actually build (there is a check box that should be checked to build the assembly). Try changing the assembly version number of the assembly that is creating the issue, rebuild, then check that the version number of that assembly is correct.
I came across this problem and it was due to the fact an older version of my bin-deployed assembly existed in the GAC. Unfortunately there is no way to force DLLs to load from the bin directory if the GAC version has the same version number. See here: Dll in both the bin and the gac, which one gets used?

Resources