Chapter 7 – Packaging and Distributing .NET Types Flashcards

1
Q

What is the difference between a namespace and an assembly?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you reference another project in a .csproj file?

A

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>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the benefit of a tool like ILSpy?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which .NET type does the C# float alias represent?

A

System.Single.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the difference between framework-dependent and self-contained deployments of
.NET applications?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a RID?

A

RID is the acronym for Runtime Identifier. RID values are used to identify target
platforms where a .NET application runs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between the dotnet pack and dotnet publish commands?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What types of applications written for .NET Framework can be ported to modern .NET?

A

Console, ASP.NET MVC, ASP.NET Web API, Windows Forms, and Windows Presentation
Foundation (WPF) apps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Can you use packages written for .NET Framework with modern .NET?

A

Yes, if they only call APIs in .NET Standard 2.0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly