code

Microsoft.VisualBasic 네임 스페이스는 "진정한 .NET"코드입니까?

codestyles 2020. 12. 24. 23:44
반응형

Microsoft.VisualBasic 네임 스페이스는 "진정한 .NET"코드입니까?


제 개발팀은 새로운 프로젝트를 시작할 준비를하고 있습니다. 이 가게는 VB3 시절부터 "VB 가게"였지만 지금은 우리가 ".NET 가게"라는 의견이 널리 퍼져 있으며 C #은 .NET을 위해 특별히 만들어 졌기 때문에 VB.NET은 개조 된 것입니다. C # 만 작성하기로 결정했습니다. 논쟁은 Microsoft.VisualBasic 네임 스페이스가 새로운 개발에서 합법적 인 위치에 있는지 여부 또는 VB6 (및 이전) 코드에 대한 이전 버전과의 호환성을위한 것인지 여부에 대한 질문을 중심으로 진행됩니다. 더 흥미로운 질문은 Microsoft.VisualBasic 네임 스페이스 "아래"코드가 실제로 .NET 래퍼에 신중하게 패키징 된 이전 VB 런타임인지 여부에 대한 .NET 코드인지 여부입니다. WinForms가 .NET이 아닌 Win32 윈도우 API를 래핑하는 방법과 유사하지만.

이를 더욱 혼란스럽게 만들기 위해 개발 팀은 Microsoft Consulting Services 컨설턴트가 Microsoft.VisualBasic 네임 스페이스의 기반이되는 VB 런타임을 포함하여 더 이상 Visual Basic을 지원하지 않는다고 말합니다 .

제가 찾고있는 것은이 질문에 대해 어떤 식 으로든 확실하게 답하는 문서에 대한 링크 (가급적이면 명백한 Microsoft 소스)입니다. 나는 이미 Google에서 여러 검색 순열을 시도했지만이 질문의 하단에 더 가까이 가지 않았습니다.

편집 : 분명히 내 질문을 명확하게하지 않았습니다. VB.NET 이 진정한 .NET 코드 인지 묻지 않습니다 . Microsoft.VisualBasic 네임 스페이스 "아래"에있는 것이 .NET 코드인지 아니면 .NET 코드로 신중하게 패키징되고 노출 된 이전 VB6 런타임인지 확인하려고합니다. 누군가 이미 네임 스페이스의 9/10이 .NET의 다른 곳에서 코드를 래핑한다고 말했습니다. 다른 1/10은 어떻습니까?


Microsoft.VisualBasic.dll <> Microsoft.VisualBasic.Compatibility.dll !!!

(또는 원하는 경우 Microsoft.VisualBasic.dll! = Microsoft.VisualBasic.Compatibility.dll; )

Microsoft.VisualBasic.Compatibility의 네임 스페이스는 VB6 업그레이드 마법사를 사용하기 위해, 향후 버전에서 제거 될 수 독점적이며, 지금까지 새로운 개발에 사용되어서는 안된다.

Microsoft.VisualBasic의 네임 스페이스는 절대적으로 100 % 사실 닷넷, 완벽하게 지원하며, 한 닷넷이 주위로 주위에있을 것입니다.

몇 가지 관련 링크 :

편집 : 이 MSDN 기사 에서 공식 단어 추가 :

Visual Basic 런타임은 전역 Visual Basic 함수 및 Len, IsDate 및 CStr과 같은 언어 기능에 대한 기본 구현을 제공합니다. 새로운 Visual Basic 런타임은 이전 버전과 유사한 기능을 제공하지만 공용 언어 런타임에서 실행되는 완전히 관리되는 코드 (Visual Basic .NET에서 개발 됨)입니다 . 또한 Visual Basic Runtime은 .NET Framework의 일부이므로 응용 프로그램에서 수행하거나 배포해야하는 별도의 요소가 아닙니다.

Visual Basic 6.0 호환성 라이브러리는 Visual Basic Runtime과 다릅니다. Microsoft.VisualBasic.Compatibility 네임 스페이스는 Visual Basic 6.0 코드를 Visual Basic .NET으로 업그레이드하는 도구에서 사용됩니다. Visual Basic의 .NET 구현에서 직접 지원하지 않는 Visual Basic 6 기능을 지원하는 다리입니다. Visual Basic Runtime과 달리 호환성 라이브러리는 모든 Visual Basic .NET 응용 프로그램에서 암시 적으로 참조되지 않습니다 . Visual Basic 6 프로젝트를 Visual Basic .NET으로 업그레이드하면 업그레이드 마법사가 Microsoft.VisualBasic.Compatibility에 대한 참조를 추가합니다.

호환성 클래스는 새로운 개발에 사용해서는 안됩니다 . Microsoft.VisualBasic.Compatibility 네임 스페이스는 Visual Basic .NET 응용 프로그램에 복잡성 계층을 추가하고 응용 프로그램의 일부를 다시 코딩하여 제거 할 수있는 최소한의 성능 비용을 도입합니다. 또한 Compatibility 네임 스페이스에는 COM 개체를 래핑하는 많은 클래스가 포함되는 경우가 많으며 앞에서 언급했듯이 COM 개체에 따라 순수한 관리 구현만큼 최적이 아닙니다.


.NET Reflector를 사용하고 들여다보십시오. 나는 이것을 자주한다. Microsoft.VisualBasic 네임 스페이스의 호출 10 개 중 9 개는 .NET 메서드를 둘러싼 래퍼 일뿐입니다.

컨설턴트는 컨설턴트가 가장 잘하는 일을하고 있습니다. 즉, 예산을 늘리기 위해 자신이 존재한다는 것을 과시합니다. MS는 더 이상 VB6을 지원하지 않지만 VS 2008에 VB .NET이 있다는 사실은 VB .NET을 최소한 몇 년 더 지원할 것임을 나타내야합니다.

개인적으로 저는 Microsoft.VisualBasic을 다른 .NET 클래스에 대한 파사드처럼 취급합니다. 개인 프로젝트 일 때 사용하고 BCL 수업을 사용하는 것보다 더 빠르고 쉽게 작업을 완료 할 수 있습니다. 좋은 예는 String.Substring과 비교되는 Microsoft.VisualBasic.Strings.Right입니다. 그러나 VB 네임 스페이스의 많은 함수 (예 : Val)의 경우 프레임 워크의 언어 별 섹션이 덜한 섹션에 더 강력하고 강력한 버전이 있습니다. 업무용 코드를 작성하는 경우 VB 라이브러리를 사용하지 않습니다. 이렇게하면 VB에 익숙하지 않은 C # 개발자가 내 코드를 이해하는 데 어려움을 겪지 않게됩니다.


FCL의 일부 기능과 마찬가지로 일부 Microsoft.VisualBasic 네임 스페이스 코드는 관리 코드로 작성되고 일부는 비 관리 코드에 대한 호출을 래핑합니다.

확실히 vb6 런타임에 대한 종속성은 없으며 보닛 아래에 vb6 런타임을 조용히 설치하지 않습니다.

.NET Reflector를로드하고 Microsoft.VisualBasic 네임 스페이스의 코드를 살펴 봐야합니다.

C #에서이 네임 스페이스의 기능을 계속 사용하려는 경우 계속 사용하면 사라지지 않습니다. 일부 코드는 더 이상 사용되지 않거나 더 이상 사용되지 않는 것으로 표시 될 수 있지만 15 년 후에는 문제없이 Microsoft.VisualBasic 기능을 사용하여 동일한 앱을 계속 실행할 수있을 것으로 예상됩니다.

업데이트 됨 : .NET 리플렉터를 사용할뿐만 아니라 이제 소스 Microsoft.VisualBasic 네임 스페이스 /Microsoft.VisualBasic.DLL 코드를보고 / 디버그 할 수 있습니다.

http://blogs.msdn.com/vbteam/archive/2008/01/19/source-code-of-visual-basic-runtime-has-been-released-to-public.aspx

프레임 워크 대량 다운로더를 가져와 여유 시간에 코드를 정독하십시오.

http://www.codeplex.com/NetMassDownloader


나는 그들이 모두 동일한 바이트 코드로 컴파일한다고 믿습니다.

내 참조 : http://www.codinghorror.com/blog/archives/000128.html


"Microsoft는 더 이상 Visual Basic을 지원하지 않습니다"라는 문구는 여러 가지 버전의 Visual Basic (VB 1에서 6, VBA 및 VB.NET까지)이 있기 때문에 여러 가지 의미를 가질 수 있습니다.

"Microsoft는 더 이상 Visual Basic.NET을 지원하지 않는다"라는 말이 사실이라면 큰 뉴스가 될 수 있지만 . (Google에서 확인했습니다). VB6에 대한 지원은 종료되었지만 VB.Net은 여전히 ​​매우 살아 있고 새로운 기능을 얻고 있습니다.

VB.Net은 사용하는 .net 프레임 워크 클래스에 따라 일부 .Net 라이브러리에 의존하는 MSIL 바이트 코드로 컴파일됩니다. 이러한 라이브러리 중 일부는 순수한 .Net으로 작성되지 않았거나 Windows API를 둘러싼 래퍼 일뿐입니다. .net에 내장되지 않은 기능 (예 : 스레딩)은 제어 된 방식으로 노출되어야하기 때문에 필요합니다.

C #도 똑같습니다. 런타임은 실행되는 MSIL을 생성 한 언어는 실제로 신경 쓰지 않습니다.


Microsoft의 목표는 VB .NET과 C #을 구문이 다른 동일한 언어로 만드는 것입니다. 사실입니다. 그러나 변경 사항은 항상 VB9의 새로운 XML 리터럴 처리와 비슷합니다. 그가 묻는 것은 모든 OLD VB6 및 이전 기능을 .NET 관리 코드로 다시 구현했는지 여부입니다. 제 추측은 아니오입니다.


As OwenP said, most of the calls in the Microsoft.VisualBasic namespace are just wrappers around existing .NET functionality. So why create wrappers?

When VB.NET was created, Microsoft wanted developers to be able to import existing VB6 projects into .NET. That was only feasible if the VB6 functions and method calls had matching functionality in VB.NET. So they created the Microsoft.VisualBasic namespace to map that VB6 functionality to .NET functionality. (Pure speculation, but it makes sense)

As .NET has progressed into new versions, they couldn't remove the Microsoft.VisualBasic namespace - lots of code is probably still using it. So it's still there.

Besides, you can write VB.Net code without even using the Microsoft.VisualBasic namespace. (And as Kev implied, you can use the Microsoft.VisualBasic namespace from C#.) VB.Net is just a language, the .NET framework remains the same.


There is a bunch of .NET code that Microsoft actually just wraps COM functionality. I'm not a licensing guru, but you could always grab Reflector and take a look at that namespace and see for yourself.


I think a good place to start would be the MSDN documentation provided by Microsoft about VB.net

http://msdn.microsoft.com/en-us/library/2x7h1hfk.aspx That link would be the latest visual studio 2008 write up about the language.

VB compiles the same as C# under the CLR so I do not get where your consultant is coming from here.


I've not done much with VB.NET (more with C#), but as far as I was aware, they both compile to the same bytecode, and are hence interpreted identically by the .NET runtime, and that they are functionally equivalent, just syntactically different.

VB.NET seemed a lot different from VB6 when I last used it, though.


VB.NET code is not directly compiled to binary. It's compiled to IL (Intermediate Language) just like C#.

What does that mean is that whatever you are building in VB.NET, it will be reusable in C# projects without any problems.

I wasn't able to find any links directly related to what you ask. The main reason is that VB.NET is part of a new actively developed framework. There is no plan to make that language obsolete. Whatever the other consultant is saying.


As far as I know, VB.NET is 'true .net' code, as you put it. There are a lot of different languages (C#, VB.NET, F#, Cobol.NET, etc) that all 'compile' into IL code. That IL code is what is actually run by the .NET VM and interpreted to machine code. The objects that you interact with between the languages are still the same underlying .NET objetcs.

For example, in C#:

DataTable dt = new DataTable();

Compiles to the exact same IL code as the equivalent in VB.NET:

Dim dt as DataTable = new DataTable()

In fact, in decompiler tools like .NET Reflector, that look directly at the IL code, you can have it display the output in C# or VB.NET, whichever you are more comfortable with.

This also means that I can write one class library in VB.NET "myVbCode.dll" and it is directly compatible with one written in C# "myCSharpCode.dll". In fact both of the DLLs will only contain the compiled IL code.

There may be some outlying exceptions to all this, but fundamentally that is how it works.


A direct answer to your question would be that VB.NET is just as much "true .NET code" as C# is.

Sure, there are syntax features in both languages that aren't directly available in the other (for instance, VB.NET has some XML features built into the syntax that C# doesn't), but there is nothing you can do in VB.NET you can't do in C#, or vice versa, at least to my knowledge.

I'd say that if you have experience in VB, then the transition to VB.NET will of course be easier than the one to C#.

ReferenceURL : https://stackoverflow.com/questions/226517/is-the-microsoft-visualbasic-namespace-true-net-code

반응형