Console.WriteLine does not output to Output Window in VS 2017 - visual-studio-debugging

In short: Console.WriteLine was working ok in VS 2015 but it is not working anymore in VS 2017.
In detail: I have some VB code using Console.Write that outputs ok to Output Window in VS 2015, even when configured as Release ( to contrast with Debug ) launched with Start Debugging ( in contrast with Start Without Debugging ).
Today I upgraded to VS 2017 ( Community version ), but the Console.Write is not working anymore in the same conditions as VS 2015.
Maybe I made some config in VS 2015 in the past, but I do not recall.
Can someone help me how to make Console.Write output to Output Window in the same conditions ( Release config launched with Start Debugging ).
Obs: Debug.Writeline works ok ( output to Output Window ) when you are in a Debug configuration. When you are in a Release config, Debug.Writeline, does not output (to Output Window) even if you launch with Start Debugging. The need (and so the question) is in the context of Start Debugging in a Release config.

VS 2017 ( Community ) does not have "Hosting Process" as in VS 2015.
In VS 2015 the "Hosting Process" can be enabled in the Debug panel of the Project Properties.
With the "Hosting Process" is possible to output to Output Window ( when launching a Release config with Start Debugging ) using Console.WriteLine().
In VS 2017 there is no such enabler and so the Console.WriteLine() does not output to Output Window anymore.
Discovered that (System.Diagnostics.)Trace.WriteLine(Format(...)) outputs to Output Window in Release configs and can replace (System.)Console.WriteLine.

Related

Visual Studio Code extensions stopped working suddenly

I'm having problem with my Visual Studio Code. Yesterday I had my pc shut down with VS Code open, and when I turned pc on again, all VS Code extensions stopped working. I'm using React and Typescript in my project and I really need those extensions. My eslint and prettier configurations also stopped working.
If somebody had the same problem please answer.
I had this problem too. You can fix with the following:
Open the command palette (Ctrl + Shift + P)
Run Disable All Installed Extensions
Then run Enable All Extensions.
Restart Visual Studio Code
You can make sure again that the extensions are enabled.
i too had a similar issue, and found (thru trial and error and multiple stackoverflow searches)
fix
toggle Developer Tools once you have vs code open
select the console tab
scroll thru the log, paying close attention to the red errors/
- if it's extension errors, open file explorer and go
$drive:\Users\Yourname.vscode\extensions
delete any problem extensions
Restart VSCode and all should be well (at least for me it was)
cheers and happy coding :)
I had that problem on WSL (Windows Subsystem for Linux). The error was like this:
/mnt/c/Users/Admin/.vscode/extensions/ms-vscode-remote.remote-wsl-0.63.13/scripts/wslCode.sh: 69: /home/raul/.vscode-server-server/bin/5554b12acf27056905806867f251c859323ff7e9/bin/code: not found
The solution was to go to Windows PowerShell and open Visual Studio Code, then go to the extensions and restart the Remote - WSL extension, and go back to WSL. It then started working immediately.
in my case removing "Todo Tree" plugin which is one of the VS Code plugins solved the problem,
https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree
if it is installed uninstall it and the problem will be solved
It's weird. when I use WSL2 terminal opening Visual Studio Code, an exception occurs, expressing that wslCode.sh: 69.
But when I open Visual Studio Code in Windows, then type code . in WSL2 terminal, it works without an exception.
Please check if you are able to turn on your settings sync. I had an issue like this and I couldn't even access the account option on vs code (the second last icon on the right horizontal panel.
If not (it's a long shot) try uninstalling vs code and reinstalling VS Code completely. I used these commands to do so (works for mac)
This happened to me in the portable version (1.73.3). I deleted the extensions folder {vscode root}/data/extensions. Re-installing all extensions afterwards worked for me

MSBuild opens a new instance of Visual Studio

We have been using Visual studio 2010 - 2013 on the build server using the following MSBuild command so far:
Set msBuilder=%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
However recently we moved to VS 2015, and had to uninstall all other VS versions (for saving space), and used the following build location (partially also to cater compilation of C# 6.0 features):
Set msBuilder =%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
This seems to work for most of the VS Solutions we have,however for one particular VS solution, when we execute this line:
Set doSolutionBuild=%msBuilder% MySolution.sln /t:clean;Build /p:Configuration=Release;Architecture=x86;Platform=x86 /v:n
it opens and instance of VS 2015 of the same project on the build server and the build process just hangs there in the command prompt.
Can anyone explain how we could resolve this?

Unable to Build in Release mode in Visual Studio

I am getting below error while try to build in release mode. However it build successfully in debug mode. I use TFS and Visual Studio 2015.
ERROR 1
Severity Code Description Project File Line Suppression State
Error Could not copy "obj\Release\MyTestApp.exe" to
"D:\MyFile\Publish\app.publish\MyTestApp.exe". Exceeded retry count of 10.
Failed. MyTestApp
ERROR 2
Error Unable to copy file "obj\Release\MyTestApp.exe" to
"D:\MyFile\Publish\app.publish\MyTestApp.exe". Could not find a part of the
path 'D:\MyFile\Publish\app.publish'. MyTestApp
Even if I change the path and try to publish it, it still shows the same error message with the paths.
I have often faced this issue when I first compile my solution in debug mode and then in release mode (sometimes).
I am currently using Visual Studio 2019 but this should work for your version as well. You can try following options:
Use Clean & then Rebuild-All Option in Visual Studio
Close & Reopen Visual Studio
If the issue persists then most probably "dotnet.exe" is locking the
files. Use taskkill /im dotnet.exe to kill it; issue should get
resolved
Lastly, open Resource Monitor and check if there are any open handles that
are locking your file. If yes, kill those handles.

VisualStudio 2017, Debug build is ok, but Release not work at all

Visual Studio 2017
Windows 10 Build 10586.753
UwpDesktop 10.0.14393.3 installed by NuGet
WPF application
When build as "debug", In debug, All "using" work fine then Compile success.
but Build as "Release", Some Using is not enable. then,
Almost method make compile error..
Do you have Any idea ?
Update1 : I tried this. but Not work... : (
and I make new project and install UwpDesktop as "release" mode. but Result is same. Oh my god !
Entity Framework References go missing between debug and release build
Update2 : I check "Release" folder, It was empty.
"Debug" folder has lot of DLL of UwpDesktop.
then, I copy all file except Exe from Debug to Release.
Now, I success to do compile at Release.
but Why ?
Is this normal ?
Update 3
Now , To build as "Release" is possible, but next issue is Installer. "Visual Studio Installer" has same error when release compile... : (
Update 4
Error message is ,
It's normal message when We put wrong or Unknown class name in code. In case of above picture, GattDeviceService is unknown class name.
Now, Situation change to good.
( 1 ) I copy all DLL file from Debug folder to Release folder. All DLL file was placed by NuGet first. I wonder Why NuGut did not copy same DLL to Release folder.
( 2 ) and Now, "Visual Studio Installer" also worked fine. I tried many. then, I do not remember what I did. First error was missing dependencies like first issue. After I copy DLL file to "Release", Installer build did not success.
(2-1) Here is current status. ( see image )
(2-2) If I selected "Project output" with "Visual Studio Installer", Build failed, then, I changed "file" instead of "Project output" and I selected all EXE , DLL, PDB, Config files. if I select xml, winmd, Installer setup show error message. then, I ignore it.
Now, I resolve this issue ( Build with release is success, Setup build with release : success )
I hope it help someone.. : )
Here is simple step to resolve this issue.
Copy all DLL file from "Debug" folder to "Release".
If "this.InitializeComponent();" has error, Remove Project with Solution Exploler and Re-add it.
And For "Visual Studio Installer", Do not use "Project output" to select target file. Use "file" to select files and do not select "winmd" files.

Winforms globalization issue in Visual Studio 2015

I maintain a WinForms application that I did not write. I used to have Visual Studio 2013 and everything was just dandy. However, an unexpected globalization problem appeared after installing VS 2015. The diacritics have gone rogue.
When in VS designer, I can see proper diacritics:
However, after compiling and running the application, it goes south:
When originally compiling the app in VS 2013, the problem had not occured. Has anyone seen/solved a similar issue?
It is a known bug in VS 2015 that has been fixed and is waiting for a release in toolkit version 1.1:
https://github.com/dotnet/roslyn/issues/4022
A neat workaround is to place codepage directly into your .csproj like:
...
<PropertyGroup>
...
<CodePage>1250</CodePage>
...
</PropertyGroup>
...
or use a command line build, e.g.:
msbuild /p:CodePage=1250;Configuration=Debug
Obviously use CodePage that suits your needs. A helpful list is found here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx

Resources