1

I am trying to compile VB code using Roslyn. Some of the files use My reference like:

My.Computer.FileSystem.FileExists(ExtraPath)

While compiling code I am getting the error:

error BC30456: 'Computer' is not a member of 'My'.

I am not exactly sure what I am missing. I did create a MetaDataReference to Microsoft.VisualBasic.dll.

Anoop
  • 101
  • 1
  • 10
  • 3
    The `My` namespace only exists in your project. It's not part of the .NET Framework. The `My.Computer` you're trying to use is actually the `Computer` property of the `MyApplication` module. When you create a VB project, quite a lot of code is generated for you in the background. In your case, that code doesn't exist, so you can't use it. There is no `MyApplication` module with a `Computer` property. I would suggest that you use `System.IO.File.Exists`, which is standard .NET and not VB-specific. – jmcilhinney Jan 23 '18 at 08:51
  • But I am not seeing that issue when I compile with CodeDom – Anoop Jan 23 '18 at 08:53
  • @jmcilhinney can you please post the comment as answer..I will upvote and accept it. Thanks! – Anoop Jan 23 '18 at 09:03

0 Answers0