Archive for the 'Visual Studio' Category
Tech-Ed Developers 2008 in Orlando
If anyone is going to the conference and would like to meet up to chat, just drop a comment and we’ll set something up.
2 commentsVisual Studio 2008 Impressions
VS 2008 and the accompaning c# 3.0 has virtually changed the way I write code. I know that’s a lot to say about a product, but I feel that strongly about it. It has simplified my writing by exciting me to go back and look at how I write code.
I’ll start with Lambda Expressions because they have made the most difference in my code. For those who need a starter course, a good article on them is here. What I love about them is ability to create action functions with them. An example would be the following:
_listofWidgits.ForEach(t =>
{
//Do something to each widgit.
}
No defining some method, just do it. Another alternative would be to define a method that takes a widgit as the only parameter and phrase it as follows:
_listofWidgits.ForEach(SomeMethod); //No need to spell out the fact that you are passing a widgit to the method. Intellisense does it for you.
How’s that for shortening your code. Anyway, I’ll talk more about LINQ and c# 3.o soon.
No commentsVisual Studio 2008 RTM
Well it’s finally here. We’ve all been waiting for the final version and the wait is over. We have already converted our applications to the .Net 3.5 framework and the conversion was completely painless. No conflicts whatsoever. The 3.5 framework still uses the .Net 2.0 runtime, so the conversion should happen without major problems if coming from a 2.0 or 3.0 codebase.
I’ll update more as the weeks progress on the new features and our experiences with them.
Garick
No commentsDebugging 64-bit applications using Visual Studio 2008
A short note on this issue that I came across recently. Let’s say we are trying to debug a managed/unmanaged code in Visual Studio 2008 in a 64-bit machine. We complete the code and hit F5 (debug the application), and land up with the following error:
Error while trying to run project: Unable to start debugging.
The components for the 64-bit debugger are not registered. Please repair your Visual Studio 2008 Remote Debugger installation via ‘Add or Remove Programs’ in Control Panel.
Okay all that we are doing is debugging an application in the local machine. So why should there be a problem with the remote debugger installation? Here is some background on how debugging works in 64-bit environment that explains why you see this error message.
Even on a 64-bit machine, Visual Studio runs as a 32-bit application. This means that Visual Studio would run in the Windows-on-Windows (WoW64) layer. It would not be possible to attach a 32-bit debugger to a 64-bit process. However, if you want to debug a 64-bit application, there is something special that Visual Studio does to make this possible. We would achieve this pseudo-remotely. You are running the debugger on the same machine as the process but debugging is done through the remote debugger. All this happens behind the scenes and you as a developer would not need to do anything special.
Now, if you are seeing this error on a 64-bit machine, I would assume that the remote debugging components were not included during the Visual Studio installation process. All that we would need to do is install the remote debugging components using the link below following the instructions under the section ‘To install remote debugging components (non-SQL Server 2005)’. And yeah, we would not need to worry about the remote debugging permissions since we are just debugging an application in the local machine in this case.
1 commentC# 3.0 LINQ Wow!
I just read this months article in the MSDN magazine (C# Evolution) and I’m excited about this addition to C-Sharp in the next version. I have worked as a DBA and find adding the from, where, select, orderby, group by, let, and join to objects in .NET most interesting. Alot of times, I’ve used techniques like this to accomplish the goals but the verbage becomes lengthy. C# 3.0 solves this problem.
LINQ has the following parts:
- Lambda Expressions are a language feature that is similar in many ways to anonymous methods. The basic idea is that you can treat code as data.
StaticMethods.Where(customers, c => c.ZipCode == 91822);
- Extension methods are basically static methods that are callable through an instance syntax.
- The above Where method would be an Extension Method. It would be exposed on an instance member though. customers.
- public static IEnumerable<T> Where<T>(this IEnumerable<T> items, Func<T, bool> predicate)
- Anonymous Types and Implicitly Typed Local Variables can be used together to specify types “On the fly” inside a method.
- Instead of create a placeholder class (Customer name and address) for each time you want to pull something out of a collection, you declare a var variable and use an anonymous type to populate it.
- val custAddress = new { FullName = c.FirstName , HomeAddress = c.Address };
- Object initializers basically allow the assignment of multiple properties or fields in a single expression.
- Create an instance of a class without overloading the constructor a million times.
- Customer customer = new Customer() { Name = bob, Address = Wilco Way };
- These all lead up to Query Expressions. SQL like ways of accessing .NET objects.
-
var locals = from c in customers
where c.ZipCode == 91822
select new { FullName = c.FirstName, HomeAddress = c.Address };
-
var locals = from c in customers
Coming from both a coding and dba background, I find these enhancements in “Orcas” wonderful. It could save a ton of time in coding.
Do yourself a favor and go checkout C# 3.0 and “Orcas”.
No commentsVisualSVN and Windows Workflow Problem
After installing the V1.2 upgrade, I’ve found that any solution with Windows Workflow used will not open and will crash Visual Studio 2005. I’ve submitted a request to their site and will post back more when I have it.
05/09/2007 –>A bug fix release has been release: V1.2.1 that now works with Windows Workflow projects.
No commentsHow to use Windows Certificate Authority to Strong Name Assemblies
I recently wanted to use the internal Certificate Authority for all our code signing requirments. After several hours of pain I was able to get it to work but thought I’d document the procedures so other’s won’t have the same problems.
- Ensure a Certificate Authority is installed and running on the Active Directory domain.
- The windows certificate authority uses a web based request form so open IE and browse to the site. (ex http://someserver/certsrv)
- When requesting the certificate, you will need to choose advanced for certificate type and select code signing as the type. Also ensure you choose Microsoft Enhanced Cryptographic Provider and not the Basic or RSA provider. (I’ll explain below) Figure 1
- Choose to Mark Keys as Exportable and choose a password. Save the file with a *.pvk extension.
- Click submit. You will be prompted to save the pvt and then click to save the certificate. Do not save the full certificate path as strong naming does not support certificate chaining.
- Open a Visual Studio command prompt and navigate to the location you saved the files.
- Type cert2spc yournewfile.cer yournewfile.spc where yournewfile is the filename you gave the pvk when saving it. This will convert the cer to a compatible spc file.
- Type pvk2pfx -pvk yournewfile.pvk -spc yournewfile.spc A wizard will open, follow prompts making sure to check the box to make the private keys exportable.
- The new *.pfx file can be used to sign assemblies and the computers inside the network will be able to verify the certificate against the internal Certificate Authority.
You will receive the dreaded “Error Importing Key – Object already existing” error when trying to compile if you choose the wrong provider, ie the provider is incompatible with Visual Studio code signing.
Figuring this was a straight forward procedure, I requested a certificate and private key pair from the Certificate Authority and that’s where the trouble started.
VisualSVN Visual Studio Plugin for SVN
We have now moved to the VisualSVN product for a Subversion plugin for Visual Studio. Ankh did not support BugId integration. VisualSVN uses TortoiseSVN as the backend for connecting to the Subversion repository. If you’re using Subversion in a Visual Studio environment, due yourself a favor and try VisualSVN.
No commentsFollow-up to Subversion Conversion
Well 2 weeks after the migration from Visual SourceSafe to Subversion, we are very pleased with the results. It has cut our remote developer’s download times by 70%. The merge capabilities in TortoiseSVN are outstanding. Below you will find links to all the resources we used to move the data from VSS and the executables for the software.
- Subversion – The server software.
- TortoiseSVN – A windows shell extension used as a client for the SVN repository.
- AnknSVN – An addin for Visual Studio used as a client for the SVN repository.
- VSSMigrate – A .net program for migrating projects and their revision history to Subversion.
If you’re looking for a solid source control at a great price, Subversion is the way to go.
No commentsSource Control Alternatives to VSS
We have been looking at alternatives to Visual SourceSafe over the last few weeks and we’ve settled on the open source solution called Subversion. This product is the successor to CVS and adds a good set of features. We’ve documented a 8x improvement in remote performance when doing full gets of the entire project structure. There are many good open source clients: TortoiseSVN, SmartSVN, VisualSVN etc. Several have good IDE plugins providing the same or close to the feature set of the SourceSafe plugin. Also the VSSMigrate script , here was very easy to move all of the files and history from VSS to the new SVN repository.
For those looking for an alternative to VSS, due yourself a favor and look at Subversion. Best of all the price is just right, FREE!
No comments