Console App (.Net Standard) not listed - visual-studio-2017

I am using Visual Studio 2017 and trying to create a "Console App (.Net Standard)". It is no longer on my list of available projects when I do "File -> New Project..."
It was there a few minutes ago. It disappeared after I created a "Console App (.Net Core)" and then deleted that app because I realized I really wanted a Standard app.
I deleted it by removing it from Visual Studio, then going to the file system and deleting it.
I tried running the installer and updating the 2017 install. That did not help.
How can I get "Console App (.Net Standard)" available as a project type to create?
[EDIT] I have shutdown and restarted visual studio.
[EDIT] I have attempted to run devenv /installvstemplates but the devenv command is not found. I found it located here: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE. What is the preferred way to call it? [add to path or some other way?]
[EDIT] I ran like this: "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" /installvstemplates and got a The operation could not be completed. The requested operation requires elevation..
[EDIT] I ran like this: runas /user:Administrator "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" /installvstemplates and got a RUNAS usage help message.
[EDIT] I ran the command in a powershell window with Administrator privilege and got this:
PS C:\Windows\system32> 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv' /installvstemplates
At line:1 char:75
+ ... iles (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv' /installv ...
+ ~
You must provide a value expression following the '/' operator.
At line:1 char:75
+ ... \Microsoft Visual Studio 14.0\Common7\IDE\devenv' /installvstemplates
+ ~~~~~~~~~~~~~~~~~~
Unexpected token 'installvstemplates' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
[EDIT] found out that I need to run the quoted command prefixed with a &. Now I can run devenv.
[EDIT] I decided I needed a "Console App (.Net Standard)" after posting this question: Project Type for simple headless windows application

It doesn't make sense to create a .NET Standard console app.
You can think of .NET Standard like you would an interface in C#. .NET Standard is an interface, then there's concrete implementations of it in .NET Framework, .NET Core and other platforms. .NET Standard makes sense for class libraries, but a console app needs to actually run on a specific concrete implementation.
Thus, there is no Visual Studio project template for .NET Standard console apps. You can create a console app for .NET Framework or .NET Core and then consume .NET Standard class libraries.

My code looked like this
using System;
namespace TriNitroToluene
{
public static class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Console.Read();
}
}
}
In the project properties, set output type to console application, and just change the extension to EXE. that's how it works!

Related

Unable to add app.config file in Visual Studio 2017?

Working in Visual Studio 2017; I have added a class library in my project. Now I want to add an app.config file.
When I try to add by "Add new Item" but config file is missing from item list.
How can I do it?
You probably forgot to install workload .NET desktop development.
Go to installation, click to modify and include the workload .NET desktop development.
Check image of installation screen
Just right click your class library. Click on Add -> New Item and you should find Application Configuration file
Note:
If you have a solution without any project or all project are unloaded, you would not find the Application Configuration File
If you are missing visual studio templates,then Close all instance of Visual Studio and Open visual studio command prompt and type,
devenv /installvstemplates
Press Enter. Let the process be complete and now open visual studio. You will get all missing templates under Visual Studio installed templates.
I couldn't add app.config using the GUI tools for my web project. However, I have added the app.config file manually and the build process picked it up and used it.

Visual Studio 2015 Missing Universal templates

I've been having this problem for about a month, and I am completely stuck.
Under the "New Project" window I don't see the windows 10 universal templates, but have the sdk and tools installed.
All pictures are in this folder on dropbox.
New Project Window: Capture.png (on dropbox)
What I tried:
.net 3.5 enable/disable under "programs and features"/"Turn Windows features on or off"
full uninstall/reinstall with VisualStudioUninstaller
full uninstall/reinstall with Revo Uninstaller
iso intaller
running "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE>devenv /installvstemplates" command with admin privileges
repairing with original installer
modifying with original installer
The strange thing is that in the installer (when modifying) the Universal Windows App Development checkbox is checked. (Capture1.png ... Capture5.png)
I have, however, found out that the folders at "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ProjectTemplates\VC\Windows Root\Windows UAP\1033" is completely empty... Isn't that supposed to be the template folder for the projects? (Capture6.png)
I would be grateful if you could give me some advice fixing this issue.
Okay, so for anyone having this problem:
Check if the "Windows Installer" service is running under Task Manager/Services.
If not right click and select Start service.
After that run the installer for Visual Studio and select repair.
After the repairing finishes, (reboot if you want, it wasn't required for me) all the templates are installed.
(And yes, if you still have this problem, write to microsoft, they are helpful in these kinds of questions)

Why can't I create a new win32 console visual c++?

I'm running visual studio 2013 professional on windows 8
Now, every time I try to start a new project solution in C++ win32 application, the idle-cursor turns to wait-cursor, nothing seems to happen for a long time, the minute i hit the screen, windows tells me visual studio isn't responding, then I'm forced to kill visual studio.
It keeps crashing
I tried searching for answers, found one about not able to create a win32 console application had a resolution, tried it but I get access denied.
C:\Program Files (x86)\Microsoft Visual Studio 12.0>devenv /setup
Microsoft Visual Studio 2013 Version 12.0.30723.0.
Copyright (C) Microsoft Corp. All rights reserved.
The operation could not be completed. Access is denied.
C:\Program Files (x86)\Microsoft Visual Studio 12.0>
After first feedback
I rebooted, retried using the visual studio command prompt, while running it as an administrator. This time it didn't complain, nor outputted anything.
I also tried running visual studio itself as an administrator, but still get same the effect when attempting to create a new c++ win32 console project.
After more searching
Based on this reference
I tried
devenv /Resetsettings ... didn't resolve it
devenv /ResetSkipPkgs ... didn't resolve it
devenv /Safemode ... resolved it, but not sure if it's ideal
The current resolution is to create a project in safe mode
Procedure
Run visual studio command prompt
Type in: devenv /Safemode
Create a new project
The project should now be accessible by going through the standard way of opening visual studio
Update
I uninstalled visual studio, then reinstalled. Unfortunately, I still can't run visual studio normally just to create a project, it continues to hang indefinitely every time I do. The procedure above is still the only resolution at the moment.
I guess you run this on Windows 8 ?
In win8, folder "program files" are not allowed to write except for adminstrators

Visual Studio Express 2013 freezes when opening project properties

Main Problem
When I try to access the properties of a project in Visual Studio Express 2013 for Windows Desktop through Project -> ProjectName Properties, Visual Studio freezes completely without an error and I must end it through the Windows Task Manager.
I ran Visual Studio with /safemode enabled. This did provide some information by saying that "The 'Visual Studio Component Model Host Package' package did not load correctly."
It also produced a log file with some errors and warnings. Errors and warning entries in the log can be searched for with <type>Error</type> and <type>Warning</type> respectively. Additionally, opening the file in Internet Explorer seems to apply some styles to the file and makes it more readable.
Errors only - http://pastebin.com/295sX8kH
Full log - http://pastebin.com/KGspUgGs
The errors in the log seem to center around this Visual Studio Component Model Host Package. I tried searching for errors related to that, but did not find anything I thought was applicable to my situation.
The dll Microsoft.VisualStudio.ComponentModelHost.Implementation.dll is present in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\
The dll Microsoft.Data.Entity.Design.DataSourceWizardExtension.dll is indeed missing from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\DataDesign
Extra Info
I am using version 12.0.30723.00 Update 3 of Visual Studio and I am running Windows 7 Professional 64-bit 6.1 build 7601.
I have tried re-installing Visual Studio in order to to clear out any bad settings, but that did not seem to work.
I tried running Visual Studio with /resetskipkgs and /resetsettings, and neither of those worked.
Trying to open project properties in safe mode still froze Visual Studio.
Backstory
I am ultimately trying to setup an environment in which to develop OpenGL applications. I have some experience with it through following the Arc Synthesis tutorials, but I do not know how to operate outside of the specialized environment the tutorials provided.
Following the OpenGL Book setup instructions, I am told development will go more smoothly if I use the GLEW and freeGLUT libraries. In order to do so, I need to be able to link in extra files to a project. In Visual Studio, this is done through the project properties dialog, but I cannot access it due to the freezing problem.
I am not very familiar with the development process in C++, so I am wary of venturing outside of the IDE provided by Visual Studio, but I might just have to do that if this problem persists.

Running c++ unittest using vstest.console.exe without visual studio installed

I copied the TestWindow folder (C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow) to a machine that doesn't have visual studio installed and tried running the vstest.console.exe command on an x64 cpp test dll.
vstest.console.exe tests.dll /tests:testmethod1 /platform:x64 /logger:console
This is the error I see in the event log.
Application: vstest.discoveryengine.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Stack:
at Microsoft.VisualStudio.TestPlatform.TestRunnerService.DataCollectors.DataCollectionPluginManager..ctor()
at Microsoft.VisualStudio.TestPlatform.TestRunnerService.WcfTestRunnerService..ctor(System.Threading.ManualResetEvent)
at Microsoft.VisualStudio.TestPlatform.TestRunnerService.TestRunnerServiceHost.CreateServiceHost(System.String, System.Threading.ManualResetEvent)
at Microsoft.VisualStudio.TestPlatform.TestRunnerService.ServiceMain.Main(System.String[])
The FileNotFoundException was due to some required assemblies missing. I discovered these using WinDbg and copied them over to the TestWindow folder.
- Microsoft.VisualStudio.Diagnostics.Measurement.dll
- Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll
- Microsoft.VisualStudio.QualityTools.Common.dll
- Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll
- Microsoft.VisualStudio.QualityTools.Resource.dll
- Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
These assemblies can be found at C:\windows\assembly\GAC_MSIL on the machine that has visual studio installed.
I also noted that if I removed the /tests switch from the vstest.console command, these extra dlls were not required.
Also copied the following dlls to the TestWindow folder (to account for cases where the target machine doesn't have visual c++ runtime)
- C:\Windows\System32\msvcr120.dll
- C:\Windows\System32\msvcp120.dll
In addition to having the TestWindow folder and the aforementioned GAC assemblies (ensure you have GAC assembly versions that match your version of Visual Studio) and the VSC++ assemblies if required, I also needed to ensure the latest version of the .NET Framework was installed. I was working with VS 2012 vstest.console.exe and was able to run the help menu once I installed the .NET Framework 4.5.2 Windows Update.
I found a simple solution : just install Visual Studio Agents on the server .
(In this case no need to copy/past the TestWindow folder.)