Server Error in '/' Application. Error while Compiling the Code - mysql

I am often getting this error
<%# Application Codebehind="Global.asax.cs" Inherits="xxx.MvcApplication" Language="C#"%>
Did i miss anything in my code??
Error 6 The type or namespace name 'Data' does not exist in the namespace 'Microsoft.Practices.EnterpriseLibrary' (are you missing an assembly reference?)C:\Users\Administrator\documents\visual studio 2012\Projects\xxx\xxx\Controllers\BaseController.cs 7 45 xxx
Any Help will be appreciated.

Find the type or namespace "Data" in BaseController.cs, and make sure you are referencing the correct assembly.
also, right-click the project in visual studio and make sure all the references in the project are ok, you'll see a warning sign beside any reference that can't be found. if there are any missing references, open up project properties > reference paths > add the folder to the relevant assembly.

Related

SSRS project does not compile since migration - error BC30451

Since I have migrated my SSRS project to 2017, I'm getting over 300 errors like this one: "[rsCompilerErrorInExpression] The Color expression for the chart 'Chart18' contains an error: [BC30451] 'Helper' is not declared. It may be inaccessible due to its protection level."
Helper is our custom C# project including all our custom functions and properties used by the reports. I found a post that explained that I must put a copy of the dll into the folder: C:\Program Files (x86)\Microsoft Visual Studio xx.0\Common7\IDE\PrivateAssemblies\ depending on the VS version. But, I still get the same error.
I also checked the namespace but, in fact, nothing changed since years.
Any idea?
Regards,
Pascal

Nancy, First razor page not working

I'm trying to get a first Razor template working with Nancy, and the first line of my .cshtml...
#inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<dynamic>
gives me 3 build errors including the following...
'NancyContext' does not contain a definition for 'ApplicationInstance' and no extension method 'ApplicationInstance' accepting a first argument of type 'NancyContext' could be found (are you missing a using directive or an assembly reference?)
One very weird thing is that I have three "errors", but they're not stopping the build. They show in the Error list, the classes are underlined in red in the Solution explorer but not in the code window. Don't believe me ? Screenshot follows...
Update
I've fixed the first two errors by adding explicit references to System.Web.Helpers and System.Web.WebPages. The remaining error, 'NancyContext' does not contain a definition for 'ApplicationInstance', is still bugging me. ApplicationInstance is a type in System.Web, for which I have a reference. If I delete the System.Web reference the project still builds. If I add the reference I still have the error.
I got the same error today and then noticed that the project was getting build in "Build + IntelliSense" mode (as in your screenshot), going to the dropdown their and building in "Build Only" mode resolved my errors!
All I can say is that ApplicationInstance is not a Nancy type. Perhaps you are missing a namespace or assembly include? https://github.com/NancyFx/Nancy/wiki/Razor-View-Engine
Other than that, you are going to have to share a lot more information or there's not much to go on

Generated index.html in Sandcastle only includes first project

I'm using Sandcastle Help File Builder to document the projects in a C# solution. I have it generating HTML Help 1 as well as Website
The HTML Help 1 file generated (.chm) is fine, so I know the basic documentation build process is working, and I can see all my classes. The website is mostly fine, but it has one serious problem: The index.html only references one project (the first project, alphabetically). You can access any of the documentation for the other projects in the solution from the index.html file.
Anyone know how to fix the index.html file?
I solved this by checking "Enable namespace grouping if supported" option in the Help File section of Project Properties.
I know this is old. but i bump into this problem too.. I cant use "enable namespace goruping if supported" since its throwing an error..
I also notice that the heirarchy of the html files are
Help fileName
namespace 1
namespace is not under the help file name..
so i played with the tool and found out that when enabling on
"Include root namespace container" (dont enable "Enable namespace grouping if supported")
Right now it will give you a heirarchy of
Help file name
Title Name
namespace 1
namespace 2
namespace 1 and 2 is under tile name its under help file name

Razor “The type or namespace name 'x' could not be found” Error. Compile Only

I have run into an issue with my razor templates.
In the the template I am using it has two using references at the top of the file.
#using Framework;
#using Bundler;
Both of these reference internal namespaces in my project that are both included as refs in the project that is compiling the template. However the bundler reference fails with the classic.
Unable to compile template. The type or namespace name 'Bundler' could not be found (are you missing a using directive or an assembly reference?)
This to me is a bit weird because if I parse the template instead it works fine.
So it is really only a performance issue but as it doesn't effect the site from running correctly.
Is there any reason why compiling (Razor.Compile(content, Name);) fails when parsing (Razor.Parse(content, model, this.Name)) Doesn't?
Thanks for the help :)
So I found a solution.
If I call a method in the namespace before the razor.Compile it seems to fix the issue.
I created a method called helloDll anywhere inside of the namespace that is failing.
public static void helloDll(){}
I call this before my compile
Bundler.cvStyleBundle.helloDll();
Razor.Compile(content, Name);
No more error :)
I think it has something to do with just in time dll loading and the fact that the dll is not loaded at the time of compile and because the compile happens in some weird lovely funky way it doesnt load the dll rather it just grabs all existing ones from the project :)

Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5

The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include System.Data.Objects, but now my views.
I am using MVC 4, my project was upgraded from MVC 3.
Entity Framework is version 5.
I have a controller that is able to use objectcontext from System.Data.Objects.
My Usings:
using System.Data.Objects;
using System.Data.Entity;
When I try to include the using in the view form System.Data.Objects, I get :
CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I am targeting .net 4.5
My Build Displays this message:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
You can build your solution in diagnostic mode to get more detailed information about the error.
Open the VS Options dialog (Tools > Options), navigate to the "Projects and Solutions" node and select "Build and Run". Change the MS Build project build output verbosity to Diagnostic.
Have a look here.
If you look at the build message, it states the 4.0 version of the .net framework is referenced... Is there a setting in your project file or web/app.config specifying a conflicting version of the .net framework?
Are you familiar with fuslog? you can set it up to log all assembly bindings that .net is doing while running your application. You should then be able to see detailed information on what is getting bound when. If you still can't figure it out, you can always do a binding redirect on that .dll in the web.config.
http://msdn.microsoft.com/en-us/library/eftw1fys.aspx -- binding redirects
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.71).aspx -- fusion log viewer
Set up fusion logger and take a look at what the output is. If you don't get an answer from that, try the binding redirect (which would give you at least a temporary solution).
In the directory I was publishing to, there was a folder named aspnet_client. I moved it (instead of deleting it), republished, and it worked. I'm not sure why that folder decided to give me trouble out of the blue.