I'm currently using CodeFluent Entities and I want to generate a text-based report that prints some statistics about my current model.
The Template Producer meets all my expectations but I've some problems while using Linq extension methods :
[%# namespace name="System.Linq" %]
[%= Producer.Project.Entities.Where(entity => entity.IsLightWeight).Count() %]
I have the following error message :
The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missin an assembly reference?).
Is there a way I can refer other assemblies from a CodeFluent Entities template file ?
You can add template directive at the beginning of the template file in order to add assemblies and namespaces.
[%#template language="CSharp" providerOptions="CompilerVersion=v3.5" %]
[%# Reference name="C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" %]
[%# namespace name="System.Linq" %]
Add reference in your .cs file
using System.Linq;
Related
In a simple project i want to reference objects from a webreference added to another c# library.
The Webreference is called QServices The default namespace is set as below
What seems to work is the following code:
Taskworkflow.SI.QServices.Record[] querysResult = new Taskworkflow.SI.QServices.Record[0];
yet when i import the Taskworkflow.SI - namespace, i keep on getting errors:
using TaskWorkflow.SI;
....
QServices.Record[] querysResult = new QServices.Record[0];
This results in the error:
The type or namespace name 'QServices' could not be found (are you missing a using directive or an assembly reference?)
Could someone clarify this for me?
Thank you for your time.
Note: QServices do only exist inside TaskWorkflow.SI. They do not have any occurences in other projects nor do they have any classes/namespaces/objects that share the name.
I strongly suspect that for whatever reason, you're ending up with a namespace called QServices declared in the TaskWorkflow.SI namespace. So actually you want:
using TaskWorkflow.SI.QServices;
....
Record[] querysResult = new Record[0];
Or you could explicitly alias it:
using QServices = TaskWorkflow.SI.QServices;
....
QServices.Record[] querysResult = new QServices.Record[0];
I have two references in my application. In the BAL code i am able to use the namespace "using TestDAL;"
But I am not being able to use the namespace of BAL in my .cs page. This is the error i get,
CS0246: The type or namespace name 'TestBAL' could not be found (are
you missing a using directive or an assembly reference?)
And one thing in my bin folder too I only have the TestDAL.dll file. How do I insert TestBAL.dll file?
Can anyone help me with what can be possible reason?
Thanks in Advance,
Try this:
Then, click browse and add your .dll file:
That should help you, if not please leave some feedback.
You could also try using alias for your namespace like this:
using namespaceAlias = TestBAL;
Create object of TestBAL objBAL = new TestBAL(); in your cs page. Check out, This codes gives any error or not.
I'm getting a few:
'The type or namespace 'blah' does not exist in 'A.B.C' (are you missing an assembly reference?)
The code looks like:
namespace A
{
using B.C;
public class Blah()
{
//...
}
}
A and B are both assemblies that are included in the solution. Both use .NET 4.0. Assembly B does in fact have a namespace C. Assembly B is included as a reference in assembly A.
Why is it looking for A.B.C when the reference is B.C?
The problem was a typo in a different file than the ones with errors.
In another file I had:
namespace A.B.C
{
//...
}
I must have done an accidental Ctrl-P at some point?
The steps I took to find the offending file:
Open up the most recent file that I had changed
Examine the namespace
Repeat with the next most recent
how i solve this error
The type or namespace name 'ThemeInfo' could not be found (are you missing a using directive or an assembly reference?)
AssemblyInfo.cs
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emgu.CV.WPF")]
[assembly: AssemblyDescription("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
Add a reference to PresentationFramework.dll. You have the correct using statement (using System.Windows;).
I had to add
windowsbase.dll
PresentationFramework.dll
Presentationcore.dll
I ran this simple example from the website and I get the error below when it calls Razor.Parse. How can I fix this???
http://razorengine.codeplex.com/
string template = "Hello #Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });
error CS0234: The type or namespace name 'Markdown' does not exist in the namespace 'ServiceStack' (are you missing an assembly reference?)
Not sure why you've linked to http://razorengine.codeplex.com
The 'ServiceStack' error assumes you want to use the Markdown engine in ServiceStack in which case you should be referencing the RazorEngine.dll that comes with ServiceStack not the one in razorengine.codeplex.com if that's what is done here.
I would imagine one of two things has happened. Either in your configuration file, namespaces have been added within the <razorEngine> configuration section, or the AddNamespace method is being called somewhere to include namespace imports in the compiled template.
The net result, is that namespaces are added to the generated class file, but references are missing. RazorEngine will automatically reference any loaded assemblies in the AppDomain.