There are different types of Class libraries available in Visual Studio such as Silverlight Class Library, Portable Class library and Class Library. What are the differences between these types? How can we determine the type of a Class library with File.dll file? How can we change a Class library from own type to another type of Class library?
The Portable Class Library project type enables you to write and build managed assemblies that work on more than one Microsoft platform, whereas the "normal" Class Library project type doesn't.
"Microsoft platforms" include .NET Framework, Windows Phone, .NET for Windows Store Apps, Silverlight, Xbox; all in various versions or flavors.
Source
Go through this for converting from one class library to another type. (See also: this relevant SO question.)
Related
I am using Visual Studio 2017, I created an empty .NET Core Class Library, I tried to add a package to my project and got the following error
Invalid portable frameworks for '.NETPortable,Version=v0.0'. A portable framework must have at least one framework in the profile
I searched internet for help, could not find anything. This class library is referenced in a ASP.NET MVC Core app which does not have a project.json file, I guess it is gone now. Any help is appreciated.
I suppose you have created a nuget package that you want to use in your projects. Mentioned nuget package is created as Portable Class Library and can be installed in regular Class Library projects.
If you want to be able to install this package to .NET Core class libraries or console apps (which includes web applications) you need to create it as .NET Standard Class Library. There is a walk through on how to do it: Create .NET standard packages with Visual Studio 2017.
UPDATE:
From what I have found C++ is not supported in .NET Core and there is no plans to support it right now Proposal: C++/CX support, Will CoreCLR support C++/CLI crossplat?, Using .Net (C++/CLI) legacy code in Net Core.
I am not an expert in C++, but maybe it is possible to create a library in C++ and P/Invoke it with C# and wrap both in NuGet package? Or rewrite it completely in C#?
I have created a Asp.Net Core Web Application that targets the full .Net Framework. This was accomplished by using the Visual Studio ASP.NET Core Web Application (.NET Framework) template.
I'd like to create some tag helpers that I use in this Web Application and I'd like to place them in a library dll. Initially I tried adding a new project to my solution of type Class Library (.NET Core) to place them in but I was unable to reference that library from the web project. When I tried to reference it via Visual Studio I received a dialog that said the project reference was not supported because the Class Library has a target framework that is incompatible with the targets in my Website Project.
So as an alternative, I added a regular Class Library project to the solution via the Visual Studio Class Library template. I am able to add a reference from my Web Project to this class library successfully. However, in this Class Library project I can't find a way to reference Microsoft.AspNetCore.Razor.Runtime which is necessary if I'm going to be able to put my tag helpers in the library.
So I'm at a dead end with both approaches. How can I put my ASP.NET Core tag helpers in a class library that I can reference from my ASP.NET Web Project that targets the full .net framework?
When I tried to reference it via Visual Studio I received a dialog that said the project reference was not supported because the Class Library has a target framework that is incompatible with the targets in my Website Project.
This usually means you both libraries target different things, i.e. if your Class library targets netstandard1.6 and your web application targets net452 its not going to work.
Either your web application needs to target netcoreapp1.0 or your class library has to target netstandard1.0. Use the .NET Standard Library matrix here to see which netstandard1.x moniker supports which platform.
So if your web application targets net452, you have to target netstandard1.0, netstandard1.1 or netstandard1.2. netstandard1.3 and higher don't work, because it requires .NET Framework 4.6.
If you use a library which requires netstandard1.3 or higher, you have to target multiple platforms. i.e. net452 and netstandard1.3.
Then net452 will be used in projects which target net452 and netstandard1.3 will be used in netcoreapp1.0 applications or other class libraries which target netstandard.
I just started converting a library project from Delphi to C++ in VS2005.
How can I do simple things familiar from Delphi IDE like:
complete the C++ class (in Delphi Ctrl+Shift+C)
quick move from method declaration to its definition (in Delphi Ctrl+Shift+Up/Down)
Note: I must use VS2005 for this project.
Thank you
C++ IDEs don't have equivalent functionality to class completion. The IDE cannot complete classes because it does not know how to do so. Definitions can be provided in many places, in defining declarations, later in the same file, in another file, in a library.
To move from definition to declaration you can the F12 shortcut, also available from the menus.
Is there an automated way within Visual Studio to convert a project of type Portable Class Library to a regular (platform-specific) Class Library?
I need to reference a library which doesn't happen to be portable.
You have to edit your PCL's .proj file.
I'm not aware of anything within visual studio itself but the steps are easy enough to do yourself.
See my answer here
The two basic views in Visual Studio's ObjectBrowser and Monodevelop's Assembly browsers are Namespaces and Assembly based. How to get to a class hierarchy based view of the frameworks ?
You can use Reflector (free or paid).
Expand the Derived Types node under any type to see all inherited types in the currently open assemblies.