fsharp / fsharp/fslang-suggestions

Add support for `extern alias`

Open
#513 8 comments 16 reactions 0 assignees View on GitHub
approved-in-principle area: interop
Dominant language
No language data
Stars
373
Forks
21
PR merge metrics
No merged PRs in 30d

Description

[extern alias C# reference](https://msdn.microsoft.com/en-us/library/ms173212.aspx)
> You might have to reference two versions of assemblies that have the same fully-qualified type names. For example, you might have to use two or more versions of an assembly in the same application. By using an external assembly alias, the namespaces from each assembly can be wrapped inside root-level namespaces named by the alias, which enables them to be used in the same file.

This became an issue for me while working on implementing editor tooling to support the old fsproj format and the new netcore fsproj format. MSBuild15 does not properly parse the old files and MSBuild14 doesn't properly parse the new files. Without support for both the tooling will either lock out legacy projects or it'll be unable to process netcore projects.

## Pros

- An application can or make use of multiple versions of an API or SDK
- A C# shim project solely for the use of `extern alias` will no longer be necessary

## Cons

- An additional keyword is needed

## Extra informtion

Estimated cost **M**

## Affadavit (must be submitted)

Please tick this by placing a cross in the box:
* [x] This is not a question (e.g. like one you might ask on [stackoverflow](http://stackoverflow.com)) and I have searched stackoverflow for discussions of this issue
* [x] I have [searched both open and closed suggestions on this site](http://github.com/fsharp/fslang-suggestions/issues) and believe this is not a duplicate
* [x] This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it.

Please tick all that apply:
* [x] This is not a breaking change to the F# language design
* [x] I would be willing to help implement and/or test this
* [ ] I or my company would be willing to help crowdfund F# Software Foundation members to work on this

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked extern alias reference and the MSBuild14/MSBuild15 compatibility context described in the issue. Determine the required F# language and project behavior, then define tests for using aliases with conflicting assembly types; done means both project formats can be processed without a C# shim.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, fsharp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.