Chapter 7 – Packaging and Distributing .NET Types Flashcards
What is the difference between a namespace and an assembly?
A namespace is the logical container of a type. An assembly is the physical container of a type. To use a type, the developer must reference its assembly. Optionally, the developer can import its namespace, or specify the namespace when specifying the type.
How do you reference another project in a .csproj file?
You reference another project in a .csproj file by adding a <ProjectReference> element that sets its Include attribute to a path to the reference project file inside an <ItemGroup>
element, as shown in the following markup:</ItemGroup></ProjectReference>
<ItemGroup>
<ProjectReference></ProjectReference>
</ItemGroup>
What is the benefit of a tool like ILSpy?
A benefit of a tool like ILSpy is learning how to write code in C# for the .NET platform by seeing how other packages are written. You should never steal their intellectual property, of course. But it is especially useful to see how the Microsoft developers have implemented key components of the Base Class Libraries. Decompiling can also be useful when calling a third-party library that you need to better understand how it works to call it appropriately.
Which .NET type does the C# float alias represent?
System.Single.
When porting an application from .NET Framework to modern .NET, what tool should you run
before porting, and what tool could you run to perform much of the porting work?
You should use the .NET Portability Analyzer before porting an application from
.NET Framework to .NET 6. You could use the .NET Upgrade Assistant to perform much of the
porting work.
What is the difference between framework-dependent and self-contained deployments of
.NET applications?
Framework-dependent modern .NET applications require .NET to be installed for an
operating system to execute. Self-contained .NET applications include everything necessary
to execute on their own.
What is a RID?
RID is the acronym for Runtime Identifier. RID values are used to identify target
platforms where a .NET application runs.
What is the difference between the dotnet pack and dotnet publish commands?
The dotnet pack command creates a NuGet package that could then be uploaded
to a NuGet feed like Microsoft’s. The dotnet publish command puts the application and its
dependencies into a folder for deployment to a hosting system.
What types of applications written for .NET Framework can be ported to modern .NET?
Console, ASP.NET MVC, ASP.NET Web API, Windows Forms, and Windows Presentation
Foundation (WPF) apps.
Can you use packages written for .NET Framework with modern .NET?
Yes, if they only call APIs in .NET Standard 2.0.