Skip to content

Conversation

@jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Oct 25, 2019

Context: https://build.azdo.io/3182458

Our build is currently failing with:

(CoreCompile target) ->
CSC : error CS1617: Invalid -langversion option `7.3'. It must be `ISO-1', `ISO-2', Default, Latest or value in range 1 to 7.2

I think this is due to:

/p:CscToolExe=`which mcs`

We need to use mcs, because gendarme does not yet support portable
.pdb files. However, it also appears that it does not support C# 7.2.

If we set /p:LangVersion=Default, it may select a usable C# version.
Things might continue to work as long as we don't use a C# 7.3
feature.

Then we got to the next failure:

(CoreCompile target) ->
Microsoft.CSharp.Core.targets(59,5): error : error CS2001: Source file `/analyzerconfig:/Users/runner/runners/2.159.2/work/1/s/.editorconfig' could not be found

The error is a little misleading, basically mcs does not understand
the /analyzerconfig switch. So it is trying to treat it as a source
code file.

I found the source code for this here:

https://github.com/dotnet/roslyn/blob/6fc75491954be7ddff8c489a4ff424b3524ae80f/src/Compilers/Core/MSBuildTask/Microsoft.Managed.Core.targets#L63

So we can add /p:DiscoverEditorConfigFiles=False to ignore
.editorconfig files.

Context: https://build.azdo.io/3182458

Our build is currently failing with:

    (CoreCompile target) ->
    CSC : error CS1617: Invalid -langversion option `7.3'. It must be `ISO-1', `ISO-2', Default, Latest or value in range 1 to 7.2

I think this is due to:

    /p:CscToolExe=`which mcs`

We need to use `mcs`, because `gendarme` does not yet support portable
`.pdb` files. However, it also appears that it does not support C# 7.2.

If we set `/p:LangVersion=Default`, it may select a usable C# version.
Things might continue to work as long as we don't use a C# 7.3
feature.

Then we got to the next failure:

    (CoreCompile target) ->
    Microsoft.CSharp.Core.targets(59,5): error : error CS2001: Source file `/analyzerconfig:/Users/runner/runners/2.159.2/work/1/s/.editorconfig' could not be found

The error is a little misleading, basically `mcs` does not understand
the `/analyzerconfig` switch. So it is trying to treat it as a source
code file.

I found the source code for this here:

https://github.com/dotnet/roslyn/blob/6fc75491954be7ddff8c489a4ff424b3524ae80f/src/Compilers/Core/MSBuildTask/Microsoft.Managed.Core.targets#L63

So we can add `/p:DiscoverEditorConfigFiles=False` to ignore
`.editorconfig` files.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review October 25, 2019 19:49
@jonpryor jonpryor merged commit fae314e into dotnet:master Oct 28, 2019
@jonathanpeppers jonathanpeppers deleted the gendarme-langversion branch October 28, 2019 14:00
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants