Skip to content

question on building dotnetcore application but namespace error #4293

@skao21

Description

@skao21

Hi

I follow the https://github.com/dotnet/coreclr/blob/master/Documentation/linux-instructions.md to build my first C# Helloworld application. I am able to run the application in my ubuntu box.

Then I was trying to run a more complicate code to see if I can build tcp socket appliaction.

First, I create a simple c# file with only namespace included in the source code. I am able to build it on linux monodevelop ide.
But when I tried to follow the holloworld instruction to build the same c# file, it can not be built, I believe monodevelop also use mcs to build the project. So, i do not understand why the dotnetcore does not resolve the namespace as mondevelop does.

I came from linux background without much knowledge on .NET.

Thanks
kevin

Here is my c# file: test.cs

test.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace ClientServer
{

public class ClientServer
{
    public static void Main()
    {
    }
}

}

And here is the build error when compile from linux

https://github.com/dotnet/coreclr/blob/master/Documentation/linux-instructions.md

ubuntu-1:~/coreclr-demo/runtime$ mcs -nostdlib -noconfig /r:../packages/System.Console.4.0.0-beta-22703/lib/contract/System.Console.dll /r:../packages/System.Runtime.4.0.20-beta-22703/lib/contract/System.Runtime.dll ClientServer.cs
ClientServer.cs(4,14): error CS0234: The type or namespace name Linq' does not exist in the namespaceSystem'. Are you missing System.Core' assembly reference? ClientServer.cs(6,14): error CS0234: The type or namespace nameNet' does not exist in the namespace System'. Are you missing an assembly reference? ClientServer.cs(7,14): error CS0234: The type or namespace nameNet' does not exist in the namespace `System'. Are you missing an assembly reference?
Compilation failed: 3 error(s), 0 warnings

NOYE: I also follow the same steps on WINDOW version and get the "same" namespace errors on the test.cs using "csc".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions