Ambiguous Namespace Error in MSBee

Topics: For MSBee Users
Aug 16, 2006 at 7:23 AM
migrated from power toy forums
originally posted by jflowers

I get the following error when trying to use the class Regex and MSBee.

Error 8 'Regex' is ambiguous in the namespace 'System.Text.RegularExpressions'. C:\...\MySource.vb 72 35 MyProject

Got any ideas as to why? It seems to be picking up a ref to both 1.1 and 2.0 for this namespace.
Aug 16, 2006 at 7:24 AM
originally posted by jflowers

So I guess it my be help to note that I have altered the MSBee scripts a little.

I add the following to the common targets:

<AvailablePlatforms>$(AvailablePlatforms),.NET 1.1</AvailablePlatforms>
<AssemblySearchPaths Condition=" '$(Platform)' == '.NET 1.1' ">
<TargetFrameworkDirectory Condition=" '$(Platform)' == '.NET 1.1'">

<ItemGroup Condition=" '$(Platform)' == '.NET 1.1'">
<TargetFrameworkDirectoryItem Include="$(SystemRoot)\Microsoft.NET\Framework\v1.1.4322">

and condition on the CSharp and VB target looking for the Platform .NET 1.1.

So I think this has to do with VB's background compiler. Both a C# and a VB project will compile just fine. A VB project will report the afor mentioned error in the Error List tab. When I look in the Object Browser some namespaces show double the classes, one with and the other with 1.0.5000.0. VB's intellisense for an effected namespace does not work, C#'s works fine. Anyone have any dieas as to how I might could control the background compiler?
Aug 16, 2006 at 7:24 AM
originally posted by Craig Lichtenstein - MSFT

So, you should note that MSBee does not have IDE integration support and we currently have no plans to add IDE integration in the future. Consequently, I've never tried integrating MSBee with the Whidbey IDE.

One thing I noticed in your example is that you changed the AssemblySearchPaths entries. Specifically, you re-added {AssemblyFolders}, which was intentionally removed to avoid referencing Whidbey specific assemblies. I'd recommend keeping the AssemblySearchPath entries as listed in the Microsoft.Public.Common.targets file that comes with MSBee. Unfortunately, I know this is not causing your problem since I was able to reproduce the error you're getting using an unmodified version of that targets file.

I created a simple VB project that used RegularExpressions and along with the error you described, I got 2 warnings. One was for System.Xml.dll and the other was for System.Data.dll. Both warnings read like:

Assembly 'C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Xml.dll' references assembly 'System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', which is ambiguous between 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll' (referenced by project 'SampleVBConsoleApplication2') and 'C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll' (referenced by project 'SampleVBConsoleApplication2'). 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll' will be used. If both assemblies are identical, change the references to the same location. C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Xml.dll

Now, to answer your particular question, there isn't a way to disable the background compiler in VB. It's required for lots of stuff including Intellisense and formatting information. If you want to read more about the background compiler, it's discussed in some detail at: