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

Paket update problem in sdk style project #3618

Closed
Sylwekqaz opened this issue Jul 22, 2019 · 15 comments
Closed

Paket update problem in sdk style project #3618

Sylwekqaz opened this issue Jul 22, 2019 · 15 comments

Comments

@Sylwekqaz
Copy link

Description

After package update (in paket.dependencies and paket.lock) and restore packages, old packages are copied to bin dir. Probably they are cached in obj\project.assets.json.

Repro steps

  1. Create new sdk style project (e.g. net core project) and add packet

    Example main function

    static void Main(string[] args)
    {
        var version = FileVersionInfo.GetVersionInfo("Newtonsoft.Json.dll");
        Console.WriteLine(version.FileVersion);
        Console.WriteLine(JsonConvert.SerializeObject(new
            {
                version.ProductName,
                version.FileVersion,
                version.ProductVersion,
            },
            Formatting.Indented));
        Console.ReadKey();
    }
  2. Reference package (e.g. Newtonsoft.Json = 12.0.1)

  3. Compile & run program

    paket install
    dotnet restore
    dotnet run
    # Output
    # 12.0.1.22727
    # {
    #   "ProductName": "Json.NET",
    #   "FileVersion": "12.0.1.22727",
    #   "ProductVersion": "12.0.1 509643a8952ce731e0207710c429ad6e67dc43db"
    # }

    To bin folder was copied Newtonsoft.Json.dll in version 12.0.1.22727, with is correct.

  4. Update package in paket.dependencies (e.g. Newtonsoft.Json = 12.0.2)

  5. Compile & run program

    paket install
    dotnet restore
    dotnet run
    # Output
    # 12.0.1.22727
    # {
    #   "ProductName": "Json.NET",
    #   "FileVersion": "12.0.1.22727",
    #   "ProductVersion": "12.0.1 509643a8952ce731e0207710c429ad6e67dc43db"
    # }

    To bin folder was copied Newtonsoft.Json.dll in version 12.0.1.22727, with is not correct.

Expected behavior

Packages should be restored with correct version

dotnet run
# 12.0.2.23222
# {
#   "ProductName": "Json.NET",
#   "FileVersion": "12.0.2.23222",
#   "ProductVersion": "12.0.2 4ab34b0461fb595805d092a46a58f35f66c84d6a"
# }

Actual behavior

Packages are restored with old version version

dotnet run
# Output
# 12.0.1.22727
# {
#   "ProductName": "Json.NET",
#   "FileVersion": "12.0.1.22727",
#   "ProductVersion": "12.0.1 509643a8952ce731e0207710c429ad6e67dc43db"
# }

Packages probably are cached in obj\project.assets.json and restored in old version to bin folder. Rebuild/clean project dosent help.

Known workarounds

Delete obj folders in projects.

@forki
Copy link
Member

forki commented Jul 22, 2019 via email

@matthid
Copy link
Member

matthid commented Jul 22, 2019

maybe, what 'should' happen is that lockfile gets updated which invalidates the various cache files and the msbuild integration should pick it up if required.
In this particular scenario paket install should update all the cache files and dotnet restore should be fast

@danyx23
Copy link

danyx23 commented Sep 4, 2019

I think I ran into this problem as well in a SAFE stack application. After upgrading paket.dependencies to bump a library from version 3.1 to 3.2 and running paket install (or doing the same via paket update) the paket.lock file contains the correct new entry but the /src/Client/obj/Client.fsproj.reference file still lists the old library version so Fable restores this old library version and then I wondered why the behaviour did not change.

Deleting the obj folder forces a refresh of this file and then everything works as expected.

@forki
Copy link
Member

forki commented Sep 4, 2019

@danyx23 any chance for repro?

@forki
Copy link
Member

forki commented Sep 4, 2019

ok I think I found the issue. we are nuking he assets file butkeep all Paket files intact. this is a bug

@forki
Copy link
Member

forki commented Sep 4, 2019

b13d806 <- waiting for CI

@danyx23
Copy link

danyx23 commented Sep 4, 2019

@forki I have this repo that I was using as the example (https://github.com/danyx23/safe-stack-sweet-alert-debug) that is currently at Elmish.SweetAlert 3.1 and if you build and then upgrade to 3.2 it exhibits the problem. I'll try the new version as soon as it is published - thanks for the fast fix!

@forki
Copy link
Member

forki commented Sep 4, 2019

published. please give it a try

@danyx23
Copy link

danyx23 commented Sep 4, 2019

@forki thanks! The bug that I described is fixed in the new version but the delete is too agressive - it deletes the paket.references files in the source directories which then breaks the builds!

@baronfel
Copy link
Contributor

baronfel commented Sep 4, 2019

Agree with @danyx23, just saw this happen to me as well. luckily git checkout is a thing :)

@forki
Copy link
Member

forki commented Sep 4, 2019 via email

@forki
Copy link
Member

forki commented Sep 4, 2019 via email

@forki
Copy link
Member

forki commented Sep 4, 2019

new alpha should be available

@danyx23
Copy link

danyx23 commented Sep 4, 2019

Works like a charm. Thanks a lot for your great work @forki!

@forki
Copy link
Member

forki commented Sep 4, 2019

cool so I'm releasing it properly. Thanks for your help with testing

@forki forki closed this as completed Sep 4, 2019
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

5 participants