I am looking for a method that allows me to check the generator code and code as part of the build process using Visual Studio 2010 (not express) and MSBuild.
Background check:
I am writing a RESTful web service using WCF Web Api. Inside the class of service that the web service represents, I have to define the endpoint by declaring the parameters additionally as a simple test. When the parameter name inside the endpoint declaration is different from the C # method parameter, I get an error - unfortunately, at runtime when accessing the web service, and not at compile time. So I thought it would be nice to parse the web service class as part of the compilation phase for such flaws, returning an error when something is wrong.
Example:
[WebGet(UriTemplate = "Endpoint/{param1}/{param2}")] public string MyMethod(string param1, string parameter2) {
I would also like to apply some naming rules, such as GET Methods, which should begin with the word “Get”. I believe that this will help the service to remain more convenient when working with several colleagues.
Background Generation:
I will use this REST web service in several other projects because I need to write to the client to access this service. But I do not want to write a client for each of them, always tuning in with every service change. I would like clients to be created automatically based on web service code files.
Previous approach:
So far, I have been trying to use the T4 template using the DTE interface to parse a code file and verify it or create a client. This worked fine in Visual Studio when saving manually, but the integration of this process during the build process was not effective enough because the Visual Studio host was not available using MSBuild.
Any suggestion is welcome. :)
source share