Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PathMap not supported by F#? #11100

Closed
njlr opened this issue Feb 12, 2021 · 7 comments
Closed

PathMap not supported by F#? #11100

njlr opened this issue Feb 12, 2021 · 7 comments

Comments

@njlr
Copy link
Contributor

njlr commented Feb 12, 2021

Repro steps

I want to have deterministic builds, regardless of the folder that the project is checked-out into.

Following information found here, I added a PathMap property to my fsproj:

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <Deterministic>true</Deterministic>
    <DeterministicSourcePaths>true</DeterministicSourcePaths>
    <PathMap>$(EnlistmentRoot)=/home/runner/</PathMap>
  </PropertyGroup>

Expected behavior

Deterministic builds

Actual behavior

$ dotnet build
usr/share/dotnet/sdk/5.0.103/FSharp/Microsoft.FSharp.Targets(281,9): error MSB6006: "dotnet" exited with code 134.

Known workarounds

Unknown

Related information

$ dotnet --version 
5.0.103

$ lsb_release -a 
LSB Version:	core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
@njlr njlr closed this as completed Feb 12, 2021
@njlr
Copy link
Contributor Author

njlr commented Feb 12, 2021

This is a C# compiler flag. Adding support for this is ongoing, see dotnet/sourcelink#601

@baronfel
Copy link
Member

I implemented support for this in the compiler in #9874, so we should be good to go.

@njlr
Copy link
Contributor Author

njlr commented Feb 12, 2021

@baronfel Thanks for responding! I am finding documentation a little sparse. Suppose I have many .fsproj files that are part of a single .sln. What is the best way to enable deterministic paths for all projects?

@baronfel
Copy link
Member

What about setting the Deterministic property to true in a Directory.Build.props file?

@njlr
Copy link
Contributor Author

njlr commented Feb 12, 2021

I have already set these properties in my .fsproj files:

    <Deterministic>true</Deterministic>
    <DeterministicSourcePaths>true</DeterministicSourcePaths>

However, if I cat the output .dll I can see the absolute paths to the source files in there.

@NinoFloris
Copy link
Contributor

NinoFloris commented Feb 12, 2021

It needs a <SourceRoot Include="path"> to actually strip away everything until the root of the project, Source Link simplifies this by figuring out the SourceRoot based on your vcs info. https://github.com/dotnet/sourcelink

@njlr
Copy link
Contributor Author

njlr commented Feb 12, 2021

It needs a <SourceRoot Include="path"> to actually strip away everything until the root of the project, Source Link simplifies this by figuring out the SourceRoot based on your vcs info. https://github.com/dotnet/sourcelink

Sorry, I am not familiar with all of this stuff. What would path be in this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants