0

These two lines of code compile fine when I use a .NetFramework type console build:

  • My.Application.CommandLineArgs
  • My.Computer.FileSystem.GetFiles(strFolder)

But trying to compile the same code with the console application using .NET6 / Window it has two build errors:

'Application' is not a member of 'GoogleAuthAndSync2.My'.

Similar for the other line.

I don't understand why this would not work?

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
  • 2
    It looks like these will help: [.NET 6.0 C# "new console template" - how to read CLI arguments?](https://stackoverflow.com/q/70142512/1115360) and [GetFiles](https://learn.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles). It appears that Microsoft were not keen on carrying `My` over the .NET Framework - Core transition. – Andrew Morton Jun 12 '23 at 19:25
  • 1
    @AndrewMorton Both of those links helped. Thank you! – Andrew Truckle Jun 12 '23 at 19:31
  • 1
    Note that .NET Core was built from the ground up and not just by modifying .NET Framework. The VB `My` namespace was one of the later features to be recreated and the result is not completely the same as it is in .NET Framework. It's worth noting that there has always been other ways to do what those two lines of code do and C# developers have been using them the entire time. If something doesn't work in .NET Core (.NET 5 and later are based on .NET Core) then think about the functionality involved and look for the best way to achieve that functionality. – jmcilhinney Jun 13 '23 at 02:30

0 Answers0