And deploying a website to IIS 7.0 from VS 2010 couldn't be easier...
RMH

Product Placement
2025 on Tumblr: Trends That Defined the Year
Mike Driver
styofa doing anything
art blog(derogatory)
I'd rather be in outer space 🛸
trying on a metaphor
Lint Roller? I Barely Know Her
cherry valley forever

ellievsbear
No title available
Game of Thrones Daily
AnasAbdin
h
No title available
sheepfilms

JBB: An Artblog!
TVSTRANGERTHINGS
Misplaced Lens Cap

seen from Spain
seen from Türkiye
seen from Italy
seen from New Zealand

seen from China

seen from United States

seen from Australia
seen from Türkiye

seen from United States

seen from Malaysia

seen from United States

seen from United States
seen from United States
seen from United Kingdom

seen from Malaysia
seen from Germany
seen from Türkiye

seen from Australia
seen from United States

seen from Iceland
@belham
And deploying a website to IIS 7.0 from VS 2010 couldn't be easier...
VS2010 Web Deploy to Windows 2003 host
Using VS2010 to publish a website using the Web Deploy publish method, if the target server is running Windows 2003 with IIS 6.0, you have to specify the MsDeployAgentService on the Service URL.
Sharepoint 2010 on Windows 2008 R2 and DCOM errors
After installing Sharepoint 2010 Foundation on a brand new Windows 2008 R2 server, I was very surprised to see a host of DCOM errors being logged in the host computer SYSTEM EventLog; 51 over three days.
A typical error event being
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID
{000C101C-0000-0000-C000-000000000046}
and APPID
{000C101C-0000-0000-C000-000000000046}
to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.
For each COM Server component logging such an error, here's the actions I performed to stop these errors from being logged:
Use the REGEDIT utility to lookup the friendly name of the stated APPID in the HKEY_CLASSES_ROOT\APPID key; NOTE In the case of {000C101C-0000-0000-C000-000000000046} there is no registered default value for this APPID; other components may well have a default value stored and this will be the name of the COM Server component;
Use the Component Services utility to locate the name or APPID value of the COM Server beneath the DCOM Config node;
Right-click the component and select "Properties" then the "Security" tab;
If the "Security" tab options ARE NOT greyed out, then proceed to the next step; otherwise the logged on user does not have the required permissions to alter this component and you will now need to: 4.1 Close down the Component Services utility; 4.2 Switch back to the REGEDIT utility; 4.3 Right-click the APPID key, select Permissions..., Advanced, Owner tab and ensure that the local Administrators group owns this key then select OK; 4.4 Select "Administrators" in the "Group or user names:" list; 4.5 Select "Allow Full Control" then select OK; 4.6 Go back to step 2;
With the "Security" tab active for the component with APPID value; 5.1 Select "Customize" in the "Launch and Activation Permissions" panel; 5.2 Select "Edit..."; 5.3 If "NETWORK SERVICE" is not listed in the "Group or user names:" list, add that account; 5.4 Assign "Local Launch" and "Local Activation" permissions for the "NETWORK SERVICE" account then select OK, OK;
Once the launch and activation properties for the COM Server components logging errors have been altered, restart the host computer;
Here's the list of COM Server components I had alter:
{000C101C-0000-0000-C000-000000000046}
{61738644-F196-11D0-9953-00C04FD919C1}
Send Ctrl-Alt-Delete in a Remote Desktop session
Use the key combination:
Ctrl-Alt-End
Word 2010 keyboard shortcuts
Thanks to ShortcutWorld for providing a comprehensive and well laid out page on a number of keyboard shortcuts :-)
Promoting or demoting numbered paragraphs in Word
One easy way to promote or demote a numbered paragraph is by using the “Decrease Indent” button or the “Increase Indent” button in the top row of theParagraph group in the Home tab.
Assuming you are using automatic paragraph numbering of some sort, that method should work 100% of the time. Each time you press the button, Word promotes or demotes the paragraph your cursor is in one more level.
Marking model methods as obsolete
During the early stages of object model development, you may need to create one or more stub-methods to provide a callable interface for other developers; with sprint development, sometimes the exact number and types of model method parameters are not well-defined or may not be even available but you need to get the ball rolling.
In later development sprints, you will have possibly developed one or more overloaded model methods and you may wish other developers to stop using the earlier model method that you provided. Of course, you could email other developers asking them to stop using your earlier model method, but a timely and appropriate response cannot be guaranteed…
So why not decorate model methods you wish others to stop using as obsolete, resulting in either a compiler warning message or maybe even a compiler error?
1: [Obsolete("Stub Method: Please use one of the overloaded methods")]
2: public void CreateHistory()
3: {
4: // A compiler warning with the above message will be alerted to callers of this method
5: }
6:
7: [Obsolete("This method is no longer supported", true)]
8: public void CreateHistory(Guid ownerId)
9: {
10: // A compiler error with the above message will be alerted to callers of this method
11: }
Decorating model methods as obsolete provides you with an elegant mechanism to alert other developers that you wish them to stop using model methods that you no longer wish to support.
Test Driven Software Development
I’m an advocate of Test Driven Software Development and have been practitioner of this for some months using the Nunit Framework.
I have previously invoked my Unit Tests from within the Visual Studio IDE via an “External Tools” IDE definition, but then I came across a more integrated approach which caters for integration with other Unit Test GUIs.
Take a look here: http://www.testdriven.net
C# Coding Standard starting point
If you have no current written C# coding standard, this would be a good place to start… Brad Abrams - Internal Coding Guidelines
Tracing in ASP.NET 2.0
Tracing is a way to monitor the execution of your ASP.NET application. You can record exception details and program flow in a way that doesn't affect the program's output.
In ASP.NET 2.0, there is rich support for tracing. The destination for trace output can be configured with TraceListeners like the EventLogTraceListener.
ASP.NET 2.0 Improvements for Tracing
ASP.NET Tracing has increased precision from 6 digits to 18 digits for highly accurate profiling.
Trace forwarding between the ASP.NET page-specific Trace class and standard Base Class Library's (BCL) System.Diagnostics.Trace used by non-Web developers.
First, we will explore ASP. Net's tracing facilities first, and then learn how to bridge the gap and see some new features in 2.0 that make debugging even easier.
Page level Tracing
ASP.NET tracing can be enabled on a page-by-page basis by adding "Trace=true" to the Page directive in any ASP.NET page:
<%@ Page Language="C#" Trace="true" TraceMode = "SortByCategory" Inherits = "System.Web.UI.Page" CodeFile="Default.aspx.cs" %>
Additionally, you can add the TraceMode attribute that sets SortByCategory or the default, SortByTime. You can use SortByTime to see the methods that take up the most CPU time for your application. You can enable tracing programmatically using the Trace.IsEnabled property.
Application Tracing
You can enable tracing for the entire application by adding tracing settings in web.config. In below example, pageOutput="false" and requestLimit="20" are used, so trace information is stored for 20 requests, but not displayed on the page because pageOutput attribute is set to false.
<configuration> <appSettings/> <connectionStrings/> <system.web> <compilation debug="false" /> <authentication mode="Windows" /> <trace enabled ="true" pageOutput ="false" requestLimit ="20" traceMode ="SortByTime " /> </system.web> </configuration>
The page-level settings take precedence over settings in Web.config, so if enabled="false" is set in Web.config but trace="true" is set on the page, tracing occurs.
Viewing Trace Data
Tracing can be viewed for multiple page requests at the application level by requesting a special page called trace.axd. When ASP.NET detects an HTTP request for trace.axd, that request is handled by the TraceHandler rather than by a page.
Create a website and a page, and in the Page_Load event, call Trace.Write(). Enable tracing in Web.config as shown below.
<system.web> <compilation debug="false" /> <authentication mode="Windows" /> <trace enabled ="true" pageOutput ="true" /> </system.web> protected void Page_Load(object sender, EventArgs e) { System.Diagnostics.Trace.Write("This is Page_Load method!"); }
When you run the page, you can see a great deal of trace information in the browser because we have set PageOutput=true as shown below.
Trace.axd displays all the tracing information for all requests up to a present limit. Above figure shows that three requests have been made to this application and the right side of the header indicates "Remaining:7" That means that there is seven more requests remaining before tracing stops for this application. After that final request, tracing data is not saved until an application recycle or until you click "Clear Current Trace" from the Trace.axd page. The request limit can be raised in Web.config by setting requestLimit to a higher value as shown below
<trace enabled ="true" requestLimit ="20" pageOutput ="true"/>
Trace forwarding
ASP.NET 2.0 introduced new attribute to Web.config <trace> element that allows you to route messages emitted by ASP.NET tracing to System.Diagnostics.Trace:writeToDiagnosticsTrace.
<trace enabled ="true" requestLimit ="20" writeToDiagnosticsTrace ="true " pageOutput ="true"/>
When you set writeToDiagnosticsTrace to true, all calls to System.Web.UI.Page.Trace.Write(the ASP.NET TraceContent) also go to System.Diagnostics.Trace.Write, enabling you to use all the standard TraceListeners. The simple writeToDiagnosticsTrace setting connects the ASP.NET tracing functionality with the rest of the base class library.
New Trace Listeners in ASP.NET 2.0
The new ASP.NET 2.0 WebPageTraceListener derives from System.Diagnostics.TraceListener and automatically forwards tracing information from any component calls to System.Diagnostics.Trace.Write. This enables you to write your components using the most generic trace provider and to see its tracing output in the context of your ASP.NET application.
The WebPageTraceListener is added to the web.config as shown below.
<system.diagnostics> <trace autoflush ="false" indentsize ="4"> <listeners> <add name="webListeners" type="System.Web.WebPageTraceListener, System.Web" /> </listeners> </trace> </system.diagnostics>
XmlWriterTraceListener
XmlWriterTraceListener derives from TextWriterTraceListener and writes out a strongly typed XML file. The XML created is not well formed. Specifically, it doesn't have root node. It's just collection of peer nodes.
DelimitedListTraceListener
DelimitedListTraceListener derives from TextWriterTraceListener. It writes out comma-separated values (CSV) files.
Hence, this article gives brief introduction to new trace features available in ASP.NET 2.0
The 12 core practices of Extreme Programming (XP)
What are the basic practices of XP?
The 12 core practices of XP are:
The Planning Game: Business and development cooperate to produce the maximum business value as rapidly as possible. The planning game happens at various scales, but the basic rules are always the same:
Business comes up with a list of desired features for the system. Each feature is written out as a User Story, which gives the feature a name, and describes in broad strokes what is required. User stories are typically written on 4x6 cards.
Development estimates how much effort each story will take, and how much effort the team can produce in a given time interval (the iteration).
Business then decides which stories to implement in what order, as well as when and how often to produce a production releases of the system.
Small Releases: Start with the smallest useful feature set. Release early and often, adding a few features each time.
System Metaphor: Each project has an organizing metaphor, which provides an easy to remember naming convention.
Simple Design: Always use the simplest possible design that gets the job done. The requirements will change tomorrow, so only do what's needed to meet today's requirements.
Continuous Testing: Before programmers add a feature, they write a test for it. When the suite runs, the job is done. Tests in XP come in two basic flavors.
Unit Tests are automated tests written by the developers to test functionality as they write it. Each unit test typically tests only a single class, or a small cluster of classes. Unit tests are typically written using a unit testing framework, such as JUnit.
Acceptance Tests (also known as Functional Tests) are specified by the customer to test that the overall system is functioning as specified. Acceptance tests typically test the entire system, or some large chunk of it. When all the acceptance tests pass for a given user story, that story is considered complete. At the very least, an acceptance test could consist of a script of user interface actions and expected results that a human can run. Ideally acceptance tests should be automated, either using the unit testing framework, or a separate acceptance testing framework.
Refactoring: Refactor out any duplicate code generated in a coding session. You can do this with confidence that you didn't break anything because you have the tests.
Pair Programming: All production code is written by two programmers sitting at one machine. Essentially, all code is reviewed as it is written.
Collective Code Ownership: No single person "owns" a module. Any developer is expect to be able to work on any part of the codebase at any time.
Continuous Integration: All changes are integrated into the codebase at least daily. The tests have to run 100% both before and after integration.
40-Hour Work Week: Programmers go home on time. In crunch mode, up to one week of overtime is allowed. But multiple consecutive weeks of overtime are treated as a sign that something is very wrong with the process.
On-site Customer: Development team has continuous access to a real live customer, that is, someone who will actually be using the system. For commercial software with lots of customers, a customer proxy (usually the product manager) is used instead.
Coding Standards: Everyone codes to the same standards. Ideally, you shouldn't be able to tell by looking at it who on the team has touched a specific piece of code.
Environmental considerations with database connection strings
Because differing application hosting environments generally require environmental configuration changes to be made, such changes will need to be made to the application configuration repository as a post-publish activity. For ASP.NET applications, this will generally mean changing the web.config file, and the staff whom administer the hosting environment will generally change the application configuration as appropriate to suit the hosting environment.
Wouldn't it great if you didn't have to worry about making database connection string setting changes? Well, you can!Simply hold the application database configuration settings in a separate database connection strings xml file, thus:
<connectionStrings configSource="externalConnectionStrings.config"> </connectionStrings>
NOTE Using this mechanism requires that all of the application database connection strings are stored as within the connectionStringselement, which is the root element in the named xml file.Of course, the name of this external xml file can be whatever your feel is appropriate.You should ensure that the external application database connection strings xml file IS NOT a normal Project deliverable (keep it out of the normal application source code control) to ensure that the environment specific application database connection strings xml file is NOT over-written when the application is re-published to a different environment.Adopting the above mechanism, will ease the pain of application deployment by not requiring database connection string changes as a post deployment activity.Now, isn't that more appealing?
COM AddIn registration at deployment time
How many times have you forgotten something you had worked hard on and promised yourself that you would not forget how you did this thing? Well, if you use VS.NET 2003, have developed a solution which utilises COM and want to deploy your solution using the stock VS.NET Installer, then article is for you!
To deploy your code, you normally just choose the Add Project Output... context menu-item of your Setup project to have your selected Project's output files (Assemblies etc) included into your Setup project. This results in your msi file containing the project output files which are then deployed to the file-system of the machine when it is run.
Sadly, because my solution requires some COM plumming to be performed at deployment time, I found that my solution did not wholly work. The files and application Registry entries were being deployed, but the COM plumbing was being skipped.
Believe me when I say that I must have learned how to resolve this issue before as I had msi files for two previous releases which worked just fine. But I just couldn't recall what I did to fix this issue!
So, determined, and armed with earlier versions of installer for my solution, I searched for the answer...
How To Register COM Objects in Visual Studio .NET 2002 http://support.microsoft.com/?id=307367
This article explains the VS.NET 2002 actions to be performed but I could not find a corresponding VS.NET 2003 article. Everything being suggested was in order in my Setup project, but still the COM registration was not being performed at deployment time.
Using Orca, I discovered that the Class and ProgID tables of the latest msi were not being populated, whereas they were populated for previous releases. This indicated something fundamental was not being performed.
What Is ORCA and How Can I Acquire It? http://support.installshield.com/kb/view.asp?articleid=Q107066
Windows Installer - Class Table http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/shortcut_table.asp
After a good few hours of trying different approaches, I googled across this article...
David Guyer [MS] (VIP) There is a known bug (in both VS 2002 and VS 2003) where Regasm fails to register properly if you are trying to register an assembly and the dependency can't be found. If you run RegAsm in the bin dir, usually the dependencies are copied locally. However, setup projects run regasm from the obj dir (for other important reasons), where the dependency is not available. In this case, setup projects will fail to register correctly. The workaround is to add the assembly to your project as a "file", right-click in the File System Editor, and select Add File, and navigate to the assembly in the bin dir. Usually that gets regasm to work and we get theproper registration information. ---David Guyer - VBQA Deployment Testing http://www.dotnet247.com/247reference/msgs/46/231535.aspx
So, armed with this new information, here's what I did:
In my Setup project (Solution Explorer window), I removed the Project Output item - all the assemblies were automatically removed ;
Using the Setup project Add File... context menu-item, I added each of the relevant assemblies from the bin\release folder of my Solution's launch project, plus the type-library file, which is created as a result of a compilation where the Project Register for COM Interop option is set to True;
I then checked that the Register property of my TLB file was set to vsdrfCOM and the corresponding assembly Register property was set to vsdraCOM;
In my Set project (Solution Explorer window), I noted that all of the assemblies (files) I just added were now listed under the Detected Dependencies folder AND directly beneath the Setup project - to overcome a Build warning duplicate files message, I had to set theExclude property to True for each file listed beneath the Detected Dependencies folder;
After selecting the Setup project's Build option the msi was created;
Using Orca, I now checked the msi Class and ProgID tables and they were now populated, as before.
After running the msi, all files were correctly deployed to the file-system and the appropriate COM registration had been performed.
Oh, deep joy!
I hope this artcile helps me to remember a hard-learned lesson and also helps anyone else suffering the same issue a speedy resolution to a nasty and not well publicised VS.NET deployment issue.
Update - I found this response to a NewsGroup post, which partly explains what happens behind the scenes when you create a VS.NET Installer.
From: Phil Wilson ([email protected]) Subject: Re: installer woes (MSI generated by VS.NET 2003) Newsgroups: microsoft.public.windows.msi Date: 2005-02-01 19:18:58 PST
If I had to make one major point about this, it's that you don't need to be in the business of writing your own registration code to make this work. If you put your assembly in an application folder and in its Properties mark it to be registered (vsdraCOM IIRC) VS will extract the registration data into the MSI file and create the right registry entries at install time. The reason this works is that VS sees the Register property and behind your back it runs regasm /codebase to create a .reg file that it imports into the MSI file. You could even think about doing this yourself if you like, just to see what happens. Use regasm /codebase on your assembly to create a .reg file and then import that file into the Registry view in the Visual Studio IDE. Some of the paths will be wrong - you might need to use [TARGETDIR]your.dll to specify the Codebase value, and the InprocServer32 will be [WindowsFolder]mscoree.dll, if I've remembered properly. -- Phil Wilson[Microsoft MVP-Windows Installer]
How to apply Windows XP themes to an Office 2003 COM AddIn
When you create a COM add-in for a Microsoft Office program (for example, Microsoft Visio), the appearance of that add-in will conform by default to the standard Office appearance. However, with Microsoft Windows XP, you can choose from a number of visual styles (or themes) to customize the appearance of a Microsoft Windows program.
Unless Windows themes are explicitly enabled for a COM add-in, the appearance of the add-in does not change with these color schemes, leading the add-in to appear dated or out-of-synch with the program where it is contained. With the Microsoft Visual C or the Microsoft Visual Studio .NET languages, you can enable your COM add-in to opt-in to Windows themes.
When you enable an add-in for Windows themes, the themes affect only the appearance of the add-in. The functionality of the add-in is not affected.
How to apply Windows XP themes to Office COM add-ins
COM AddIn and the AssemblyVersion setting
Using VS.NET 2003, I made a rather innocent change to my AssemblyInfo file of my COM AddIn Solution which then resulted in me not be able to debug the application!
In my AssemblyInfo file, I set the Build element value to an explicit value (e.g. 1.0.5.*) to bring the assembly file version in-line with the displayed application product version. There were no compilation or runtime exceptions, but all of a sudden my breakpoints were being ignored!
As I had made several software changes prior, I decided that a machine re-start was in order... After the machine re-start my breakpoints were still being ignored, so I checked debugging of another solution; that worked fine. This indicates that the problem is likely to be local to the Solution I was debugging. So I changed the AssemblyVersion value back to its previous value (1.0.*) and hey presto, debugging was back in action! I changed the value again (1.0.5.*) and my breakpoints were once again being ignored.
I checked VS.NET Help and what I was trying to do is supported - it just didn't work for me. PAH! So I guess I'll have to live with this issue for now; not a show-stopper but annoying just the same.
NOTE My Solution utilises COM registration, which may have some bearing on this odd behaviour.
Select a large block of code in the Code Pane
Sometimes you need to select a large block of code, which may extend beyond the visible area of the VS.NET Code Pane Window. Normally selecting the large code blocks can be a fiddley process which you don’t always get right.
For a more precise method, try the following keyboard shortcuts:
Place your cursor immediately to the right of the opening curly brace of the code block you wish to select
Press Ctrl+] to navigate to the matching closing curly brace
Press Ctrl+= to select all of the code between these curly braces
Your code block has now been selected.
Visual Inheritance - How to escape Layout Hell
A common design issue – how to efficiently achieve a high level of user-interface consistency.
This article proposes a well defined technique and has come to my rescue on more than one occasion! Visual Inheritance - How to escape Layout Hell