Ok, so I'm on this bug for the last 4 hours and I dont know what to do..
I'm using Visual Studio Community 2017 and I opened Consol App(.net core) project. also I'm working on windows 8.1 OS.
I wanted to use Image from the System.Drawing namespace and it keeps giving me that error:
"the type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)"
I downloaded the System.Drawing.dll from https://www.dllme.com/dll/files/system_drawing_dll.html
(to the desktop) and then right click on the right project->add->Reference..->Browse..->System.Drawing.dll->OK
then I saw in the project (in the Solution Explorer) in the project dependencies->Assemblies->System.Drawing so I guess it works right?!
I'm still getting the same error and can't use the System.Drawing namespace, any suggestions?
using System;
using System.Net.Sockets;
using System.Drawing;
namespace client2
{
class Program
{
static void Main(string[] args)
{
try
{
//read image
Image image = new Image("C:\\image\\amir.jpg");
}
}
}
}
System.Drawing is not part of the cross-platform parts of .NET (Core). It depends on GDI+ which is part of Windows. There are plenty of alternatives out there.
Aside: Never download DLLs from an untrusted source.
Related
Ok, so I'm on this bug for the last 4 hours and I dont know what to do..
I'm using Visual Studio Community 2017 and I opened Consol App(.net core) project. also I'm working on windows 8.1 OS.
I wanted to use Image from the System.Drawing namespace and it keeps giving me that error:
"the type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)"
I downloaded the System.Drawing.dll from https://www.dllme.com/dll/files/system_drawing_dll.html
(to the desktop) and then right click on the right project->add->Reference..->Browse..->System.Drawing.dll->OK
then I saw in the project (in the Solution Explorer) in the project dependencies->Assemblies->System.Drawing so I guess it works right?!
I'm still getting the same error and can't use the System.Drawing namespace, any suggestions?
using System;
using System.Net.Sockets;
using System.Drawing;
namespace client2
{
class Program
{
static void Main(string[] args)
{
try
{
//read image
Image image = new Image("C:\\image\\amir.jpg");
}
}
}
}
System.Drawing is not part of the cross-platform parts of .NET (Core). It depends on GDI+ which is part of Windows. There are plenty of alternatives out there.
Aside: Never download DLLs from an untrusted source.
I am just a newbie in Xamarin, so I tried creating the simple Phoneword application available at Xamarin on-line guides.
The solution created in Visual Studio comprises 4 distinct Projects:
A portable class library (PCL) project that holds all of the shared code
A project that holds Android specific code
A project that holds iOS specific code
A project that holds Universal Windows Platform (UWP) specific code
This is how the solution structure looks like:
Now inside the first project an interface has been declared:
namespace Phoneword
{
public interface IDialer
{
bool Dial(string number);
}
}
I now try to use this interface from within the UWP project:
using Phoneword.UWP;
using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Calls;
using Windows.UI.Popups;
using Xamarin.Forms;
[assembly: Dependency(typeof(PhoneDialer))]
namespace Phoneword.UWP
{
public class PhoneDialer : IDialer
{
...
Building the solution ends successfully. But when I try to Deploy
the UWP project I get this error:
The type or namespace name 'IDialer' could not be found (are you
missing a using directive or an assembly reference?)
Can anyone give me hint on what could be the source of this error?
Update
There was one more error I was getting when I tried to deploy:
Error DEP0700: Registration of the app failed. [0x80070005] error
0x80070005: Opening file from location: AppxManifest.xml failed with
error: Access is denied.
I closed the solution, exited Visual Studio started and loaded again and the first error disappeared. So, it seems, there is nothing wrong in consuming an interface, declared in the Code Sharing Project, from within the UWP Project.
The actual error I was getting was due to access rights restrictions of the folder were the project was being deployed.
You are not referencing the Phoneword in your PhoneDialer.cs file. Add this to the top:
using Phoneword; // <== Add this
using Phoneword.UWP;
using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Calls;
using Windows.UI.Popups;
using Xamarin.Forms;
I had a similar issue. The way to fix it is just to restart Visual Studio or reload the solution.
I had the same problem, Add this to your code at the top
using static Phoneword.MainPage;
and it should work fine
The reason it was not working is because you didn't have a reference to it. For some reason the Assets that you import for that course do not have this reference in it.
Had the same problem.
You need to right click on the Phoneword project in the Solution Explorer and click build to build it on it's own.
Then add the using statement for the Phoneword project to your PhoneDialer file.
The reference to IDialer then becomes available.
Alternative titles:
Unity References Bug for Hololens Windows UWP Builds (10.0.10586.0)?
or..... Unity Hololens Builds have access to Standalone Build DLL references?
Quick pre-text: I'm designing an app to run on the Hololens. The game plays perfectly fine inside of Unity. It builds perfectly fine to the PC, Mac & Linux Standalone platforms without error.
However, errors from "missing" references arise when building to the Windows Store platform. (Missing is in quotes because I've thoroughly checked and rechecked that I'm using the right references and that they are located where they should be).
Initial error on trying to build is:
Error building Player because scripts had compiler errors
error: The type or namespace name 'FileSystemEventArgs' could not be found (are you missing a using directive or an assembly reference?)
private void PrototypeFileWatcher_Created(object sender, FileSystemEventArgs e)
{
...
}
When this error is corrected by commenting out the aforementioned function and associated code, and building is attempted again, these errors come forth:
error: The name 'Console' does not exist in the current context
catch (Exception e)
{
Console.WriteLine(e.Message);
}
error: Argument 1: cannot convert from 'string' to 'System.IO.Stream'
using (StreamReader sr = new StreamReader(path))
{
...
}
error: The type or namespace name 'BufferedStream' could not be found (are you missing a using directive or an assembly reference?)
using (BufferedStream bs0 = new BufferedStream(f0))
{
...
}
References are stored at the appropriate location:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Unity Full v3.5\System.Core.dll
References are listed in the heading of the scripts:
using UnityEngine;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Threading;
With all that said. I've tried:
-Changing Api Compatibility Level*
-Changing the project solutions net framework
-#if NETFX_CORE using x = WinRTLegacy.x; #else
-#if WINDOWS_UWP using System; #endif
-Trashing the project entirely and rebuilding from scratch
-And lots more
Struggling with this issue for over a full day now. I've NuGet pkgs, VS tools for Unity (otherwise known as VSTU), I'm using VS2015.
I'm at a complete loss right now. I'm not understanding if I can't build this to the Windows Store Platform as it can't use some of the DLLs that Unity standalone builds can?
HoloLens applications are constrained to using only what is a available in a UWP app. Some things will work in the Unity editor that do not work in a HoloLens Applications because the unity editor builds with mono instead of .net. You should constrain yourself to just things that work in UWP and they will work fine within the editor as well. Even the full set of UWP API's are not yet available to work with on HoloLens.
The full documentation for UWP is here:
https://learn.microsoft.com/en-us/uwp/api/
The subset added specifically for HoloLens is at the bottom of this page:
https://developer.microsoft.com/en-us/windows/mixed-reality/development
Unfortunately there isn't a place that highlights what isn't available. The Visual Studio compiler will help you understand what is there and what is not.
I've been having issues with compiling code. The code was running successfully, and I uploaded it to Team Foundation Server. However, when people (including myself) downloaded the code from Team Foundation Server, the code produced the error:
"Error CS0246 The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?)"
I've got the newest version of Xamarin.Forms.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
namespace XamlSamples
{
public class App : Application
{
public App()
{
// The root page of your application
MainPage = new HelloXamlPage();
}
};
}
Check whether you have enable automatic Package Restore (restore Xamarin.forms) in Visual Studio. Go to Tools--Options--Nuget Package Manager--General, check the items below:
Allow NuGet to download missing packages
Automatically check for missing packages during build in Visual Studio
I'm developing a Windows metro (Store) app and i need to store a List.
I'm using this dll (Windows 8 Isolated Storage) but I'm getting a error.
public void saveInformation()
{
var storage = new Setting<List<JobProposal>>();
storage.SaveASync("data", this.JobsList);
}
And I'm getting:
The type or namespace name 'Setting' could not be found (are you
missing a using directive or an assembly reference?)
I've added the dll as a reference. Do I need to be "using" something?
using IsolatedStorageW8;
That will help.
The Setting Class is in that namespace.
Maybe read about .Net Reflector or ReSharper. These can help when you are in same trouble.
The .Net reflector can help to watch the arhitecure of a dll.
The ReSharper can suggest to you the usings or references, and of course a lot of another tips.