Is it possible to use to create Visual Studio solutions from an Azure-hosted web application? - visual-studio

I am writing an application that scaffolds the creation of other Visual Studio solutions. My application is intended to be run on an Azure web app instance and uses C# as the primary middle-tier language.
Previously, I have been able to scaffold or generate VS solutions from a Windows forms app running on my local machine using EnvDte and I know it is possible to do the same via a command line.
Is it possible to accomplish to scaffold/generate a Visual Studio solution from my web app that is itself running on an Azure web instance?
Though out-of-scope for the question, please assume that once generated, the solution will be stored in a folder, zipped and emailed to the user, checked into source control, or some other viable option that is altogether a different issue.

Related

How do I debug my Azure web role in Visual Studio 2012?

I know this is probably something really stupid, but I've been searching google for 2 hours to figure this out.
I have a new test Azure app that I would like to debug in Visual Studio. If I set the startup project to the Web Role (MVC) project, I can hit breakpoints in VS, but it's not running in the emulator so all of my Azure calls fail.
If I set the startup project to the Cloud project, the emulator starts, then Visual Studio ends debugging and my web role is never launched.
What am I missing here? How do I launch my web page and still have access to the emulator?
(Side note.. why isn't there a Visual Studio 2012 tag??)
Although this doesn't answer your question directly, I always make sure that my projects run outside of the emulator. If for nothing else, this just greatly improves the efficiency of your development.
To avoid the issue of the Azure calls failing, one very basic practice you can use is to use a Dependency Injection framework (such as Unity or others) and create a LocalConfigurationManager and a AzureConfigurationManager which both implement some interface like IConfigurationManager, then if your code needs to ask Azure for an instance number, or config setting, etc... the LocalConfigurationManager can just return a hard coded number/setting, and the real AzureConfigurationManager will actually call Azure.
The trick is to use the Web.Debug.Config and Web.Prod.Config files (or perhaps just use the #IF DEBUG C# precompiler statement) to change the implementation depending on the build config.
I have just created a Azure project with an MVC Web Role and I was able to hit a breakpoint in a controller action without any issues. Some things to check:
Do you have a WebRole.cs file in your MVC project containing a class derived from RoleEntryPoint?
Is there a node in the Roles folder of the Azure project representing your MVC project?
When you run the Azure project does the Compute and Storage emulator icon show up in the Notification Area of the taskbar?
Does the ServiceDefinition.csdef file in your Azure project contain a Web Role node with an attribute matching your MVC project name?
WebRole name="MvcWebRole1" vmsize="Small"
As a quick test try creating a new Azure project with a MVC Web Role, add a controller with a single action that returns a view and put a breakpoint in there. Then set your Azure project as the "Startup Project". If everything is working correctly you should hit the breakpoint when you debug the Azure project.
I un-installed and re-installed all my Azure SDK's, to no avail.
This link
Debugging Azure: Error attaching the debugger to the IIS worker proccess
told me where to look for the error that was causing it to fail, which led me to this link:
http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/07fe087e-4ac3-4c4f-bd62-4fccff4afd45
The ACL on the Windows Azure registry entries were not in "canonical order".
All you have to do is fix that and this error goes away.
These are the steps I took:
1.) regedit, navigate to HKLM\Software\Microsoft\Windows\Windows Azure
2.) Right-click, choose "Permissions". You will get a warning that the
security information is incorrect and you get a button labelled "Re-Order".
Click this and the security information then shows up as normal.
3.) Follow the same steps for the Windows Azure AppFabric and Windows Azure Emulator
registry entries in the list after the Windows Azure entry.
Problem Solved!
Note that I found the key under HKLM\Software\Microsoft\Windows Azure, not under Windows\Windows Azure.

Can I manually install a windows service application using VS 2010 Express?

I have created a Windows Service Application and attempted to install it using installutil. But it doesn't show up in my services list. After doing a lot of research I concluded this is because I do not have access to the Setup Project template VS2010 Professional provides. I only have VS2010 express.
I need to mimic any code and configuration for installing a Windows Service Application but without creating a Setup Project in VS 2010. I only have VS2010 Express and want to toy around with creating a service for my home PC.
In other words, is it even possible to hand code what a Setup Project template provides in VS 2010?
If so, what are the essential steps? Are there any tutorials available for how to accomplish this?
Thanks.
the only thing you will need is a class which you will need to derive from ServiceBase and is instantiated from Program.cs.
Just compile and put your project output somewhere on your filesystem, open a command prompt and do InstallUtil your-assembly.exe.
Please note that you should use InstallUtil of .Net 4.0 (instead of 2.0).
On my PC, I use InstallUtil from C:\Windows\Microsoft.NET\Framework\v4.0.30319

Setting up a virtual/local test server in Visual Studio 2008

I am creating a windows service and I would like to be able to debug my code easier. So my plan is to create a web app that will allow me to write and test code and then copy it over to the service.
Is there anyway to set up a virtual or test server similar to XAMPP or WAMP in visual studio?
So far on all of the services I have worked on does a very small ammount of the actual work (usually some sort of timer or file watcher) and the rest of the work is done in seperate classes which allows for easy swapping of .dll files.
a windows form app is very similar to a service and can be used to run code in a way similar to what how the service can.

Visual Studio 2008 Publish Feature in a desktop app. What are the benefits?

Today I tried to use the publishing feature with visual studio, which creates an application manifest, and not a traditional exe.
What are the benefits of this?
I noticed each time the app starts up it does some kind of check before launching in?
When using Publish on a Windows application, you create a ClickOnce installer. You can find a lot of information about that in the official documentation. Basically, this is an alternative to creating a conventional MSI-based setup project (File/New/Project/Other Project Types/Setup and Deployment/Setup Project).
On MSDN you can find a comparison of the two approaches.

SQL Server Management Studio solution vs Visual Studio Projects

Almost all of our projects involve a web application or winforms application and a data access layer (class library) and stored procedures/database scripts.
We are looking for a good way to organize the solutions, and found a few ways:
1)We could have a sql server management studio solution for all the db related things, then have a visual studio solution for the application and data access layer projects.
2)We could do it all in visual studio with 3 projects, a sql server project, a web app/winforms app project, and a data access layer project.
3)We could do it all in visual studio with 2 projects, a web app/winforms app project and a data access layer project, and just put the sql scripts in a directory in the data access layer project.
I'm sure there's other ways, but I'm just curious to see how others go about doing it.
I have done this successfully using Visual Studio Team System Database Edition - multiple types dot net projects with a database project in a single solution.
Keep in mind that deploying a database project takes much longer because you usually need test data and most inserts thereto are RBAR insert statements. We used to turn off deploying the database project until absolutely necessary (usually once or twice a week).
Of course, all of this was in TFS for source code control
SQL Server Management Studio solution
allow use GUI designer for creating and editing some objects.
Visual Studio Projects
allows use TFS as version control and more integrate work of all developers working with a database;
better implements IntelliSence
I use Management Studio and some batch files to export/import/store the sql in the solution (under source control too).
So each time there's a change in the db it's exported to the solution and a custom tool is run to update the ORM proxy classes.

Resources