Where is System.SpanExtensions? - c#

Net core 2.0
I'm trying to find NonPortableCast() the api browser shows it here:
I've referenced System.Memory - but I cannot find this method. Its pretty new so I'm not seeing much in the way of online discussion around it either. Additionally all articles I've found that talk about it, dont seem to mention where it is located.
I've referenced System.Memory and opened the assembly in JustDecompile and I dont see SpanExtentions in there anywhere.

It appears that the inclusion of this in the documentation for the 2.0 release was a mistake:
https://github.com/dotnet/corefx/issues/30156

Related

What does <ImportWindowsDesktopTargets> do in a try-convert generated *.csproj?

I have used the try-convert tool to convert my projects from .NET Framework to .NET 5.0
When inspecting the converted *.csproj files for projects that are targeting .net50-windows I noticed the element:
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
I am curious to understand what it does?
Is this essential or another example of something that try-convert puts in the *.csproj but is not really required to be present in the *.csproj any more?
Thanks.
The same happened when I used upgrade-assistant to do the upgrade and I also
wondered what the ImportWindowsDesktopTargets means and whether I needed it. I could find no official documentation for it, only this discussion. According to the question in the discussion, adding an ImportWindowsDesktopTargets property is one way to allow multitargetting using the TargetFramworks property, like this:
<TargetFrameworks>net472;net5.0-windows</TargetFrameworks>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
As my project does not need to target multiple frameworks, just net5.0-windows, and as I have other projects, both Windows Forms and WPF, that target only net5.0-windows and work fine without ImportWindowsDesktopTargets, I removed ImportWindowsDesktopTargets from the converted project with no problems.
According to the proposed answer in the linked discussion, even if you do want to target multiple frameworks, there may be a better way to do it.
This is for pre-Net5.0 behavior to force importing WindowsDesktop Targets.
If you are using Net 5.0 or a newer version, Microsoft.NET.Sdk.WindowsDesktop will always be imported by the SDK, so you may remove it.

Install Microsoft.AspNet.Identity.EntityFramework.3.0.0-rc1-final into Class Library

I'm trying to create a class library for the new Microsoft Identity model but am being beaten back by an odd error.
If I create a regular C# Class Library (not a PCL) and attempt to install Microsoft.AspNet.Identity.EntityFramework.3.0.0-rc1-final via Nuget it goes so far, chokes, rolls back and then displays the following error:
Failed to add reference to 'System.Runtime'. Please make sure that it
is in the Global Assembly Cache.
I know that this is a pre-release version of the library but this cannot be such a radical idea that I'm trying to achieve here.
Any pointers greatly appreciated.
It seems to be a known issue and confirmed by Microsoft. It leads to this NuGet issue.
A workaround, according to the comments, is to install Microsoft.AspNetCore.Identity.EntityFrameworkCore, which is the RC2 equivalent. From what I can find this hasn't been officially released yet, and you might need to build from source.

ASP.NET 5 Dependency Resolution

I'm trying to tinker arround with ASP.NET5 and all the new Magic we get.
I created a small Application, which receives a MAC-Address and sends a WakeOnLan-Package. For the abstraction of the WoL, I tried to use the SharpPCap-Library: http://www.codeproject.com/Articles/12458/SharpPcap-A-Packet-Capture-Framework-for-NET
I can add the References and even set the Object, but it seems only be avaliable on 4.5. Simply put, do need Asemblies be compatible to DNX 4.5.1 AND DNX Core 5.0?
I tried to add the Automapper, which works, but this one is shown on both Reference-Folders DNX 4.5.1 and 5.0. Does this mean, this Assembly is kindahow working on both Versions? If yes so, how is this possible, if other Assemblies don't seem to be compatible?
My 3. question raises from the Project-References: I added the Model-Project to my WebGui one, but Intellisense keeps marking the Model-Objects red and telling me, he can't resolve it. Funnily enough, building and Runtime work perfectly fine. Is this an issue of the Compiler atm?
If you have any resources on the general topic, I would be glad as well. I found some threads about this theme, like Jon Skeets problem: How can I diagnose missing dependencies (or other loader failures) in dnx? or the diagnosing: http://davidfowl.com/diagnosing-dependency-issues-with-asp-net-5/ but I guess, my problem is on a more basic level.
Thanks in advance.
You don't need DNX Core 5.0 - that's all the .NET Core stuff which SharpPCap probably isn't compatible with. If you can, just get rid of that framework like this in your project.json file:
"frameworks": {
"dnx451": {
}
},
It's probably the same thing for your Model-Project. getting rid of dnxcore50 should help. Basically by doing that you are saying your project needs full .NET, so it might not be as easy to run it on Linux etc...
The red line issue might be a re-sharper problem if you're running that?
see: Dnx 4.5.1/Dnx Core 5.0 Ambiguous reference

System.Web.Helpers not found in VS2015

I'm trying to add some JSON parsing to the C# code in VS2015 but I can't find:
System.Web.Helpers
as the MS documentation suggests. I've looked at other people's questions of a similar nature (almost all on earlier versions) and the answers all say to add it in the Assemblies / Framework dialog.
The problem is it doesn't appear in that dialog, nor do many of the other things I see people talking about.
I would really appreciate any help on fixing this.
Here is the list I have access to:
Edit: Added the Extensions window as well
This question is a bit old but here's a simple solution - Microsoft seemed to just move this library to a Nuget package called "microsoft-web-helpers". Installing that package seems to be equivalent to having the assembly.
Old question but might still help someone.
You must install MVC 3 in order to have the System.Web.Helpers Extension on VS2015.
link to download: https://www.microsoft.com/en-us/download/details.aspx?id=1491
You cannot find it because of the simple fact that's not part of the Framework assemblies (what you are looking at).
It's part of the Extensions assemblies, and, as posted here, you will find it under "Extensions" in the left-hand side of the dialog.
I was wanting to work with JSON as well in an ASP.Net project using VS2015.
I ended up here trying to find answers. Right about the time I finished reading the other answers on this post I noticed my project already had a reference to Newtonsoft.Json. Never heard of it before so I looked it up; I'm glad I did.
It was literally a one liner to Serialize a List<String> to JSON.
You can pass in an Object so you should be able to serialize most any Object within reason.
Ultimately I didn't need to install MVC3 or reference System.Web.Helpers
Hope this helps!
NewtonSoft Serializing and Deserializing JSON
I stumbled upon the same issue and fixed it by adding NuGet Package ->
Microsoft.AspNet.WebPages

XNA - Missing Namespace for Video and VideoPlayer?

Today I tried to include some videos for cutscenes but I failed on even getting the variables recognized.
If I try to access Microsoft.Xna.Framework.Media.Video or Microsoft.Xna.Framework.Media.VideoPlayer it is just missing.
.Media exists but Video/VideoPlayer is just not there
I also can't use "using Microsoft.Xna.Framework.Media;".
If I copy the exact same project to the example project on the Microsoft website it recognizes "Video" and "VideoPlayer" but of course everything else will not work cause of the wrong namespace, missing content and all that stuff.
I already reinstalled the complete SDK with XNA and .NET Frameworks but it still doesn't work.
If I create a new project and copy it there it doesn't work too, did I miss something?
Do I need something else except using Microsoft.Xna.Framework.Media.Video?
I compared the full projects but couldn't find any difference at all.
You are missing a reference to Microsoft.Xna.Framework.Video.dll.
That is where those two classes are located.
Sorry for late answer but this could be helpful..
You can try to install nuget package directxtk_desktop_2015 this will fix issue.
here is reference link.
It looks like your project is missing a reference to the assembly: Microsoft.Xna.Framework.dll.
UPDATE:
Kendall Frey is right, although Microsoft says in the documentation that the Video and VideoPlayer classes are in Microsoft.Xna.Framework.dll, this information is incorrect and these classes are really in Microsoft.Xna.Framework.Video.dll

Categories