Im creating a windows service using vs2010. I have been following tutorials and steps online of how to create a windows service. There is one step that is holding me back. I have researched many things and they all say the same way to create it. When it comes to installing the windows service, it asks me to right click on the grey area of service1.cs(design) and click add installer, however on my visual studio 2010 I do not have this option.
I have only seen one other person write on the internet that they have this problem and they said they ‘repaired the install’ to fix this, I carried out the same process but the option did not appear.
Please help!!
The best way to do this is to open the Service1.cs 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.
The way Visual Studio offers windows service creation is just a whole lot of pain to work with.
I am going to suggest an alternate solution, which I think you should try out.
It is a open source project called TopShelf which allows you to run the service code as a console application while coding and debugging and when you want to install it as a windows service you simply run the exe with an /install option.
Have a look at their quick start guide. It doesn't get simpler than that.
Related
I have recently created a windows form application.
I am wanting to compile everything together. All of the .dll files need to be compiled with the .exe file.
Not only am I wanting to compile all this but I am also wanting to create an installation for my application.
I have looked on other questions on here and couldn't seem to find the answer I was looking for.
If you are doing this in Visual Studio, you can open your project's Properties file in the Solution explorer. Click "Publish" on the bottom left. And then you will see a lot of stuff to choose from. Just explore the UI a bit. It's very user-friendly. Then find something called "Create Desktop Shortcut" and check that checkbox. You don't need this but it makes it easier to find your app after you install it. And then press "Publish Wizard" on the bottom right. Follow the instructions and BOOM!
You are done.
You can find the setup in the directory you specified earlier in the Publish Wizard.
If you are not using Visual Studio, INSTALL IT! It's beautiful (but big...)!
I am probably talking sh*t right now. If you don't understand, read this:
https://msdn.microsoft.com/en-us/library/31kztyey.aspx
I am using VS 2013 (Express Version) and I want to create a WPF user Control Library project. But I am not able to find the template in my installed templates list. If I use Winforms, I am able to build a DLL out of my Winforms Application Project just by changing the Output type as "Class Library". But it is not happening in WPF and it is throwing errors if I do so. Is this the correct method of doing it or am I going wrong?
And in the Create New Project dialogue window, I am not able to find the .NET Framework selector drop down. After creating the project only I am able to change the .NET framework version by going inside the properties of the project.
Kindly help me to get out of this. Thanks in advance.
I have been working on this exact same problem for hours this morning. Here is what I think I have learned:
With Visual Studio Express 2013, it is by design that the WPF User Control Library template is not available for making a New Project. This is because it is the free Express version.
With the Express version, you don't have a "devenv.exe" for trying the "devenv /installvstemplates" to "fix" things. It is, instead, called (just a moment while I look this up again...) "WDExpress.exe" and will be located (if you have default location) in the "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" directory. BUT - this won't help you. It won't fix your problem, because, as I mentioned, your Express installation is designed to not have that template available for New Project, so your "fix" won't put it there. I know this because this is what I tried myself. (Also, note that the instructions for doing this tell you to uninstall any extensions you've installed before doing it. And then, of course, if you still want them you have to reinstall them. Like I still have to do, incidentally.) I'm letting you know all of this so you don't go through the headache I'm having.
Note that I have not done this yet, so this is somewhat hypothetical on my part, but is based on my research on the Internet so far - Your solution is to create a WPF User Control Library manually [but now see UPDATE below]. (No, I don't know how to do this yet. I got into this in the first place, because I'm a WPF novice - just started working with it a few days ago - and late last night I got this great idea to add a "spinner" progress indicator to my "WPF play/learning project" I'm working on, and found a couple of relatively easy-to-work-with samples on the Internet - both of them are a WPF User Control Library - and at first I wanted to use the copy-and-paste to put the code in. But then I discovered... well, our mutual problem, because I'm using Visual Studio Express 2013. No such template under New Project. And literally at the tail end of my about-to-throw-in-the-towel, I'm googling and your post, Dhivakar, is already showing up with the right Google search.) So I haven't finished my research yet, but my next step is to learn exactly how to create a WPF User Control Library manually (the code and various project property settings), and then I can just save a WPF User Control Library skeleton for future use and document the details.
UPDATE: This guy totally has the solution for Express versions. I have followed his steps and it works great. The only additional piece of information I would add is that in my version (VSE2013), after you've created your WPF User Control Library template, when you open Visual Studio again and use File -> New Project, my selection in the tree (for a Windows app) came up under Templates -> Visual C# -> Windows (which is what I've been using). I did not see my template showing up there, after I created it, and I thought, "Great! Another piece of advice that doesn't work." But then I clicked up one on the "Visual C#" parent - and there was the template!
Here you go:
How to add a WPF control library template to Visual C# Express 2008
https://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/
Yes, it works this way for VSE2013 too.
UPDATE 2: I'm not absolutely positive about this, but I think he missed one little piece. In his step #4 he says to delete Window1.xaml and App.xaml. Maybe this didn't apply with VSE 2008, but in VSE 2013 there is also the App.config file which I believe is extraneous for our purpose. So you can delete App.config as well. As I said, I'm not absolutely certain about this yet, but I noticed that file in the project when I added a WPF User Control Library project to my solution, and I deleted it, and the solution compiled okay.
Try running devenv with the /installvstemplates switch, from https://msdn.microsoft.com/en-us/library/vstudio/ms247116(v=vs.100).aspx
If this doesn't work, browse to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\WPF\1033\WPFUserControl (this could change dependent upon your installation directory), open the .vstemplate file in a text editor, and make sure the setting is set to true, then try running devenv with the switch again.
Hope it helps.
I would like to create a Visual Studio Solution and a C# Project programmatically, but without a instance of Visual Studio installed on the machine.
Scenario
I am trying to build a "engine" that will read some metadata in a SQL database and transform them into a UI. The database will be maintained by another people with a Web or WCF interface and I want the Server Application frequently (by schedule or pressing a button) use this informations to create autommaticaly a new version of the software (create solution -> project -> build -> create deployment).
So, I searched about programmatically create Solution and I found only the Automation Model in VS, it's about use an Add-In Project and this don't serves for my propose.
Perhaps I was a little confused in my explanation, so ask me more especific details, so I can be more accurate :)
Thanks for help
I think generating the solution is a little extreme.
The solution file structure hasn't changed much since 2005 http://msdn.microsoft.com/en-us/library/bb165951(v=VS.80).aspx, and there are a few projects trying to automate their generation, like Premake https://bitbucket.org/premake.
However, the kind of scenario you describe, might be I believe (better?) adressed with t4 templates http://msdn.microsoft.com/en-us/library/vstudio/bb126445.aspx, or only project file generation.
What you are describing is possible to do in C# Windows app but tedious and difficult. I remember seeing VB6.0 app like that but here i would suggest you look into WPF. Still it's C# programming but WPF can load dynamically a "window" from a string or a file if you want.
so I have an application that I have created in Visual Studio 2010 and I want to know how I can package it so a user can install it on their machine. I'm sure I will have to do some scripting as well as call cmd prompts. Basically I want to get it to the point where there is an installer for the application that my group has built.
Any suggestions or tutorials you recommend?? Its for a school project and it would really be helpful if someone could help me get this off the ground. Its the last thing my group needs to do.
Thanks!
Joe Ristaino
Use ClickOnce
Use the MSI installer setup project in Visual studio. It's very simple.
http://www.c-sharpcorner.com/UploadFile/vishnuprasad2005/SetupProjects12022005022406AM/SetupProjects.aspx
I wouldn't use click once...
Ok here's a newer article
http://www.dreamincode.net/forums/topic/58021-deploying-a-c%23-application-visual-studio-setup-project/
Visual Studio has it's own installer projects, you could check those out. I personally use them for any projects I make at my company. If you use the wizard, you'll have it done in no time.
In your solution,
right click your solution name in the Solution Explorer.
Add -> New Project.
For the type, goto Other Project Types -> Setup And Deployment -> Visual Studio Installer
Choose the setup wizard, it's pretty easy. Primary output means what's is installed to the program folder. Follow the wizard and most of the work will be done. There will only be optional tweaking left to do.
I recommend WiX. It's got quite a bit of a learning curve, but it's totally powerful.
It's expected to be included in the next version of Visual Studio (it didn't quite make it into VS2010).
I have written a windows service application which is installed on my PC. There is a problem with it, so I want to debug that service.
Can you tell me how to debug the windows services?
Please read: http://msdn.microsoft.com/en-us/library/7a50syb3(VS.80).aspx
The easiest way to debug code that you've written as a service in .NET is to separate all the functional code from the service into a separate assembly and then create another project, as a console or WinForms application that uses the separate assembly to run the service code.
If you have Visual Studio on same machine, use it to list the process and attach a debugger to it. You can also use remote debugging but it can be a pain to configure.
The easiest way is to add System.Diagnostics.Debugger.Launch() to the point you want to start debugging. Visual Studio will need to be running as Administrator. When the code is executed, a dialog will pop up asking which instance of Visual Studio you want to use to debug. If you've got Visual Studio already open with the relevant project loaded, choose that one.