4 ms·
Enjoying the book, I'm new to to asp and razor although I have done a little .net wep api before. I have an issue with the first view, when running I get the e
by thorin 9y ago
Enjoying the book, I'm new to to asp and razor although I have done a little .net wep api before.
I have an issue with the first view, when running I get the error below on all references in the cshtml. I'm using a stock install of VS 2017. Any ideas?
/Views/Todo/Index.cshtml(4,5): error CS0103: The name 'ViewData' does not exist in the current context
/Views/Todo/Index.cshtml(8,33): error CS0103: The name 'ViewData' does not exist in the current context
/Views/Todo/Index.cshtml(8,27): error CS0103: The name 'Write' does not exist in the current context
/Views/Todo/Index.cshtml(19,31): error CS0103: The name 'Model' does not exist in the current context
/Views/Todo/Index.cshtml(23,1): error CS0103: The name 'WriteAttributeValue' does not exist in the current context
/Views/Todo/Index.cshtml(25,16): error CS0103: The name 'Write' does not exist in the current context
/Views/Todo/Index.cshtml(26,16): error CS0103: The name 'Write' does not exist in the current context
- Yusho 9y agoDid you also install the .Net Core 2.0 SDK?
- thorin 9y agoNot yet, and I was thinking that this might be the issue - would you expect this to be required? dotnet --version shows 1.1.0, I think I assumed that the latest VS2017 would have the latest dotnet core but this doesn't seem to be the case.
- Yusho 9y agoThis is a common misconception, VS2017 doesn't ship with the .Net Core SDK, you need to manually install it seperatly. This is also described in the Book: https://nbarbettini.gitbooks.io/little-asp-net-core-book/content/chapters/your-first-application/get-the-sdk.html https://nbarbettini.gitbooks.io/little-asp-net-core-book/con...
- thorin 9y agoThanks for pointing this out, this did indeed fix the problem. Somewhere in the installation I had ended up with 1.1 but it works fine now.