Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More info should be included on 'add reference' #26

Closed
ghlouwho opened this issue Jan 4, 2022 · 4 comments
Closed

More info should be included on 'add reference' #26

ghlouwho opened this issue Jan 4, 2022 · 4 comments

Comments

@ghlouwho
Copy link

ghlouwho commented Jan 4, 2022

P 163 #7. Needs better explanation, this failed "dotnet add reference", got error "Required argument missing for command: reference".
Found this page, which gives more info, https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-add-reference, but decided to "modify the configuration".

@ghlouwho
Copy link
Author

ghlouwho commented Jan 4, 2022

P164. #4 - Not the first time that I have seen this in your book. My .cs file has "namespace CalculatorLibUnitTests;", Your example says to eliminate the ';', and put in the brackets '[]'. Is this something related to VS Code?

@markjprice
Copy link
Owner

The dotnet add package and dotnet add reference commands were explained previously on page 157. Obviously, if you need to add a package or reference you must specify what package or reference you want--it cannot guess for you. Or, just modify the .csproj file directly as shown on page 163. This is easiest since you can just copy and paste from the ebook or from the code solution.

@markjprice
Copy link
Owner

C# 10 and .NET 6 introduces a feature called file-scoped namespace declarations. I introduce it on page 180. It simplifies code by removing the need for curly braces { } to declare the types inside a namespace. Either the old or new syntax works correctly.

@markjprice
Copy link
Owner

Thank you for raising this issue. In the 7th edition I will add examples of using the dotnet add commands in Chapter 1 so readers know how to use them earlier. And all the code examples will be updated to use the file-scoped namespace declaration style too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants