I'm currently trying to create a C# .NET 5.0 Console Application in Visual Studio 2019, and the option does not appear under project templates as I expect it to.
I downloaded Visual Studio Professional 2019 Version 16.9.4 (from https://visualstudio.microsoft.com/downloads/) and selected all workloads to be installed, then I installed SDK 5.0.202, ASP.NET Core Runtime 5.0.5, .NET Desktop Runtime 5.0.5, and .NET Runtime 5.0.5 (from https://dotnet.microsoft.com/download/dotnet/5.0).
When I go to File -> New -> Project and search for "Console Application", there is no default "Console Application" project template for C#. The closest I can find is "Console Application (.NET Framework)" for C#, VB, and F# and "Console Application" for C++. If I select "Console Application (.NET Framework)" for C#, the latest Framework that I can choose is ".NET Framework 4.8".
Actual Outcome: Project Templates
Actual Outcome: Frameworks
I compared notes with a developer who did not run into this problem, and they see the same framework restriction when they select "Console Application (.NET Framework)" for C#, but is also able to see the project template "Console Application" for C# (without ".NET Framework") and select ".NET 5.0 (Current)" as the target framework as expected. Nothing about what they installed and updated appeared to be noticeably different, our results for the command prompt command "dotnet --info" matched, and they did not have any "Installed products" listed under "About" or "Individual Components" listed under the installer that I was missing.
Expected Outcome: Project Templates
Expected Outcome: Frameworks
I have tried uninstalling and reinstalling everything, exhaustively installing every workload as well as additional individual components that looked potentially relevant, and making sure that the "Tools -> Options -> Environment -> Preview Features -> Show All .NET Core templates in the New project dialog (requires restart)" checkbox is checked.
Does anyone know what step I'm missing that is preventing me from creating a Console Application project template in C# using .NET 5.0?
Background -- This change/broke, issue that Microsoft opted deliberately you can read more here and the issue reported here but you can fix this with the 2 options listed below, i.e. A) enable it OR B) add it to VS via the repair tool
suggest clear VStudio Cache's -- kill dev process & clear cache before re/starting VS
run this cmd as admin in powershell
Get-Process devenv | Foreach-Object { $_.CloseMainWindow() | Out-Null }
Then DELETE ItemTemplatesCache, ProjectTemplatesCache folder ent. prof. etc.. C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE.
Now please Proceed with these Steps/Options
Option 1: you may have to enable this option...
Tools > Options > Preview Features > “Show all .NET Core templates in the New project dialog (requires restart)”.
Option 2: Install via Visual Studio Installer like so..
You can install missing workloads using the repair VS (this will also update the installer) and make sure you check the optional packages you want from the VS Installer tool please see this
after the installer starts check if the .NET Core workload is selected for desktop and console.. like below.. on the right pane you will need to check the correct boxes
Clear Visual Studio Component Cache (& optionally all Your templates)
Now, if you have already followed the above steps, then verifying you selected the checkbox of ".net-Desktop development" on top right is selected or not on Visual Studio installer: delete the cache and restore
i.e. you could restore the template in VS2017/2019 then try it again.
Kill dev process first run this Get-Process devenv | Foreach-Object { $_.CloseMainWindow() | Out-Null }
Please refer to the following steps:
DELETE the ItemTemplatesCache, ProjectTemplatesCache folder Ent. or Prof. version etc.. C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE. & C:\Users\<USERNAME>\AppData\Local\Microsoft\VisualStudio\16.0_93de0ddd
In the command prompt, navigate to the location of devenv.exe. This file is located in \Common7\IDE.
Type/Run this command devenv /installvstemplates and press Enter.
FYI - your templates cache is here, containing folders named after the zip files from your archives in the template folder.
you will need admin privilege's for edits/delete.
//templates cache Microsoft
%AppData%\Microsoft\VisualStudio\{some_version}\ItemTemplatesCache\
//templates path for verification, repair/reinstall or delete
%USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates
%USERPROFILE%\Documents\Visual Studio 2019\Templates\ItemTemplates
%ProgramFiles(x86)%\Microsoft Visual Studio\2019\<edition>\Common7\IDE\ItemTemplates\
%ProgramFiles(x86)%\Microsoft Visual Studio\2019\<edition>\Common7\IDE\ProjectTemplates\
Option 3: debugging your env. Template Config folder
Checking/Diagnosing the version:
run this dotnet --version
install the correct core version https://dotnet.microsoft.com/download/dotnet/5.0 more here
this dotnet new -u will tell you which templates are installed, you can uninstall, clear the packages cache, restart and reinstall with the repair tool.
Download and run collect.exe - https://aka.ms/vscollect - and share the log file created in %TEMP%\vslogs.zip with MS on github
FYI - This is what your template folder structure in visual studio should look like.
└───mytemplate
│ console.cs
│ readme.txt
│
└───.template.config
template.json
Eventually clear the MEF component cache, manually or with this extension.
But most likely something is wrong in the user cache at C:\Users\USERNAME\AppData\Local\Microsoft\VisualStudio\16.0_93de0ddd, which includes in particular InstalledTemplates.json and privateregistry.bin.
Try and rename (or delete) the folder, (or one the the two mentionned files to narrow the problem down), while VS is off, and restart VS. Only make sure that you have the proper workloads installed and the .net 5 from VS.
While it can be hard to tell what's exactly the issue with VS or local environment you have, it should be possible to temporary create projects with dotnet cli:
dotnet new console --output <project-dir>
If you would want to add it to an existing solution run
dotnet sln <solution-name>.sln add <project-dir>
The console app project file is very simple, so you can even create it manually, or create a project from any existing template and replace the contents with following asa workaround:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
And maybe one more thing you could try is to run the VS installer as admin or ensure that it can install and access all the required components.
I checked and I am able to create dotnet5.0 console application with visual studio version 16.9.2 and SDK version 5.0.201. I think there is some installation conflict on your end. You can try uninstalling the SDK and reinstalling visual studio or updating it to latest version and downloading latest SDK. Also check if SDK is getting installed on your system under
C:\Program Files\dotnet\sdk[your SDK version]\
After a year of just dealing with it, I FINALLY FIGURED IT OUT.
Go to C:\Program Files\dotnet\templates then open every folder there. Apparently it was a permission issue because I was getting:
[Window Title]
6.0.6
[Main Instruction]
You don't currently have permission to access this folder.
[Content]
Click Continue to permanently get access to this folder.
[Continue] [Cancel]
After selecting Continue for each folder, everything started working.
The error that resulted from running dotnet new --list is what gave me the heads up.
My solution was deleting C:\Users\USERNAME.templateengine\
I have VS 2019 version 16.9.5 when I seen your post. I am using console app for my sample projects. I have tried it and able to achieve what you are looking for. I would recommend to update your VS to 16.9.5 and give it a try.
My VS 2019 version:
Creating Console app in VS 2019 16.9.5:
Finally it has created a console app project with target framework as .net 5.0
I have a Windows service application and am trying to add an MSI project to the solution. Application uses 64 bit Oracle Data Access DLL and is built as 64 bit app.
I added new "Project Setup" project to the solution and went through the steps. There are two other DLLs in the application project: log4net.dll and System.Net.Http.dll.
Windows Service by itself worked fine. When I try to build the solution, I get File 'Oracle.DataAccess.dll' targeting 'AMD64' is not compatible with the project's target platform 'x86' error. I checked for this error and every article said to set the taget platform of installer to x64, which makes sense. The only thing is when I open the properties window of installer project, there is no option to select target platform and it is blank.
This is screen shot of "Application Folder" section of installer:
This is the installer properties:
This is the Windows service application's properties:
Procedure: You need to set the MSI architecture in the setup project's properties window. This is a different property page than the one you show.
Left click the Visual Studio Installer Project inside the Visual Studio Solution.
Press F4 to go to the property page for the project.
In the TargetPlatform select x64.
Tip: Try googling the exact error message you get when you face issues like these. Here is a previous answer: Can't set 64 bit target for Setup Project in Visual Studio 2017 (I added a new one to get a screen shot in).
Heads-Up: And a heads-up on the use of Visual Studio Installer projects. They have many limitations: Visual Studio Publish Project Into One Simple Installer.
MSI Tools: Here is a quick overview of other MSI tools. And here is a detailed overview / review.
Links:
Troubleshooting Setup and Deployment Projects
Recently I tried out Visual Studio 2017. We've got a MSDN Subscription. We're working on some internal apps which we're writing as WPF apps. These apps need to be installed on user machines (Windows 7 through Windows 10) where the users have no administrative privileges. The thing which has hurt us the most, at this point, is getting the ReportViewer control to install without requiring an administrator to be around. It was impossible with VS 2015 and older, because (so I understand) VS 2015 and older, the ReportViewer control is an ActiveX control which requires admin privileges to install. I have been told that with VS 2017 the new ReportViewer control (version 14) is not an ActiveX control; that it does not require admin privileges. This is great news and I told my colleagues this. In order to demonstrate this I wrote a very simple WPF app using VS 2017. All I did was put the ReportViewer control onto a window. It did take about 6 weeks to finally get it to work (way longer than it should have), but I got it to deploy to a machine using ClickOnce deployment.
Next I thought I'd prove to myself that I could do it again, this time taking notes as to what I did. I've tried twice to duplicate the same, simple app, but I keep getting the following message:
This is not going to do at all, because that takes us right back to the same problem - some admin must be near by to install this app. We do not want that. Briefly here are the steps I took:
Installed the Microsoft.SqlServer.Types version 14.0.314.76 using the Package Manager Console from within VS.
Installed Microsoft.ReportingServices.ReportViewerControl.Winforms version 140.340.80 using Package Manager Console
In XAML I included namespace Microsoft.ReportViewer.WinForms in the window tag.
Added references to System.Windows.Forms and WindowsFormsIntegration
Added the following XAML in the Grid tag of the window:
Set up the ClickOnce deployment
Because of a bug involving the Chinese location files, I went into the project's Publish tab | Application Files and sent all of the files beginning with "zh-" to Exclude for Publish Status.
Then I published it to the network share and ran the ClickOnce Setup.exe on a machine which didn't have the older ReportViewer installed using an account with no privileges.
And I got the "System Update Required" message I gave near the beginning of this post.
Why is this happening? Why does it require Microsoft.VisualStudio.Text.Logic be installed in the GAC? Especially for an app that doesn't even connect to any database at all?
As it looks the important DLLs for the ReportViewer files in GAC which also includes the Microsoft.VisualStudio.Text.Logic DLL into the package. Therefore, it shows the error unless it found the missing DLL.
Try below steps to add DLL into your project toolbar:
Run the below command in the Package Manager Console:
Install-Package Microsoft.ReportingServices.ReportViewerControl.Winforms -Version 140.340.80
Right click in anywhere in the toolbox and then select Choose Items...
On the .NET Framework Components, click on Browse
Select the Microsoft.ReportViewer.WinForms.dll from the NuGet package you installed.
The new control should display within the toolbox. And then try to publish your project with this new reportviewer.
As mention in a link shared by Dmitry 's comment.
I am missing the usual publish targets when publishing my c# web application. The usual "Import" and "Custom" options are missing when I go to publish, as well as the "Manage Profiles" drop down that has the option to create a new profile.
Here is the screen I am presented with.
The buttons on the left hand side are "greyed out"
Here is another screen from a colleague that has the missing options
I have tried a full reinstall of Visual Studio 2015 update 1 with no success. I have also tried creating a fresh ASP.NET Web application project in a new solution resulting with the same problem.
In the end this ended up being a corrupt publish profile file in the Properties/PublishProfiles/xxxx.pubxml within the project.
There are multipy options for this behavior:
Issue with the Web Deploy Tool
Try to reinstall the current Web Deploy 3.5 Tool
Depending on the exact Version of your Visual Studio and your Operating System
There are known issues about specific OS/Visual Studio combinations.
Missing Web Developer Tools at Installation
Select the Web Developer Tools Option at installation
I recently developed a minor Excel 2010 Add-in in the Visual Studio 2011 beta and tried to deploy the solution right now. I selected the .NET Framework 4 as a prerequisite and setup.exe downloads it, if it is not yet installed on the target computer.
But I am getting headaches when trying to catch the "Tools for Office Runtime" into the dialog "Prerequisites" in the Publish tab when building. The strange thing is: In my Office, there was an old 2010 Visual Studio installation, that HAS this setting, I can select the entry, build it and voilá: The runtime is downloaded.
How can I tell Visual Studio: Look, I need this runtime, please check it before installing it. Because right now, setup.exe installs the add-in and it crashes on the first Excel start.
Futher information:
I use click-once deployment
C# VSTO add-in
Targetting Excel 2010
Edit
I think I found a solution for this:
I copied the VSTOR4 directory from my office PC located at ''C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages'' and placed it on my developer notebook at the same location. Result: not found
I copied it to ''C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages''
I edited my project.csproj to include the following setting:
<BootstrapperPackage Include="Microsoft.VSTORuntime.4.0">
<Visible>False</Visible>
<ProductName>Microsoft Visual Studio 2010 Tools for Office Runtime %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
The question is: Is this really the right way? Will there be problems that I didn't think of right now? Why isn't there an option to just download additional bootstrappers (there is, but for .NET 2.0 and some MDAC component I don't use)?
VSTO deployment just is painful as it is and not straight forward comparing to a simple "MSI Installer, done" procedure. Having to deal with these kind of issues really makes me kinda uncomfortable about the whole add-in architecture, but that's another story for another day.
Although you did it manually, it will work fine. Alternately you can go to project properties, Publish tab and click the pre-requisites button to bring up the pre-requsites dialog where you should be able to see VSTOR40 along with other bootstrapper components. If you don't see a particular one there, two possible reasons could be:
You don't have the bootstrapper package in your C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages folder (replace with v7.0 for VS2010)
Your product.xml (available in the above location) contains incorrect information.
One side note: You should check your product.xml file for HomeSite attribute and make sure you have that set to proper "fwlink" provided by Microsoft for that package. fwlinks are basically persistent web links from where a package can be downloaded by the ClickOnce installer, so that you don't have to distribute it with your product. Use Google to find out fwlinks of different bootstrapper packages.