I'm quite a newbee in working with images. I need to use System.Drawing namespace and when i try to do it like this: using namespace System::Drawing; i have an error that System hasn't been declared. What should i do? Include somthing?
You need #using <System.Drawing.dll> and of course it have to be CLR project.
Related
I am trying to build a COM Add-In and I get the errors:
'IDTExtensibility2' is ambiguous in the namespace 'Extensibility'.
'ext_DisconnectMode' is ambiguous in the namespace 'Extensibility'.
'ext_ConnectMode' is ambiguous in the namespace 'Extensibility'.
My imports are as follows:
Imports Extensibility
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Core
I used the shared add-in wizard in VS 2010 and I am using VB.NET.
The codes that have errors are anything that contains:
Extensibility.IDTExtensibility2
I couldn't find this anywhere and I figured the wizard would work without errors. Any thoughts? Thank you.
Check whether one of the Microsoft.* namespaces already imports the Extensibility namespace.
If not, there is possibly an upper-/lowercase ambiguity, try whether you can access the class in C# or through reflection.
If it still does not works, there probably goes something wrong during interop proxy generation but then it get's complicated, you have to use the tlbimp.exe tool and toy around with its options.
If you try to use Windows as part of your own namespace in Metro-style apps (e.g. MyCompany.Windows) it seems that it throws compiler(s) off, because they start looking for WinRT stuff under your namespace rather than Windows.*.
For example, if you create a blank Windows Metro style app named App1 and rename App1 namespace to be App1.Windows and try to compile it you'll get an error:
The type or namespace name 'UI' does not exist in the namespace 'App1.Windows' (are you missing an assembly reference?) F:\temp\App1\App1\obj\Debug\App.g.i.cs
the top of the generated file looks like this:
namespace App1.Windows
{
#if !DISABLE_XAML_GENERATED_MAIN
public static class Program
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
static void Main(string[] args)
{
Application.Start((p) => new App());
}
}
#endif
partial class App : Windows.UI.Xaml.Application
and the problem is that compiler starts looking for Windows.UI under App1.Windows.
Now this is nothing new and if you'd name your namespace App1.System before you would probably get into a similar kind of trouble at some point. The problem is that quite a lot of WPF/Silverlight/Windows Phone code out there uses MyCompany.Windows.Xyz namespaces and is probably susceptible to this kind of trouble.
Is there some guidance from Microsoft (can't seem to find one) as to what to do with these namespaces? Or maybe there are some plans on resolving this in future versions? Or am I just missing something?
I looked at this issue and we should be using global:: in the generated code. We have fixed this on our end and will be available in next release of Visual Studio.
This is a known behavior in the C# language specification. Basically whenever a namespace appears in a "using" clause, the system treats all the elements in the namespace as if they might be part of the using namespace. There are two workarounds: Remove the name "Windows" from the inner nodes in your type or remove the "using" directive.
This is unfortunately not a winrt issue, you can get the same thing to happen with pure CLR applications.
I am converting a SL3 application to SL4 and facing some issues.
Can anyone provide me the namespace or DLL name for ValueConversion.
I am getting error on the following statement.
[ValueConversion(typeof(ToolType), typeof(bool))]
Thanks for sharing your time.
This class is not part of Silverlight Runtime Classes now.
it was there in System.Windows.Data namespace before.
Ref: http://msdn.microsoft.com/en-us/library/system.windows.data.valueconversionattribute.aspx
you can use IValueConverter interface as before.
I use the following implementation in ClipFlair Studio:
http://ClipFlair.codeplex.com (see Client/Helpers/WPF_Compatibility/WPF_Compatibility.Silverlight project at the sourcecode)
I am trying to use the marshalling library in my C++/CLI project. When compiled with #include <msclr/marshal.h> I get the error error C2872: 'IServiceProvider' : ambiguous symbol. Most of the resolutions seems to be suggesting moving #include <windows.h>
like the one here -> Ambiguous references, but I dont have those includes. All I have is:
using namespace System;
using namespace System::Configuration;
using namespace std;
#include <msclr/marshal.h>
How do I debug this issue ?
You do, indirectly, marshal.h includes it. It dumps an enormous amount of identifiers in the global namespace. The macros are especially awkward, lots of them match names used in the framework.
Lots of things that marshal.h does can be done by the Marshal class as well. But I can't help you with that, you didn't mention why you want to use it. You can solve this particular mishap by putting the #include directive before the using statements:
#include <msclr/marshal.h>
using namespace System;
using namespace System::Configuration;
Make sure you only have the:
using namespace System;
in the cpp file of the CLR project and not in the header.
Visual studio automatically adds it to the header when creating a CLR class library project.
In the cpp itself, the includes must precede the "using namespace".
I have a class (e.g. MksMath) written in IronPython using SharpDevelop 3.2. After compiling it for class library, it produced the following output:
IronPython.dll
IronPython.Modules.dll
Microsoft.Dynamic.dll
Microsoft.Scripting.Core.dll
Microsoft.Scripting.Debugging.dll
Microsoft.Scripting.dll
Microsoft.Scripting.ExtensionAttribute.dll
mksmath.dll
If I try to add reference to all above dll and import "MksMath", I am unable to access it. The vbc is throwing the following error:
Namespace or type specified in the Imports 'MksMath' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
I am new to IronPython. Kindly advise how to use this class in my vb.net code?
I post here my answer that I posted to IronPythopn mailing list :-)
You cannot use mksmath.dll directly from VB (see Compiling Python code into an assembly) so you have to host IronPython engine in your VB app and use mksmath.dll from the engine. See Using Compiled Python Classes from .NET/CSharp IP 2.6 for example (in C#).
Here is a link that I think may solve the issue. http://msmvps.com/blogs/theproblemsolver/archive/2008/08/14/calling-ironpython-functions-from-net.aspx