Windows Service Template for Visual Studio 2017 - visual-studio

The Windows Service Template no longer displays by-default for new projects in Visual Studio 2017....and the installer has no 'search' capability.
All this AZURE stuff is great, but I still gotta do normal 'on-prem' work too...and I hate maintaining 2 versions of Visual Studio.
Any thoughts here?

Just checked here. I see project "Windows Service (.NET Framework)" under the Windows Classic Desktop folder under Visual C#.
(Visual Basic has a similar entry.)
Only some templates are shown in parent folders, for more specialist templates you need to be more specific.
But also the search finds both.
NB I selected ".NET Desktop" workload on install, which I see you have not.

Check the .NET desktop development option in the installer, then click Modify.

VS2017 --> New project --> Visual Basic or Visual C# --> Windows Classic Desktop --> Windows Service

Also check out this recent post (currently dated 2017-3-30) from MS to do it without the project template:
How to: Write Services Programmatically
The key points are as follows:
Create a new project
Add "System.dll" and "System.ServiceProcess.dll" as References
Create a class inheriting from ServiceBase and create a Program.cs with Main exactly like the template project does

If you are talking Windows Template Studio Universal then You have to install the extension in Visual Studio.
Go to Tools menu >> Extensions & Updates >> Online >>then search for Windows Template Studio
OR go to https://marketplace.visualstudio.com/items?itemName=WASTeamAccount.WindowsTemplateStudio#overview

Related

Confused about WiX Project template in Visual Studio 2017

Every WiX online tutorial - using Visual Studio - I try to follow asks a user to create a WiX Setup project as follows:
Right click on your solution folder and select Add > New Project…
Select ‘Windows Installer XML’ > ‘Setup Project’ and give your installer project a name as shown below:
But after installing Wix Toolset Visual Studio 2017 Extension from here and following their instructions to install WiX 3.11 RC2 from here, what I get in my VS2017 Community Edition is the set of Wix templates as shown below. Question: Which of the templates shown in image below should I use to create an MSI installer for a simple Winform app? Or, is there something I am missing here? If so, how can I remedy that? [Note: You can click on the image to get a larger view of it]
Yes, this is known issue and they are working on it: https://github.com/wixtoolset/issues/issues/5531. This is an RC and not RTM.
You should select WiX Toolset\v3\Setup Project

Xamarin project template in VS2015 update 2 seems inconsistent with the Microsoft eBook

First of all I am pretty excited to learn that Xamarin is free to all, so I cannot wait to upgraded by Visual Studio 2015 Community edition to update 2, which comes with the Xamarin.
I also downloaded the free eBook from Microsoft https://blogs.msdn.microsoft.com/microsoft_press/2016/03/31/free-ebook-creating-mobile-apps-with-xamarin-forms/ and I decided to play with it. Chapter 2 (page 21) I read
In Visual Studio, select the menu option File > New > Project. At the
left of the New Project dialog, select Visual C# and then
Cross-Platform.
But when I opened my VS2015, I only see the project templates
I cannot see that Cross-Platform template at all. But I still browsed around and thought Mobile Apps might be the closest one. So I followed the book again
For now, pick the first one: Blank App (Xamarin.Forms Portable) in
Visual Studio or Use Portable Class Library in Xamarin Studio.
If you’re running Visual Studio, six projects are created: one common
project (the PCL project) and five application projects. For a
solution named Hello, these are:
And the projects created (assume I use "Hello" as solution name) should include Hello.Droid, Hello.iOS, Hello.UWP, Hello.Windows, Hello.WinPhone. But what I see from my VS is only
What do I miss here? How to include UWP in my Xamarin solution from VS2015 update 2?
UWP isn't part of the default template, you need to create a new Universal project, then add a reference to Xamarin Forms.
You can follow this guide: https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/
You are looking at the old templates for some reason. You may need to reinstall Visual Studio to get the current ones. I have a relatively fresh installation of Visual Studio w/ Update 2, and my templates match what the book says.
When I use this template, it does in fact create a UWP and Windows project in addition to WP 8.1, iOS and Android.

Console Application not found on visual studio 2015

I just download visual studio community to my pc. When i opened the vs-2015 and create new Console application project. i can't find it any where under the c# we installed templates or any templates.
Thinking about to uninstall and install again but this not the first time i uninstall and install this, i did installed and uninstall few time but still can't find the web Console Application template.
Thank you.
I had the same problem and found the solution on another site. Here are the steps that need to be performed:
Open a Visual Studio command window with admin privileges. This can be done from Windows search after clicking on the Windows button (or Start button - depending on the OS) located in the lower left corner. Make sure that you don't have any Visual Studio project open before proceeding.
Type in prompt in the search box and select "Developer Command Prompt". Right click on this and select run with admin privileges.
In the command window Enter:
cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
In the command window then enter:
devenv /installvstemplates
This worked for me and I was able to create a new console project after this.
With my version of VS 2015 community edition, upon install there was a Console Application (Package) template available, which I mistakenly thought was a Console Application template. This is not the case. It is a web console application project and I only discovered this after trying to access the File and Directory classes in System.IO from my code. The compiler kept on complaining:
Error CS0234 The type or namespace name 'Directory' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)
MyProject.DNX Core 5.0 ...
It still complained after putting in a reference to System.IO and even after changing the offending line of code to:
string DataPath = System.IO.Directory.GetCurrentDirectory();
A big clue here is the reference to DNX Core 5.0, which is an optimized run-time for ASP apps. It was at that point that I discovered that the Console Application (Package) template was also listed under the New Project window Templates / Visual C# / Web.
So, For others that may happen to find this post and think you are using a standard Console Application template, but have errors like "CS0234 The type or namespace "name" does not exist in the namespace..." then you could be using a Console Application (Package) template - which is probably not what you want and should be replaced by a regular Console Application. If you don't see it in the New Project window under Templates / Visual C#, then you should follow the steps above to install it.
EDIT
This is what my New Project window looks like after I performed the steps above:
Comparing this window with yours above, it appears to be somewhat different. Notice that "New Project" on my window is centered and for yours it is not. Also, at the bottom of the window yours has only Name, Location and Solution name, while my window adds a fourth item called Solution.
So, first thing, try clicking on Visual C# located in the left pane of your New Project window to see the templates available. Post that snapshot here. This can be done by selecting edit.
If you still don't see the Console Application template, then perhaps you downloaded a different version of Visual Studio 2015 than I did. So, here is the screen that pops up after selecting Help / About Microsoft Visual Studio on my system:
Compare this screen with yours and post a snapshot of your screen here. Also, what operating system are you using?
Thanks again Bob for your time to explained it to me, i am really appreciate that, I uninstalled and installed again from this link enter link description here, On my machine i have Visual Studio 2015(this one works) and Blend for Visual Studio 2015 is still missing template but i don't care it anymore if it work or not because i will use the one that works which is the Visual Studio 2015.

Can't open a TFS build process template with Community Build Extensions in VS2012 using the dummy-project-with-refrences trick

I'm trying to open a TFS Build Process Template (DefaultTemplate.11.1.xaml) file, incorporating an activity from Community TFS Build Extensions. I'm following instractions from here, section Get the custom activities into Visual Studio. I had no problems with that back in the RC version of Visual Studio 2012 but now, after upgrading to the release version, an attempt to open the file ends up in an error:
System.Xaml.XamlException: 'The type ‘InArgument(mtbwa:BuildSettings)’ of property ‘BuildSettings’ could not be resolved.'
TFS itself doesn't seem to have any problems running builds based on this template.
I am able to open the file without the trick, but then of course the custom activities are not displayed properly.
Check this out:
http://blogs.blackmarble.co.uk/blogs/rfennell/post/2012/08/30/Type-InArgument(mtbwaBuildSettings)-of-property-BuildSettings-errors-in-TFS-2012-RTM-builds.aspx
Quote:
"if the Visual Studio class library project you were using to manage the process template editing was targeting .NET 4.5, it needed to be 4.0. Well with Visual Studio 2012 RTM this is no longer the case, in fact it is the other way around."
I don't really think this is a great answer but I don't have enough rep to comment...
Build action on the xaml file is set to None?
I had a similar issue when opening build templates in VS 2012 RTM, but I was able to open the xaml "a little," meaning that I could open it in the workflow designer, but a lot of it was just the error activity. I found some errors to the effect that I should add references which I had not needed before (neither in VS 2010 or VS 11), such as PresentationCore and PresentationFramework. I wish I remembered more detail to pass on to you on this point.

Adding a service installer and service process installer in visual studio

For some reason, after adding a Installer class to my Windows Service project, I open it up in design mode and right click, but there is no option to add either a service installer or a service process installer. Does anyone know why this may be the case?
In both Visual Studio 2008 and 2010, the best way to do this is to open the ServiceBase component (named Service1 by default) in design mode. Then, right-click in the designer and select the Add Installer option. This adds a ProjectInstaller component along with the necessary assembly references. The ProjectInstaller component, in turn, has the service installer and service process installer added automatically.
Without additional detail, my best guess is that you manually added a component/class to your project and named it Installer instead of letting Visual Studio do the work for you.
See my post here for how to create a basic service in Visual Studio 2008 (seems to work in 2010 as well). Pay particular attention to Step 6.
Hope this helps.

Resources