Bug 8402 - Mono MCS does not have equivalent of MS CSC /link
Summary: Mono MCS does not have equivalent of MS CSC /link
Status: NEW
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2012-11-14 13:55 UTC by Brett van Swelm
Modified: 2012-11-19 09:40 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Brett van Swelm 2012-11-14 13:55:03 UTC
Mono MCS does not have equivalent of MS CSC /link.

===== Link.cs =====
using System;

public class Link {
    public static void Test(Microsoft.Office.Interop.Excel.Application xl) {
        xl.Columns[2].AutoFit();
    }
    public static void Main(String[] args) {}
}
===== end =====

This issue is related to the conversation at http://mono.1490590.n4.nabble.com/Equivalent-of-csc-link-for-mcs-COM-interop-td4657353.html. MS CSC can compile the sample below using the /link option. No such option exists in mono MCS, and /reference is insufficient to avoid typing issues:

$ csc /link:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office12\Microsoft.Office.Interop.Excel.dll" Link.cs
Microsoft (R) Visual C# Compiler version 4.0.30319.17929
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.

$ mcs /reference:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office12\Microsoft.Office.Interop.Excel.dll" Link.cs
Link.cs(5,23): error CS1061: Type `object' does not contain a definition for `AutoFit' and no extension method `AutoFit' of type `object' could be found. Are you missing an assembly reference?
D:\Applications\Mono-2.11.4\lib\mono\4.5\mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

Thanks,

Brett van Swelm | Senior Engineer
Coverity | 185 Berry Street | Suite 6500, Lobby 3 | San Francisco, CA 94107
The Leader in Development Testing
Read our profile in Forbes, Coverity Gets Code Right 25% Faster
Comment 1 Marek Safar 2012-11-19 09:40:26 UTC
mcs does not have NoPIA support and there is no short term plan to implement it. You can generally use -r instead but NoPIA seems to do some auto object to dynamic conversion (is this documented somewhere?).

changing the code to ((dynamic)xl.Columns[2]).AutoFit(); and using -r: produces similar output

Note You need to log in before you can comment on or make changes to this bug.