Tag Archives: visual studio 2019

Unable to find the target operating system for the project

Hi everyone,

I ran into the following error today after updating visual studio 2019 to version 16.6:

unable to find the target operating system for the project

I tried a fair few things to get this going again and I’m assuming they’re not all necessary, but I’ll list them just in case:
– Clean solution
– Close visual studio
– Delete .vs folder
– Ensure that docker-compose is set as startup project
– Edit each project’s .csproj file and ensure that the DockerDefaultTargetOS value is set: Linux
– Edit docker-compose.dcproj and ensure that DocketTargetOS is set
– Restart computer

If you’re able to narrow it down at all I’d be interested in hearing what the actual cause is!

Cheers,
Chris

“protobuf” visual studio a namespace cannot directly contain members such as fields or methods

Hi everyone,

I ran into the following intellisense error while adding a new proto file:

“protobuf” visual studio a namespace cannot directly contain members such as fields or methods

This was one of many errors that were shown and appeared to be an issue with Intellisense mistaking the file for a normal class definition. The following appears to have fixed it:

1) Right click on the file and select “exclude from project”
2) Clean the solution and rebuild
3) Re-include the file in the project (you may have to toggle ‘Show All Files’ at the top of solution explorer to see the excluded item).

Cheers,
Chris

‘add-migration’ is not recognized as the name of a cmdlet – .net core 3.0

Hey everyone,

I recently upgraded my .net core 2.2 project to .net core 3.0. When trying to add a migration I hit the following error:

add-migration : The term ‘add-migration’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ add-migration events
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (add-migration:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

It turns out that there have been a few changes to how this all works. You’ll need to go to package manager console and run the following:

1) Install-Package Microsoft.EntityFrameworkCore.Tools
2) Update-Package Microsoft.EntityFrameworkCore.Tools
3) Get-Help about_EntityFrameworkCore

After running step three you should get something that looks like the following:

PM> Get-Help about_EntityFrameworkCore
ef-core

Covered in full here: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell