Skip to content
This repository has been archived by the owner on Sep 26, 2020. It is now read-only.

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
Labels

Comments

@filipelbc
Copy link

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
Copy link
Member

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
Copy link
Author

I see.

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

@Krzysztof-Cieslak
Copy link
Member

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants