Problems Upgrading VS Solutions to 2008 With CruiseControl.Net#

Problem:

We have a server that gets all files from TFS and uses Nant w/ Visual studio to compile our projects.  Basically nant issues a command line statement to get VS to build a given solution.

Everything was working great, until I upgraded our clients to 2008.

I went through and upgraded all our solutions.

I installed vs 2008 on the server.  But when I try to build from the command line, it tells me that the solution file "is from a previous version of this application and must be converted in order to build in this version of the application."

I tried directly copying my solution file (skipping the source control step) directly to the server but I get the same message.

If I try to build it from the command line with VS 2005 it tells me that the solution is too new!! 

So 2005 says the solution is too new, 2008 says it is too old!

The solution on the server has the "version 9" icon, just like on my laptop.

The solution file starts with:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008

Resolution:

Even thought I compared the solution files and found them to be exactly the same using a diff compare tool, I allowed the server to run the "upgrade" process on the solutions.  I didn't save any of the changes it made, but from then on it recognized those files as having been already upgraded.

I even replaced the "server upgraded" solution files with the old solution files that it didn't like and it continued to work just fine.

There must be some other files stored somewhere that made it think that it hadn't been upgraded yet.

This isn't a great solution, but it works at least.

 

Categories: Programming | .Net | VS.Net | TFS | VSS
Monday, March 16, 2009 9:43:30 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Regenerating the designer.vb and designer.cs files#

Chances are you have had this happen to you.

You start getting compile errors on your asp.net controls in your code behind pages.  But the controls exist on the page??  Whats the deal?

Well, in VS2003 the designer would create the class level controls in your code behind.  It would created a special region where it would put all it's autogenerated code.

2005 brought the new "Web Site Project" which used a "CodeFile" instead of "CodeBehind" attribute on the page tag.  In addition, the codefile/codebehind became a Partial Class.  VS would then put all the generated code in a seperate file so it didn't cramp up your code behind.

In Web Application projects, the autogen code is stored in .designer.vb files:

But everynow and then, things get out of sync, or the designer files get totally lost.

Here is how you can regenerate them:

First, make sure your class names, and page attributes are right.  The Page tag should have a Codebeind attribute pointing to the aspx.vb file and an Inherits attribute that contains the fully qualified class name in the codebehind.  (This instructions are for Web App Projects, not Web Site Projects, which use Codefile instead of Codebehind).

Second, create a designer file if one doesn't exist.  Click the "Show all files" icon in the Solution Explorer to see if you have designer files.  If not, add a class file with the right name page_name.aspx.designer.vb.  VS will automatically put it "under" the aspx page.

Make sure all namespaces are right.  Check your code beind, your designer file, and your page codebehind attribute.

Open your page in a designer and rename one of your controls.  Save everything and close the code and designer windows.  Open the designer back up and rename the control back.  Now look at your designer file, it should have a punch of controls in it, and now VS shouldn't complain about compile errors in your code behind.

 

Categories: Programming | .Net | ASP.Net | VS.Net
Monday, February 23, 2009 4:07:35 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Visual Studio .Net 2008 - Making sense of all the versions#

Microsoft really does a terrible job explaining all the variations of Visual Studio .Net 2008 (and there are many):

  • Visual Web Developer 2008 Express Edition
  • Visual Basic 2008 Express Edition
  • Visual C# 2008 Express Edition
  • Visual C++ 2008 Express Edition
  • Visual Studio 2008 Standard Edition
  • Visual Studio 2008 Professional Edition
  • Visual Studio Team System 2008 Architecture Edition
  • Visual Studio Team System 2008 Database Edition
  • Visual Studio Team System 2008 Development Edition
  • Visual Studio Team System 2008 Test Edition
  • Visual Studio Team System 2008 Team Suite

After a lot of searching, I finally found this data sheet that explains most of it.

Why this was so hard to find is anyones guess.

Categories: Misc | Programming | .Net | VS.Net
Thursday, March 20, 2008 12:43:45 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

VS.Net Macro Editor Errors#

When I try to edit some of my Macros I get this nice little message:

Microsoft Visual Studio Macros: An Add-In has caused an access violation while sinking on 'ProjectAdded'.

Google turns up nothing on this guy.

Does anyone out there have any idea how to fix this?

Categories: Programming | .Net | VS.Net
Monday, November 19, 2007 3:21:26 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

My Dark Theme for Visual Studio.Net#

I have been wanting to try a dark theme for vs.net, but I couldn't quit find one I liked.

So I took bits from here and from Scott Hanselman and created my own.

Take a look at some screen shots, and you can download the settings file at the bottom.

 

 

 

Here is my settings file:
Dark-Theme.vssettings (32.85 KB)

If you like this, please leave a comment!  Thanks.

 

Categories: Programming | .Net | VS.Net
Friday, November 09, 2007 11:42:25 AM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

 

TFS Source Control "No Commands Available"#

I just opened VS to do something in TFS Source Control Explorer only to find that all my controls were disabled and right clicking on anything only showed "No Commands Available."

Turns out that this was because I had to change my default source control plugin to VSS for a project I was working on.  If you go to Tools->Options->Source Control and select TFS as the default SCC plugin, it will fix the problem.

Categories: Programming | .Net | VS.Net | TFS
Monday, August 13, 2007 10:48:25 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Adding Static Code Analysis To Team System/TFS#

So I have this problem.

If someone declares:

Public iProductId as Integer

then I want to be notified.  But if someone declares:

Protected WithEvents txtUserName as Textbox

I don't want to be bothered.

Every control declaration we have throws an error in the static code analysis tools.

So after asking around, I guess it is not possible to cusomize the existing rules to exclude common prefixes such as lbl, txt, cmd etc.

So apparently the only option left is to disable those rules and create my own. 

So here are a few links that deal with creating custom links.

MSDN

Kevin Castle

FxCop Team

 

Categories: Programming | VS.Net | TFS
Monday, June 11, 2007 1:48:08 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.Net SP1... kinda crashy#

I installed Vs.Net a few days ago... and so far I think I have had 4 complete crashes of VS.Net.

I am not sure that this is being caused by SP1, but it is crashing in ways it never did before.

I will give it another few days and then rollback if this keeps happening.

Categories: Programming | .Net | VS.Net
Thursday, January 11, 2007 2:49:35 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

VS.Net for Database Launch Event#

Microsoft is releasing "Visual Studio Team Edition 2005 for Database Professionals" (who on Earth comes up with these names????).

MS is holding some launch events all over where you can come (for free) and learn a little about this product, which from what I saw looks pretty slick.

http://www.teams-deliver.com

Categories: .Net | VS.Net | SQL Server
Monday, November 06, 2006 4:36:25 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Missing Step in, Step Out and Macros in VS.Net#

A while back I had some problems with a coworkers VS.net settings.

They were missing the step in and step out as well as the Macros option in the tools menu.

We were able to get these back by changing the VS.Net settings by going to Tools->Import and Export settings.

Then select to Import settings and pick where you want to backup your current settings.

Then I think we picked "Visual Basic Development Settings" or maybe "General Development Settings."  This seemed to get things back to normal for the most part.

I still have a few problems, like if I am working on some file, that file will not be highlighted in the solution explorer (what a pain) and I can't right click on a webform and select "View Code" (what a pain).

It looks like MS was trying to make it really customizable, but I think they ended up making it a pain to get things working the way you expect them to.

 

UPDATE:
I was able to quickly find a setting to make sure that the current page I was working on became tracked in Solution Explorer:

 

Categories: Programming | .Net | VS.Net
Wednesday, November 01, 2006 4:38:40 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Printing Vb.Net Forms with PrintForm Component#

Microsoft has released their first 3 Power Packs for Visual Basic 2005, which are "free Add-Ins, Controls, Components, and Tools for you to use with Visual Basic 2005 to make developing great applications even easier."

1 of the first 3 is the Microsoft PrintForm Component 1.0 , which gives you the ability to easily print a form.

I could have really used this on my last project, where I manually wrote the code to do just that.

Categories: Programming | .Net | VB.Net | VS.Net
Monday, October 09, 2006 2:58:15 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.Net Macro to Narrow VB.Net Method Signatures and Function Calls#

Lately I have been doing some refactoring of code as I go through it.

Trying to name variables correctly, breaking up long methods, trying to adhere to some coding standards.

One way that I have been employing to clean up code is to convert very long method signatures, or calls to methods with many parameters from LONG single line entities to shorter multi-line blocks.

This is simple, but tedious.  So I wrote a VS.Net macro to do it for me.

Simply copy and paste the macro code (paste into wordpad first to get rid of the missing newline problem) at the bottom of this article into a macro.  Then all you have to do is highlight the entire row you want to "narrow", and run the macro.  You can always Cntl+z out of it if you want to undo the changes.

The results are good!  The following are examples of a long method signature, and a call to a method with a lot of arguments, and then the refactored results.

'*** Long method signature
Public Function ActivitySave(ByVal Activity As MyNamespace.Business.Equipment.Activity, ByVal StartTime As DateTime, ByVal EndTime As DateTime, ByVal StatusOverride As System.Nullable(Of MyNamespace.Business.Data.Criteria.Equipment.ActivityStatusEnum), ByVal Clerk As Integer) As Integer

'*** long method call
ActivityID = MainActivity.ActivitySave(Activity.ActivityID, Activity.Status, Activity.PurposeNotes, Activity.JobIndex, Activity.CategoryID, Activity.RequestedStartDate, Activity.RequestedEndDate, Activity.EquipmentID, Activity.PlanStartDate, Activity.PlanEndDate, Activity.ActualStartDate, Activity.ActualEndDate, Activity.DiscountScheduleID, Activity.DiscountOffset, Activity.CodeID, Activity.RentalRate, Activity.RowVersion, Clerk)

Here is the result of the refactoring:

'*** Refactored long method signature
Public Function ActivitySave(ByVal Activity As MyNamespace.Business.Equipment.Activity, _
ByVal StartTime As DateTime, _
ByVal EndTime As DateTime, _
ByVal StatusOverride As System.Nullable(Of MyNamespace.Business.Data.Criteria.Equipment.ActivityStatusEnum), _
ByVal Clerk As Integer) As Integer

'*** Refactored long call
ActivityID = MainActivity.ActivitySave(Activity.ActivityID, _
Activity.Status, _
Activity.PurposeNotes, _
Activity.JobIndex, _
Activity.CategoryID, _
Activity.RequestedStartDate, _
Activity.RequestedEndDate, _
Activity.EquipmentID, _
Activity.PlanStartDate, _
Activity.PlanEndDate, _
Activity.ActualStartDate, _
Activity.ActualEndDate, _
Activity.DiscountScheduleID, _
Activity.DiscountOffset, _
Activity.CodeID, _
Activity.RentalRate, _
Activity.RowVersion, _
Clerk)

 

Here is the macro.

 Public Sub NarrowMethodsAndCalls()
'Create an Undo context object so all the changes can be
'undone by CTRL+Z
Dim oUnDo As UndoContext = DTE.UndoContext

'Supress the User Interface. This will make it run faster
'and make all the changes appear once
DTE.SuppressUI = True
Try


Dim oTextSelection As TextSelection = DTE.ActiveWindow.Selection
Dim sOrigText As String = oTextSelection.Text

Dim RegExp As New System.Text.RegularExpressions.Regex("([ .=_a-zA-Z0-9]*)\(")
Dim Match As System.Text.RegularExpressions.Match = RegExp.Match(sOrigText)
If Match.Success Then
Dim sMethod As String = Match.ToString
Dim sParametersAndReturn() As String = sOrigText.Replace(sMethod, "").Split(",")
Dim sFirstLineWhiteSpace As String
Dim sb As New System.Text.StringBuilder
sb.Append(" ", Trim(sMethod).Length)
sFirstLineWhiteSpace = sb.ToString

'*** redo the first line
oTextSelection.Text = sMethod & sParametersAndReturn(0) & ", _"
oTextSelection.NewLine()
oTextSelection.Text = sFirstLineWhiteSpace

For i As Integer = 1 To sParametersAndReturn.Length - 2
oTextSelection.Text = Trim(sParametersAndReturn(i)) & ", _"
oTextSelection.NewLine()
Next
oTextSelection.Text = Trim(sParametersAndReturn(sParametersAndReturn.Length - 1))
oTextSelection.NewLine()



Else
MsgBox("failed to find function regexp match")
End If
Catch ex As Exception
MsgBox("Error: " & ex.ToString)
Finally

'If an error occured, then need to make sure that the undo context is cleaned up.
'Otherwise, the editor can be left in a perpetual undo context
If oUnDo.IsOpen Then
oUnDo.Close()
End If

DTE.SuppressUI = False
End Try

End Sub
Categories: .Net | VB.Net | VS.Net | Macros
Wednesday, September 27, 2006 10:52:05 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Select DataSource and Visual Studio Errors#

I recently ran into a nebulous problem when creating a windows app with vs.net 2005.

I would select the DataBindings or DataSource properties from the proeprties window (click the dropdown) and VS would give me an "Object reference not set to an instance of an object" error.

Fantastic!

I finally figured out the problem was caused by a recent rename of a misspelled class.

This class was being used by one of the datasources.  As soon as I changed the name of that class, the datasource became invalid, and I guess when VS tries to get a list of the these datasources for the dropdown it just blows up.

Once I deleted the problematic datasource everything went back to normal.

Categories: Programming | .Net | VS.Net | WinForms
Tuesday, August 01, 2006 9:25:40 PM (Central Daylight Time, UTC-05:00) #    Comments [2]  | 

 

Adding a Single Project To Source Control? #

In previous versions of VS.Net you could take a project and go File->Source Control->Add Selected Project To Source Control and you could simply add the project to your VSS provider.

Now in VS.Net 2005 (maybe caused by VSS 2005, or VSS 2005 over HTTP), if you follow this route you will end up with File->Source Control->Add Project to Source Control, and your project will be added with the following path:

$\MyProject.root\MyProject.

Thanks VSS, thanks a lot.  I really needed that .root in there.

To get around this problem, just add another existing project to VS.Net (creating a solution).  Now highlight the actual project you want to add and do:

File->Source Control->Add Selected Project to Source Control and all will be wonderful.

Categories: Programming | .Net | VS.Net | VSS
Tuesday, May 02, 2006 2:43:04 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

No Tools->Macros in VS.Net 2005#

Some people I work with have no Macros menu under Tools in vs.net 2005.

I am still trying to figure this one out, but in the mean time you can access most of the features with the following shortcuts:

Categories: Programming | .Net | VS.Net
Tuesday, May 02, 2006 10:44:43 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS2005 VB.Net Create Properties From Private Fields#

"Refactor!" has the ability to turn your fields into public accessible properties, but it kinda sucks because 1) you have to do it 1 at a time, and 2) the naming convetion is all wrong. 

For example if you have a private integer called myInt then your property will be MyInt1.  Not exaclty what I am looking for.

So I updated my 2002 macro for creating these properties.  It should allow you to follow a variety of naming conventions "m_XXX", "ciXXX", "strXXX" etc.

Just include the macro below, then just highlight your private fields, and run the macro.

   ' highlight the private properties
Public Sub AddClassProperties()

Dim oTextSelection As TextSelection = DTE.ActiveWindow.Selection
Dim iLinesSelected = oTextSelection.TextRanges.Count
Dim colPropertyList As New Collection()
Dim iIndex As Integer
Dim oStart As EditPoint = oTextSelection.TopPoint.CreateEditPoint()
Dim oEnd As TextPoint = oTextSelection.BottomPoint

'Create an Undo context object so all the changes can be
'undone by CTRL+Z
Dim oUnDo As UndoContext = DTE.UndoContext

'Supress the User Interface. This will make it run faster
'and make all the changes appear once
DTE.SuppressUI = True

Try

oUnDo.Open("Comment Line")

Dim sProperty As String
Dim sLineOfText As String

Do While (oStart.LessThan(oEnd))

sLineOfText = oStart.GetText(oStart.LineLength).Trim
'*** do some kind of simple check to make sure that this line
'*** isn't blank and isn't some other kind of code or comment
If (sLineOfText.IndexOf(" As ") >= 0 And ( _
(sLineOfText.IndexOf("Public ") >= 0) Or _
(sLineOfText.IndexOf("Private ") >= 0) Or _
(sLineOfText.IndexOf("Dim ") >= 0) Or _
(sLineOfText.IndexOf("Protected ") >= 0) Or _
(sLineOfText.IndexOf("Friend ") >= 0) Or _
(sLineOfText.IndexOf("ReDim ") >= 0) Or _
(sLineOfText.IndexOf("Shared ") >= 0) Or _
(sLineOfText.IndexOf("Static ") >= 0) _
)) Then

sProperty = oStart.GetText(oStart.LineLength).Trim.Replace(" New ", " ").Replace("()", "")

colPropertyList.Add(sProperty)
End If

oStart.LineDown()
oStart.StartOfLine()

Loop

If colPropertyList.Count > 0 Then

For Each sProperty In colPropertyList
Call InsertProperty(sProperty)
Next

Else
MsgBox("You must select the class properties")
End If

Catch ex As System.Exception

Debug.WriteLine(ex)
If MsgBoxResult.Yes = MsgBox("Error: " & ex.ToString & vbCrLf & "Undo Changes?", MsgBoxStyle.YesNo) Then
oUnDo.SetAborted()
End If

Return
Finally

'If an error occured, then need to make sure that the undo context is cleaned up.
'Otherwise, the editor can be left in a perpetual undo context
If oUnDo.IsOpen Then
oUnDo.Close()
End If

DTE.SuppressUI = False
End Try


End Sub

Private Sub InsertProperty(ByVal sProp As String)
Dim oTextSelection As TextSelection = DTE.ActiveWindow.Selection
Dim sMember As String = sProp.Substring(sProp.IndexOf(" ")).Trim
Dim sDataType As String
Dim sName As String
Dim i As Integer
Dim iAscVal As Integer

i = sMember.IndexOf("(")
If Not i = -1 Then
sMember = sMember.Substring(0, i)
End If

i = sMember.IndexOf("=")
If Not i = -1 Then
sMember = sMember.Substring(0, i)
End If

sDataType = sMember.Substring(sMember.IndexOf(" As ") + 1)

For i = 0 To sMember.Length - 1
'iAscVal = Asc(Mid(sName, i, 1))
iAscVal = Asc(sMember.Chars(i))
If iAscVal > 64 And iAscVal < 91 Then
sName = sMember.Substring(i)
Exit For
End If
Next i

sName = sName.Substring(0, sName.IndexOf(" As ") + 1).Trim

If sName.Length = 0 Then
MsgBox("Unable to process the class property: " & sMember & ". This is usually caused by an incorrect naming convention (e.g. not cxName)")
Return
End If

sMember = sMember.Substring(0, sMember.Length - sDataType.Length).Trim

With oTextSelection
.MoveToPoint(.ActivePoint.CodeElement(vsCMElement.vsCMElementClass).GetEndPoint(vsCMPart.vsCMPartWhole))
.LineUp()
.EndOfLine()

.Text = "Public Property " & sName & "() " & sDataType
.NewLine()
.Text = "Return " & sMember
.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn, True)
.Copy()
.LineDown(False, 3)
DTE.ExecuteCommand("Edit.Paste")
.Text = "Me." & sMember & " = Value"
.LineDown(False, 2)
.NewLine(2)

End With

End Sub

 

 

Update1: When using code that you cut and paste from here, you might need to first paste it into Word or Wordpad.

Update2: When using this macro, you need a space (new line) between the last private field variable and your end of class line.

Categories: .Net | VB.Net | VS.Net | Tools
Thursday, April 27, 2006 9:53:16 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Delete the Web Apps DLLs and Everything Works#

Here is another of my favorite problems with VS2005.

If I have a Web Application Project.  If I build it (with no errors) then when I try to view it I get the error below.  However,

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The type 'Company.Web.Equipment.Global' is ambiguous: it could come from assembly 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\equipment\3f386648\c5a85b94\App_Code.gv_z5p7w.DLL' or from assembly 'C:\Data\Company\Company.Web.Equipment\bin\Company.Web.Equipment.DLL'. Please specify the assembly explicitly in the type name.

Source Error:

Line 1:  <%@ Application Inherits="Company.Web.Equipment.Global" Language="VB" %>

Source File: /Equipment/global.asax    Line: 1


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

 

I don't know why it is only happening with this one web app.

Very frustrating.

Update: This has been resolved.  The problem is obvious now.  This was a web application that had been converted to a Web Site Project.  When I tried to reimport the files manually into a new Web Application Project there was one minor, yet major, difference that was causing it to fail.  The "CodeBehind" attribute had been changed to "CodeFile".  I didn't think much of it at the time, but of course this indicates that it is going to actually USE the codefile when the page is accessed.  By having a CodeFile attribute AND compiling the code into a DLL, I was ending up with copies of every class.

Categories: Programming | .Net | ASP.Net | VS.Net | Rants
Thursday, April 20, 2006 5:00:08 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Upgrading ASP.NET to 2005? Check your references.#

Some of my web applications that I have recently upgraded to 2005 at some point had their references changed to point to the DLLs that were already in the bin directory.

Of course this was causing all kinds of problems with missing DLLs and compile problems.

Make sure you check your references to see that they are not just pointed back into the bin.

 

Categories: Programming | ASP.Net | VS.Net
Thursday, April 20, 2006 4:32:51 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Implementing System.ICloneable and a Snippet#
This will provide the necessary functions to implement ICloneable as well as a type specific Clone method.
        
Public Function Clone() As ClassName
Dim bFormatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
Dim stream As New System.IO.MemoryStream()
bFormatter.Serialize(stream, Me)
stream.Seek(0, System.IO.SeekOrigin.Begin)
Dim newClone As ClassName
newClone = CType(bFormatter.Deserialize(stream), ClassName)
Return newClone
End Function
Private Function ICloneableImplementation() As Object Implements System.ICloneable.Clone
Return Me.Clone
End Function


I wrapped this into a snippet that you can import into Visual Studio 2005.

Implement ICloneable.snippet (1.84 KB)


Categories: Programming | .Net | VB.Net | VS.Net | Tools
Thursday, April 20, 2006 9:00:40 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS2005: C# Projects Get Reference Folder VB Doesn't#

In VS.Net 2003 projects had a little sub folder looking icon called References that you could quickly expance to see what assemblies are being referenced. 

In 2005, you have to open a projects page and navigate to the references tab, but only for VB.Net projects.  C# projects still get the nice shortcut.  Weird.

Categories: Programming | .Net | C# | VB.Net | VS.Net
Wednesday, April 19, 2006 3:51:13 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.Net 2005 Uses Wrong DLL For Reference#

I just came across another bug in VS.Net 2005.

When I went to upgrade some of my projects from 2003 to 2005 I copied them to a new folder.  So for the sake of simplicity lets say that my projects were in C:\Projects\ and the 2005 versions are in C:\Projects2005\.

Some of the projects had a reference to a DLL located in C:\Projects\MyDLL, so when you run the upgrade wizard, it adds C:\Projects\MyDLL as a reference path for your new project located in C:\Projects2005.

Now here is what ticked me off.

I had already taken the code from MyDLL and upgraded it to 2005, built the DLL, and put the DLL in C:\Projects2005\MyDLL.

So if you convert a project, it doesn't know about that new 2005 version of MyDLL, so I was nice enough to go in, remove the 2003 reference, and repoint it to the 2005 version.

However, at this point it says "Oh I see you want me to use this DLL, but it looks like there is one with the same (whatever criteria it uses, maybe just the name?) in my reference path (C:\Projects\MyDLL), so I'll just throw out whatever you were asking me to do and reference that one" which is EXACTLY what I didn't want it to do.

Categories: Programming | .Net | VS.Net
Wednesday, April 19, 2006 3:41:09 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS 2005: Remove Project=Lose Reference #

I had been really bugged by the way VS.Net 2005 seemed to treate project references.

As I mentioned in a previous post, if you remove a project from a solution, all references to that project are also removed from their respective project.

The result is that lots of project suddenly lose reference to a needed dll or project, and you have to go back and manually add the reference back in.  Big pain.

Thankfully, Mikhail Arkhipov from Microsoft has reassured me that 1) I am not going crazy, 2) this is not by design as in fact a bug, and 3) it will be fixed in a (hopefully soon to be released) service pack. 

Strike 1 issue with VS.Net 2005.  Only like 10 more to go.

Categories: Programming | .Net | VS.Net
Wednesday, April 19, 2006 3:16:03 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.Net 2005, Projects, Solutions, and References: What was MS thinking??? This SUCKS!!!!#

This is really shocking (and very disappointing) to me.

I had the task of upgrading the code base at Walsh Construction from .net 1.1 to 2.0 and putting it all in a source control database.

I had been getting a lot of totally random build problems, and I started wondering: Where does it store my references?

ASP.Net Web Sites projects don't have a vbproj or csproj file anymore, so where is it storing the fact that I want this website to have a references to a given DLL or a given project in my solution?

I found that the answer is that the project references are stored in the solution file! 

If you open up the solution file you will find lots of stuff like this:

ProjectSection(WebsiteProperties) = preProject
ProjectReferences = "{E050AEA3-6DCA-4DE8-936F-5A8B14A912B9}|MyReferencedAssembly.dll;

This is kinda stupid.

Non-website projects keep a list of their references in their project file.

Websites keep SOME reference info in their web.config, although I think that is only for DLLs that are in the GAC.

Anyway on to the list of things that truly suck about how this works:

1)  When you add a reference from a web project to a DLL, the DLL is copied to the Bin directory right then, as opposed to when you do the build.  I bet it does it at build-time as well, but what really sucks is that you can have a situation where WebSiteA references ComponentA which references DataAccessLayerA.  WebSiteA will have DataAccessLayerA.dll in it's bin directory, then if you go to add a references from WebSiteA to DataAccessLayerA, it will say "Oh you already have a reference" when you really don't, and if you try to build it won't work until you go delete that dll from your bin and add the reference.

2)  I have been unable to open some projects without opening the entire solution that I joined them too at one point.  Basically as I was converting all our projects over to 2003 I wanted to also change them from DLL references to project references.  So I created a solution with ever project and website we have in .net.  To illustrate my problem, I added a project to the solution called IAmABogusProject with 1 class and 1 static method.  No one uses this class, no projects have a reference to this project, and this project has no references to any other projects.  Yet, if I go click on the vbproj file for this project, it loads up my solution file with every single project.  I tried creating another solution and adding it to that one to see if it would open the new solution when I tried to reopen the project but no luck, it opened original solution with every application again!! WTF!!

3) This is the worst of the list.  If you have a project in a solution that is referenced by some other projects and you remove that project from the solution, guess what happens?  In 2003 it would remove the project and all the referencing projects would show a missing reference icon.  In 2005 it checks out all the referencing projects and removes the reference!!!  Are you kidding me???  For the cherry on top, you have to then manually add all the references back after you add the project back into the solution, and of course you get all kinds of weird bugs, none telling you that you are missing an assembly reference.  Totally stupid.   This is a bug, see Update3 at the bottom.

I am really pissed about this.  Why do MS product upgrades frequently come with a "What were they thinking?" tag? 

Maybe the roll of the solution has changed or something, but this is going to really piss me off working like this day to day.

I have already had something happen where all my website projects that I had already added to source control lost their binding.  Great....

Update1:  I am continuing to have problems with my web project "losing" references that I have to keep setting.  What a pain this is becoming!

Update2: Scott Gu from Microsoft (http://weblogs.asp.net/scottgu) suggested that I give the Web Application projects a try.  I had tried them once before when in beta and remembered there was something that was a show stopper at the time.  I don't remember exactly what, maybe the designer didn't work?  Anyway, that could solve a few of my issues, but this whole thing of not being able to open a project without a solution getting opened, and the thing where VS removes references from projects (even if they are under source control) if you remove the project from a solution is crazy.

Update3: Well thank God, someone from Microsoft let me know that this thing with removing a project causing references to disappear is actually a bug: http://www.chrismay.org/2006/04/19/VS2005RemoveProjectLoseReference.aspx 

Categories: Programming | .Net | VS.Net | Projects | Rants
Thursday, April 13, 2006 4:44:19 PM (Central Daylight Time, UTC-05:00) #    Comments [2]  | 

 

Running ASP.NET Development Server Without Virtual Path, From Root#

I had been looking for a way to get the asp.net development server to run w/o a virtual directory settings.  It's really very stupid and short sighted to not enable this.  Just about every project I have ever worked on has some paths coded into the HTML that are based on / being the root, not the application root.  Stupid.

 

Anyway, ScottGu posted these steps on his site, and it works.  Not bad!

Step 1: Select the “Tools->External Tools” menu option in VS or Visual Web Developer.  This will allow you to configure and add new menu items to your Tools menu.

 

Step 2: Click the “Add” button to add a new external tool menu item.  Name it “WebServer on Port 8080” (or anything else you want).

 

Step 3: For the “Command” textbox setting enter this value: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE (note: this points to the web-server that VS usually automatically runs).

 

Step 4: For the “Arguments” textbox setting enter this value: /port:8080 /path:$(ProjectDir)

 

Step 5: Select the “Use Output Window” checkbox (this will prevent the command-shell window from popping up.

 

 Once you hit apply and ok you will now have a new menu item in your “Tools” menu called “WebServer on Port 8080”.  You can now select any web project in your solution and then choose this menu option to launch a web-server that has a root site on port 8080 (or whatever other port you want) for the project.

 

You can then connect to this site in a browser by simply saying http://localhost:8080/.  All root based references will work fine.

 

Step 6: The last step is to configure your web project to automatically reference this web-server when you run or debug a site instead of launching the built-in web-server itself.  To-do this, select your web-project in the solution explorer, right click and select “property pages”.  Select the “start options” setting on the left, and under server change the radio button value from the default (which is use built-in webserver) to instead be “Use custom server”.  Then set the Base URL value to be: http://localhost:8080/

Categories: Code Links | ASP.Net | VS.Net
Wednesday, April 12, 2006 1:42:57 PM (Central Daylight Time, UTC-05:00) #    Comments [3]  | 

 

More VS.NET Frustrations#
I swear that for the amount of time I save by using VS.NET and ASP.NET over Visual Interdev 6 and ASP (or Java), I lose more than that amount of time in dealing with the terrible design, performance, and bugs of VS.NET.

I installed a test certificate on my laptop so that I could work code that forced pages to use HTTPS. If the page was not running over SSL it would redirect to https://www.therealsite.com/. This worked fine for weeks. The only problem was that when I would preview or debug it would, by default, launch the browser to http://localhos/etc.. which would then be redirected to https://www.therealsite.com/. I would then have to manually change it to httpS://localhost/whatever.aspx to keep it from redirecting.

Aside from that everything was grand.

So then last night I decided to improve upon it. Where it checks if you are running over SSL, it also checks if the server is "localhost". If it is, then instead of redirecting to to https://www.therealsite.com it would redirect to https://localhost.

Everything was great.

Then I went to reopen my project this morning.....

"The host name in the certificate is invalid or does not match"

followed up by:

"Unspecified Error"



Are you kidding me?

Project wouldn't load or reload.



Of course to get to this error takes a minute or two each time because VS.NET is so amazingly slow, even on my 2.4GHz machine. I love it when VS.NET turns 100% white as it sits there doing nothing.

To make things worse, VS.NET FORCES you to contact the webserver to open the project. So I couldn't make any changes, like trying to change my code back to what it was. BTW, why the hell should my CODE effect my ability to OPEN THE PROJECT!? So frustrating!



So then I decided to remove the SSL certificate from the computer, and remove HTTPS from that website. I tried to open the project again.

After another few minutes of waiting....

"A connection with the server could not be established"



Awsome.

After screwing with it for an hour, including 2 reboots, I ended up solving it by removing the SSL certificate, removing HTTPS from the site, and deleting the DLLs in the BIN folder of the website.



VS.NET and I have a very strong love/hate relationship. I really really like so much about it, but .... argh frustrating! I had to make a minor update to an old VB program the other day... I was SHOCKED at how fast the VS6 IDE was, now that I am used to VS.NET, even though the computer with VS6 had a 1.1 GHZ, and my computer with VS.NET has a 2.4 GHz cpu.
Categories: Programming | .Net | VS.Net | Rants
Friday, October 10, 2003 11:47:56 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Add SQL Server 2000 Stored Procedures to Visual SourceSafe by Using Visual Studio .NET#
Categories: Programming | .Net | VS.Net | Database | T-Sql
Thursday, September 18, 2003 11:38:01 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.NET Macro to Add Property Methods for Instance Variables#
Check out the colored HTML pages here.
Categories: Programming | .Net | VB.Net | VS.Net | Tools
Thursday, September 11, 2003 10:51:24 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.NET "Add Region" Macro#
This is a macro to insert a region into your code.

In the event that this page goes away, you can find the macro right here , all you have to do is look at the HTML source, its commented.
Categories: Programming | .Net | VS.Net | Tools
Thursday, July 03, 2003 2:39:37 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.NET 2003 PowerToys Development#
Some people have released some VS.NET 2003 addins, dubbed PowerToys. There are some that are very useful, and I am going to participate in the development with the team. You can join in the open sourced effort at the following locations:

VSCMDShell Window

Custom Help Builder

VSWindowManager

VBCommenter

VSEdit

VSTweak

Categories: Code Links | Programming | .Net | VS.Net | Tools
Friday, June 06, 2003 10:44:58 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.NET "Return To Last Position" Shortcut#
I used to use the "return to last position" in VB6 a lot, but I couldn't find it in VS.NET. I found that you can use the shortcut Cntl + "-" for this. Works just great.
 
Update: You can also setup the toolbar to show you arrows you can use for this!
Categories: Programming | .Net | VS.Net
Wednesday, May 28, 2003 9:46:24 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

LDAP Success#
Finally! I can't express how happy I was when I got this code to finally work correctly.

I was a combination of things that fixed my problem.
  1. I changed my login to use the full domain login Domain\UserName
  2. I changed the security context of the IIS account (IWAM_something I think) This might not have had any impact. After changing this, I was still required to supply my username and password when accessing the directory. After I stopped working I thought that maybe the ASP.NET worker thread was what I needed to change, not the IIS default user account.
  3. When you create a new user through LDAP, they appear as "CN=MyNewUser", however, "MyNewUser" is not their username as one might expect. Instead it is their "SAMAccountName", or something like that, which is a property that you have to set, but that I didn't really pay much attention to.
  4. The domain controller that I was looking at was never the one that was first updated, so there was often a large disconnect between what I was doing in code, and what I was seeing on the domain controller.
There really isn't enough documentation out there about the System.DirectoryServices.DirectoryEntry class, but I managed, after a long struggle.

Here are some other links that I found useful when researching this problem:

Managing Passwords
Active Directory Hierarchy
Creating a User
.NET
newsgroup posting
MS Support Document
Creating ADSI Components
Categories: Programming | .Net | VS.Net
Tuesday, May 27, 2003 10:56:02 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

All content © 2010, Christopher May, Inc
Open Job Positions
On this page
Google Ads
This site
Calendar
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.3.9074.18820

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: