Upgrading from dnx to vs2017 aspnetcore - visual-studio-2017

So I just installed VS2017 and loaded my application. It asked to migrate and there were a tonne of issues which I have now fixed. The last remaining issues are the following:
The first one I hope will solve the second. When I try to debug my application it states that:
the project doesnt know how to run the profile iis express
When I go to the project properties, I can see in the Debug tab, there is a IISEXPRESS profile which launches iisexpress. The other two options in the dropdown are Project and Executable.
I would like to know where the IISExpress is pulled from. That obviously needs modifying but it's not like the other two options (which can be changed in the IDE).
Does anyone know how to change it?
Update
It looks like the settings are saved in the launchSettings.json file.
I added this:
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
but still get the same error.

This error occurred to me, I use Visual Studio 2019:
The project doesn't know how to run the profile IIS Express.
Solution:
I updated Visual Studio 2019 to the latest version
Tools -> Get tools and features
Everything worked fine again!
Installed version:
Microsoft Visual Studio Community 2019
Versão 16.6.5

Looks like there is a typo in your launchSettings.json
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},

Related

What is the equivalent of Visual Studio Configuration Manager in Visual Studio Code?

I build an app using Visual Studio Code and get the error "Cognitive Services Speech SDK doesn't support 'Any CPU' as a platform". I try various things but cannot get it to compile.
I build the same app using Visual Studio 2017 and get the same error which I easily fix by changing the platform to from AnyCPU to x64 in the Configuration Manager.
So, what is the equivalent of Configuration Manager in Visual Studio Code so I can fix the problem there too?
I tried setting the target platform in the .csproj and in the build command in Visual Studio Code but still get the error.
Assuming you're using dotnet build as your command to build a dotnet application you will need to specify some additional command line args when running the command. Visual Studio essentially does the same when calling the compiler, but adds a nice UI to manage it in.
dotnet build --runtime win10-x64
The above would build for a x86 Windows 10 machine, we tell the compiler to do this with the --runtime flag and pass in a RID win10-x64, each environment you're building for will have a different RID (an example linux RID for example would be linux-x64).
You can read more about the dotnet compiler options here
Get a list of the RIDs supported here
Build Configurations
You say you're running the build command, so I assume that you're typing these into the console. But VS Code does give some additional niceness to managing environments through the tasks.json file.
Here you can define a set of commands to run and save them as a configuration, then pick these through the UI. I won't go into too much detail as it's well documented, but here's a build config that would run the dotnet compiler with the x64 command!
More info on VS Code Tasks
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"--runtime",
"win10-x64"
],
"problemMatcher": "$msCompile"
}
]
}
Now when pressing Ctrl+Shift+B you will get a list of your configured build tasks!

The project was restored using Microsoft.NETCore.App version 2.2.0-preview3-27014-02

I've upgraded the machine to the RTM release of .net core 2.2.100 for using preview 3. However I noticed that I was still referring to old versions in the SDK dependencies...
I realised had a global.json kicking around still specifying
{
"sdk": {
"version": "2.2.100-preview3-009430"
}
}
I changed it to:
{
"sdk": {
"version": "2.2.100"
}
}
Then got the error:
NETSDK1061: The project was restored using Microsoft.NETCore.App
version 2.2.0-preview3-27014-02, but with current settings, version
2.2.0 would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as
build or publish. Typically this issue can occur if the
RuntimeIdentifier property is set during build or publish but not
during restore. For more information, see
https://aka.ms/dotnet-runtime-patch-selection.
I'm using Visual Studio 2017 15.9.3
This was Visual Studio caching the SDK version for the dependency resolution, a rebuild (clean build) didn't work, luckily simply restarting Visual Studio solved the problem.
Figured best to share this exact error message to save a poor sod burning time.

The setup for this installation of visual studio is not complete, really?

I have been using Vs 2017 for several months on dev machine. This fine morning says setup incomplete. Am I missing something?
In this case you need to go to Control Panel => Programs and Features and choose Visual Studio and update it.
VS 2017 (15.6.6) was fine for me on Friday 6/1/18 on Windows 10, but same issue as OP today after a restart.
As suggested by the dialog and Retired Ninja, I ran the Visual Studio Installer (to 15.7.3 after updating VS Installer) and that fixed it.
Note that the 15.7.3 update was a 7.73 GB download. Your download size may vary.
This has happened to me for the last 3 upgrades in Visual Studio Enterprise 2017 (now again on upgrade to 15.9.21).
The fastest fix (and I'm not sure why) is simple and doesn't bomb your settings or take for ever.
In the Visual Studio Installer, click on Modify.
Click "Modify" on the bottom right corner.
Yes it says "Total space required 0 KB".
Yes you didn't really change anything.
It will then act like it is downloading something. (not sure what)
It will then act like it is installing something. (again, not sure what)
Open Visual Studio 2017 and it works.
Hope this helps.
If you have an offline installation like me and can't simply re-run the Visual Studio Installer you can edit devenv.isolation.ini and change the last line to read SetupFinished=true. It will detect your trickery and complain, but at least it will launch again.
Edit: I ended up getting the Visual Studio Installer to fix the issue after choosing the "Download then Install" option. Maybe I was too impatient when I initially stopped the update? My above answer is useful when you need to get work done that isn't affected by the broken features, but you will likely encounter problems later on.
just had the same problem (without any reason with) vs 2019 prof, after googling and reading on that topic, just went to vsix, looked for some individual component to install/uninstall, randomly picked cloud explorer, uninstalled it and some dependent components and VS 2019 prof started normally
decided to leave this here. may be it helps somebody
Solved: I did following steps, run the visual studio and it works for me.
In my case visual studio was working fine , I just restarted the PC, this popup was keep coming when I try to open visual studio.(in my case I was using VS 2019)
Go to this path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE"
Open devenv.isolation.ini, set SetupFinished=true and save.
Now open visual studio.
Cheers!
In my case did following steps:
Clear temp files (you can %temp% in run command and Shift+Delete files)
Restart your computer
Open visual studio it will work properly.
Update: Faced problem again after couple of days, This time I go to C:\Program Files (x86)\Microsoft Visual Studio\Installer.
Click on retry.
Select one more feature which I had already installed on my Visual Studio
Click on modified and after installation it worked again.
This happened to me after I canceled a plugin update.
I solved by going to this site that has the latest update of Visual Studio.
https://learn.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes
I downloaded and upgraded it.
After that, Visual Studio worked.
If your VS is already upgraded, there´s an option to "repair" on the installer.
For this problem, goto uninstall screen in control panel right-click visual studio and select option change, Installer page will open now, In that window without changing anything click modify. it will solve the problem. I'm using VS Professional 2017
I got the same error today morning. This is what I did:
I ran the visual studio installer then I clicked on Modify.
The installer was showing 0KB Required. I continued and then it downloaded and installed. (Not sure what).
After that installation, it was able to launch.
I hope it works for you as well.
I was using Vs 2019 professional 16.6 and happened to me this issue one morning. I modified the installation by adding Azure Development tools even though I was not using it. This fixed the issue.
I just updated to 15.9.24 and I got this yet again, as I have my resolution above, and Visual Studio 2019 seems to be a lot better with avoid this issue. The installer for 2019 you do have to change something and do the modification, 2017 you don't have to change anything.
I reported this issue through Developer Community:
Setup not complete since 15.9.21
I don't know why but sometimes its buggy
it's up to date but after launch visual studio this error prompted !
you have to click modify in vs installer and just modify it.
its not going to download anything.
after a moment launch vs and enjoy :)
For VS2022, WIN11:
Control Panel > Programs > Programs and Features > Microsoft Visual Studio Installer
Then, click on Change and resume the previous process.

Prevent console window from closing in Visual Studio 2017 cmake project

Visual Studio 2017 has built-in support for cmake projects, meaning you can just open a folder containing a CMakeLists.txt and use it. However, there doesn't seem to be a way to prevent the console window from closing after running an executable.
With a normal Visual Studio project, you can use Ctrl+F5 to run without the debugger attached. However, Ctrl+F5 did exactly the same thing as F5, that is, it ran the executable and closed the console window immediately.
Another suggestion was to set the subsystem to "console" for the application, but the cmake project has no Visual Studio project that I can set settings for.
I figured maybe I could go to the Debug and Launch Settings for my CMakeLists.txt (right click > Debug and Launch Settings > target.exe), which opened launch.vs.json. Unfortunately, I was unable to find documentation on this. By looking through the schema, though, it seemed as if I could set "noDebug": true, but this just turned off the debugger and did nothing to stop the console from closing:
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "target.exe",
"name": "target.exe",
"noDebug": true
}
]
}
This is driving my crazy. I can't just add a system("pause") to the main function, as I'm using a main function provided by a test framework. Furthermore, that should be completely unnecessary; Visual Studio should handle it for me.
How can I make the Visual Studio console not close after my executable finished, when my executable is from a cmake project?
I'm using Microsoft Visual Studio Community 2017, Version 15.2 (26430.16) Release
It's a bug in Visual Studio 2017 CMake support. It is resolved in VS 2019.
As a temporary workaround, add a breakpoint on application exit and run with debugging on (F5):
Press Ctrl+B (New Breakpoint)
Enter function name: exit
Press OK
Now if you run your project (F5) the debugger will stop after main() returns.
To remove the breakpoint, go to the Breakpoints View (Ctrl+Alt+B) and delete it from there.
Came across this situation lately, because we sometimes use stdout for debugging info in our UI applications, we needed to turn on the console window on our dev-machines, but turn it of in our CI build.
In your CMakeLists.txt must be a 'add_executable' statement, like this:
add_executable(project_name WIN32 ${your_source_files})
If you ommit the WIN32, CMake will change the subsystem to "Console", which leads Visual Studio to keep the console window open when your application exits.

IntelliSense and browsing information will not be available for C++ projects

In Visual Studio trying to create a blank C++ project Win32 Console Application my app Settings are
Console application
Check empty project
Precompiled headers is unchecked
Visual Studio tries to set it all up and then gives me the follow error:
Everything works except project has zero IntelliSense.
Here is what I tried so far:
I tried to install latest version of Microsoft SQL Server Compact 4.0 it keeps telling me the version you are trying to install is an older version and the one I have - is the latest.
There was something about Fallback Location setting it to true, tried that still the same.
Tried to run VS in admin mode, the same error.
Maybe someone had similar problem?
I have had the same problem too. I figured out my problem by install Microsoft SQL Server Compact 3.5 Service Pack 2 for Windows Desktop. The link is https://www.microsoft.com/en-us/download/confirmation.aspx?displaylang=en&id=5783
May it can help you with your problem. good luck
I just had the same problem and solved it by starting Visual Studio as administrator.
The problem appeared, because I had previously started Visual Studio as admin, and the Debug Folder it created wasn't writable then for the normal user.
Otherwise: deletion of the Debug folder would presumably also have fixed the problem.