What's the location of a C# compiler on SharePoint Server?
I'm on a SharePoint server and I need to compile a small change to my C# code. Where can I find the C# compiler on the SharePoint Serve开发者_开发问答r? I know .NET is installed by virtue of the fact that it is a SP server, but I'm unable to find .NET or the C# compiler I'm looking for. It isn't in any locations such as C:/Program Files or Windows/system like the following article suggests.
http://msdn.microsoft.com/en-us/library/78f4aasd.aspx
I'm sure I'm overlooking something obvious but thanks for helping.
The .NET 2.0 C# compiler csc.exe (which will work for .NET 2.0 to 3.5) is located at C:\Windows\Microsoft.NET\Framework\v2.0.50727
. If your version of SharePoint runs on .NET 4.0 then it'll be in C:\Windows\Microsoft.NET\Framework\v4.0.30319
It should be in %WINDOWS%\Microsoft.NET\Framework\%VERSION_NUMBER%
.
For example, on my box I have:
c:\Windows\Microsoft.NET\Framework\v1.0.3705
c:\Windows\Microsoft.NET\Framework\v1.1.4322
c:\Windows\Microsoft.NET\Framework\v2.0.50727
c:\Windows\Microsoft.NET\Framework\v3.0
c:\Windows\Microsoft.NET\Framework\v3.5
c:\Windows\Microsoft.NET\Framework\v4.0.30319
Of these, only the 2.0.xxx, 3.5 and 4.0.xxx directories have C# compilers (csc.exe) within them.
Rather than invoking the executable directly, could you use CSharpCodeProvider
to compile the code? That way you can do it all programmatically without having to work out the location of the executable.
精彩评论