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

The `add reference` command still requires the manual adding of a HintPath tag for the build to be successful #33

Closed
filipelbc opened this Issue Jan 2, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@filipelbc
Copy link

filipelbc commented Jan 2, 2017

Expected Behavior

What I expect after I use a command like:

forge add reference -n Some.Reference -p src/SampleProj/SampleProj.fsproj

is that the build will be successful, because I added the missing references.

Current Behavior

The build still fails because the added references could not be resolved.

Possible Solution

I'm not sure what to propose as solution. Nevertheless, the following did achieve the desired output:

  • Manually adding a HintPath tag for the new reference in the fsproj file solves the problem.

  • Also, for instance, if, instead of using the add reference command as above, I do

echo "Some.Reference" >> src/SampleProj/paket.references
mono .paket/paket.exe add -i nuget Some.Reference

then, the reference is added with a HintPath and the build is sucessful.

Context

I was trying to setup a Websharper project.

$ forge new project --name MyProject --folder . --template websharperserverclient

$ forge add file -p MyProject/MyProject.fsproj -n MyProject/RunServer.fs

$ cat <<EOF > MyProject/RunServer.fs
namespace MyProject

module SelfHostedServer =

    open global.Owin
    open Microsoft.Owin.Hosting
    open Microsoft.Owin.StaticFiles
    open Microsoft.Owin.FileSystems
    open WebSharper.Owin

    [<EntryPoint>]
    let Main args =
        let rootDirectory, url =
            match args with
            | [| rootDirectory; url |] -> rootDirectory, url
            | [| url |] -> "..", url
            | [| |] -> "..", "http://localhost:9000/"
            | _ -> eprintfn "Usage: WsSimple ROOT_DIRECTORY URL"; exit 1
        use server = WebApp.Start(url, fun appB ->
            appB.UseStaticFiles(
                    StaticFileOptions(
                        FileSystem = PhysicalFileSystem(rootDirectory)))
                .UseSitelet(rootDirectory, Site.Main)
            |> ignore)
        stdout.WriteLine("Serving {0}", url)
        stdin.ReadLine() |> ignore
        0
EOF

And then add reference for the 3 missing dependencies.

Your Environment

  • Version used:
    • Built from source, version 1.3.2
  • Environment name and version (F#, .Net):
    • F# 4.0 (Open Source Edition)
    • Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)
  • Operating System and version:
    • Xubuntu 16.04.1

@filipelbc filipelbc changed the title Make `add reference` also add a HintPath The `add reference` command still requires the manual adding of a HintPath tag for the build to be successful Jan 2, 2017

@Krzysztof-Cieslak

This comment has been minimized.

Copy link
Contributor

Krzysztof-Cieslak commented Jan 2, 2017

I guess that's more problem of documentation / help.

add reference is designed to be used with assemblies installed globally (for example in GAC), for example System.Drawing.

It's not designed to replace Paket. Instead you can use Paket integration and do forge paket add -i nuget Some.Reference which will do what you want (if Some.Reference is NuGet dependency)

@filipelbc

This comment has been minimized.

Copy link

filipelbc commented Jan 3, 2017

I see.

Couldn't add reference be more intelligent and and decide what to do? Maybe ask the user.

@Krzysztof-Cieslak

This comment has been minimized.

Copy link
Contributor

Krzysztof-Cieslak commented Jan 5, 2017

I don't think I want to introduce such magic. Most well designed command line tools have commands responsible for one things, and introducing such complex and not really predictable (depends on globally installed libraries which can be different from user to user) is not something I want here.

Closing as by design

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment