How do I add a .svc file in Visual Studio - visual-studio-2010

I have a file with an .svc extension. First question is what is a .svc file? The second question is how do I create one of these from the Visual Studio add item menu? I've tried all the most obvious options but none of them create a .svc file.

In my experience, an SVC file is a WCF service - create a WCF application from the projects list and then do an "Add new item" and add a new WCF service.
For it to do anything it will need the appropriate bindings and endpoints configuring and wiring up - before it can be called.
See also: WCF service. Where to add . svc file

Q1: what is a SVC file ?
A1: A class for creating a WCF service.
Q2: how do I create one from the VS Add New Item menu ?
A2: I'm assuming you're working with C# here but that's just a detail.
Go to Add New Item
Look for the node that says Web and click it (make sure you haven't selected one of the sub nodes!)
In the middle column look for WCF Service
That's all there is to it ;-)

Related

Customise Default WinMain.cpp on Project Creation

When I create a new Win32 Project in Microsoft Visual C++ 2010 Express and it creates the default WinMain.cpp file with the default WinMain function...
Is it possible to load a different WinMain.cpp file, ie, my own WinMain.cpp file/template?
Hope that makes sense. To be more specific, I want to have different default code in WinMain.cpp whenever I create a new Win32 Project.
I have done it years ago with VC6 - it is known as Custom Project Wizard.
In New Project -> General select Custom Wizard to start off.
Using custom wizard, you can create a new wizard type to create project. You'd setup the wizard as per your needs, code the logic and things like that. Once done, and registered your wizard will come as another type.
Check this: http://msdn.microsoft.com/en-us/library/vstudio/bhceedxx.aspx

how to auto update Service References in window phone 7

I have add Service References in my app. References Service is always changing, so I want auto update References Services when in server is update ?
How to update ?
Thank you !
That's not possible. As with any other type of project, Visual Studio will generate the proxy classes when you create the service reference or when you manually update it by right clicking it and selecting "Update Service Reference".
A possibility would be to built up proxy classes dynamically everytime you run the app. An example of an applications that does this is the OData Explorer available here http://www.odata.org/developers/odata-sdk including source.
Good luck!

Problem with file name folding in Visual Studio Solution Explorer ("File Nesting")

(Edit for search-ability: called "File Nesting")
I'm not sure if "folding" is the correct term, but the feature I'm referring to is shown in the 1st image below, versus the 2nd one which does not have an expandable tree list node for the code behind file.
Folding:
No folding:
My questions are:
What is the correct name of this feature?
How do I set it?
Why does my Solution Explorer not have this feature enabled when I try to convert my Web Site Project to a Web Application Project?
References:
Upgrading VS 2005 Web Site Projects to be VS 2005 Web Application
Edit
Thanks Sean, but as you can see below, my Nest Related Files button does show up in this project for some reason:
Should have button shown below:
Edit:
I figured out the reason: I accidentally created a C# Web Application Project, and then added VB ASP.NET files to it.
It's called File Nesting.
When a website project is selected in Solution Explorer, the third button in the Solution Explorer toolbar is for "Nest Related Files".
A website project or project file must be selected in Solution Explorer (rather than the root Solution), for the button to appear in the toolbar. The command/tool button is not available when C++/C# projects are selected in Solution Explorer. I don't have a web app project to test but can only conclude that the command is not applicable to web app projects either.
see this related question for a possible registry hack (changing 9.0 to 8.0 in the question's reg script):
Visual Studio 2010 related file nesting
When you are not using a website project, the nesting button in the solution explorer won't appear—but you can still nest files in .NET 5.0 projects.
Here's how you do it:
Open the project's .csproj file. Visual studio can open it in its own viewer, or else you can use your favorite XML or text editor.
Locate or create an appropriate Item Group element. If there's already one that includes some of your files, put it in there for cleanliness and consistency. If there isn't, create a new one.
Create a new Content element for the file you wish to nest. This element's Include attribute should be the name of your desired file.
Add a new DependentUpon child element to your content element. This element's text value should be the name of the file you wish to nest your target file underneath.
Save the project file and Visual Studio will likely prompt you to reload the project. If you did it correctly, your target file should now be nested under your desired file.
There's shockingly few questions and answers that address this situation. The above answer didn't help me, so I figured that I would share what did for posterity.

Unable to add a view to some projects using Smart Client Factory 2010

I used to be able to add a view using the Smart Client Factory context menu in solution manager.
However now the only option available is "Create Disconnected Service Agent".
Having said that one of the projects has the "Add View" menu available.
Any ideas on how to solve it?
Ok, I found the problem:
Microsoft.Practices.CompositeUI & Microsoft.Practices.CompositeUI.WinForms must be referenced by a project in order to add views to it.
(I was referencing custom CompositeUI and CompositeUI.WinForms projects instead)

Windows Service not showing up when installed with Setup project

I have a simple windows Service developed in VS.net 2008 and VB.net. When I install the service using Installutil.exe from the command prompt it is working like a charm.
When I try to add a setup project and set the output and build and install it though it says successfully installed, it is not showing up in the services.
The event log shows that it is successfully installed. I just did check the registry, it did place the assemblies in HKEY_CURRENT_USER\Software\Microsoft\installer\assemblies.
But I don't understand why it is not showing up in the services listing. I refreshed and restarted.
Any thoughts??
Thanks
Found solution
You have to add a custom action in your MSI project.
So in custom actions, add the output of your service to the Install section. This will then run the required installation code for your service. i.e. the same as what the installutil.exe does
Thanks for all the help
I had the same problem and didn't pay attention to the portion BEFORE creating the Setup project.
http://msdn.microsoft.com/en-us/library/zt39148a(v=VS.100).aspx
To create the installers for your service
In Solution Explorer, right-click Service1.vb or Service1.cs and select View Designer.
Click the background of the designer to select the service itself, instead of any of its contents.
With the designer in focus, right-click, and then click Add Installer.
By default, a component class that contains two installers is added to your project. The component is named ProjectInstaller, and the installers it contains are the installer for your service and the installer for the service's associated process.
In Design view for ProjectInstaller, click ServiceInstaller1 or serviceInstaller1.
In the Properties window, make sure the ServiceName property is set to MyNewService.
Set the StartType property to Automatic.
In the designer, click ServiceProcessInstaller1 (for a Visual Basic project), or serviceProcessInstaller1 (for a Visual C# project). Set the Account property to LocalSystem. This will cause the service to be installed and to run on a local service account.
A couple of ideas:
Are you installing under the same Windows account that you are attempting to run it under? Do you have the Setup Project's "InstallAllUsers" property set to True?
Are you sure that you have the ProductName and Title properties in the Setup Project set correctly? Maybe the service is showing up in the list under a different name, i.e., "SetupProject1" or something.
Similarily, in your service's ProjectInstaller class, in design view, look at the properties of the ServiceInstaller and make sure the ServiceName and DisplayName properties are set to what you want.

Resources