none
Is it OK to remove the csc.exe (compiler) from a .NET runtime install? RRS feed

  • Question

  • We need to remove the csc.exe from the .NET runtime.  Is it OK to remove it?
    • Moved by Andrew.Wu Friday, April 22, 2011 8:09 AM (From:.NET Framework Setup)
    Wednesday, April 20, 2011 2:26 PM

All replies

  • Hi stone.d,

    I'm going to move your post to the Common Language Runtime Forum for better response.

    Thanks for your understanding.

    Best Regards,


    Andrew Wu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 22, 2011 8:09 AM
  •  

    Hi stone.d,

     

    I think you have a little misunderstand of .NET runtime.

    Csc.exe is a compiler to compile C# code.

    .NET Runtime(CLR) is a runtime to guide assembly running.

    They are actually not interrelated. We can compile C# code with many different compilers(csc.exe is one kind of them).

     

    I don’t understand what you mean "remove the csc.exe from the .NET runtime". If you mean compile C# code via other compilers, my answer is YES.

     

    Have a nice day!


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 22, 2011 8:22 AM
  •  

    Hi stone.d,

     

    I think you have a little misunderstand of .NET runtime.

    Csc.exe is a compiler to compile C# code.

    .NET Runtime(CLR) is a runtime to guide assembly running.

    They are actually not interrelated. We can compile C# code with many different compilers(csc.exe is one kind of them).

     

    I don’t understand what you mean "remove the csc.exe from the .NET runtime". If you mean compile C# code via other compilers, my answer is YES.

    But can you safely remove the command line compiler from the .NET Framework.

    EG:

    you want people to be able to run code you provide

    you don't want people to be able to write and compile there own code using csc.exe

    Friday, April 22, 2011 1:38 PM
  • I don't think that it is wise to remove CSC.exe. Because parts of .net framework need the compiler to work.

    One example is the XMLSerializer. It generates and compiles a assembly to serialize and deserialize the data. This will of course fail when the compiler is removed.

    I'm not sure of a second one, but I think the regular expressions that are compiled will probably also use the compiler.

    Friday, April 22, 2011 6:01 PM
  • Just from curiosity, why do you want to prevent users from being able to compile C# application on that PC?
    Friday, April 22, 2011 8:34 PM
  • CSC.exe is part of .NET Framework, removing the executable may result in unexpected behaviors, so we'd better leave it there.

     

    However, may I know why you want to remove csc.exe?


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 25, 2011 3:22 AM
  • We need to remove the csc.exe if possible as we don't want users to be able to produce their own applications.  Does .NET really require this component in a runtime environment?  Removing parts of an install like this isn't something I'm particularly happy about but I need to investigate the options.  Many thanks for all the responses so far.
    Wednesday, May 4, 2011 10:56 AM
  • I'm afraid we cannot prevent developers from producing their applications against .NET/CLR, even though we removed csc.exe, developer can use write IL code and use ILAsm.exe generate assemblies, and, csc.exe is not the only compiler for .NET/CLR, developer can use other compilers as alternatives; So, if you don't want users to be able to produce their own applications, you may choose to uninstall the whole .NET Framework.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 5, 2011 1:58 AM
  • Thanks for the reply.  The user won't be able to download or install any new compilers on the system due to other security constraints so that isn't an issue.  I assume producing IL code is more complex than C# etc so would require greater knowledge and skill?  I guess that removing the ILAsm.exe isn't an option as it is used by the framework to run the .NET applications!  

     

    Are we saying that removing the csc.exe is an option?

    Regards,

    Thursday, May 5, 2011 9:28 AM
  • Sure, it needs advanced knowledge to write IL code directly:) have to say, removing the csc.exe may result in unexpected behaviors, so you may want to do more tests to make sure your application can run in that environment.

     

    By the way, you may visit https://www.microsoft.com/licensing/contact-us.aspx to confirm that whether this is any lisence violation if we mannually remove component of .NET Framework, good luck:)


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, May 6, 2011 1:43 AM