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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 8402 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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