Force evaluate floating version packages with lock file via MsBuild / csproj












1















I want to use the Locking dependencies of Nuget (>= 4.9), so I can have automatic package update during dev phase and fixed version during release build.



I enabled the lock file mode, so I now have a packages.lock.json file.



The problem is that when I have floating version of package references in the project file like:



<PackageReference Include="My.Nuget.Package" Version="1.0.*" />


The restore package via Visual Studio Build does not update to new packages version anymore. This behavior appeared after I activated the lock file.



The Microsoft documentation describes the --force-evaluate option with dotnet.exe, that works well but I want to do this directly with an MsBuild option in the csproj.



By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.










share|improve this question



























    1















    I want to use the Locking dependencies of Nuget (>= 4.9), so I can have automatic package update during dev phase and fixed version during release build.



    I enabled the lock file mode, so I now have a packages.lock.json file.



    The problem is that when I have floating version of package references in the project file like:



    <PackageReference Include="My.Nuget.Package" Version="1.0.*" />


    The restore package via Visual Studio Build does not update to new packages version anymore. This behavior appeared after I activated the lock file.



    The Microsoft documentation describes the --force-evaluate option with dotnet.exe, that works well but I want to do this directly with an MsBuild option in the csproj.



    By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.










    share|improve this question

























      1












      1








      1








      I want to use the Locking dependencies of Nuget (>= 4.9), so I can have automatic package update during dev phase and fixed version during release build.



      I enabled the lock file mode, so I now have a packages.lock.json file.



      The problem is that when I have floating version of package references in the project file like:



      <PackageReference Include="My.Nuget.Package" Version="1.0.*" />


      The restore package via Visual Studio Build does not update to new packages version anymore. This behavior appeared after I activated the lock file.



      The Microsoft documentation describes the --force-evaluate option with dotnet.exe, that works well but I want to do this directly with an MsBuild option in the csproj.



      By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.










      share|improve this question














      I want to use the Locking dependencies of Nuget (>= 4.9), so I can have automatic package update during dev phase and fixed version during release build.



      I enabled the lock file mode, so I now have a packages.lock.json file.



      The problem is that when I have floating version of package references in the project file like:



      <PackageReference Include="My.Nuget.Package" Version="1.0.*" />


      The restore package via Visual Studio Build does not update to new packages version anymore. This behavior appeared after I activated the lock file.



      The Microsoft documentation describes the --force-evaluate option with dotnet.exe, that works well but I want to do this directly with an MsBuild option in the csproj.



      By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.







      c# visual-studio msbuild nuget






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 8:37









      maxence51maxence51

      3291212




      3291212
























          1 Answer
          1






          active

          oldest

          votes


















          2















          By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.




          I am afraid we could not do that at this moment. According to the nuget wiki,



          Enable repeatable package restore using lock file:



          enter image description here



          There is no such MSBuild equivalent option for option --force-evaluate, so we could not use --force-evaluate directly with an MsBuild option in the csproj.



          Hope this helps.






          share|improve this answer





















          • 1





            Thanks, but where is Re-evaluate and Restore?

            – maxence51
            Nov 21 '18 at 12:27











          • @maxence51, This is a preparing feature. It will appear on a later version. I am sorry that I mentioned it too early, I have updated the answer. I hope this does not bring you too much trouble.

            – Leo Liu-MSFT
            Nov 22 '18 at 1:31








          • 1





            Ok thank you Leo, I will deal with the CLI until this will appears in Visual Studio.

            – maxence51
            Nov 22 '18 at 7:38











          • @maxence51, You are always welcome! :)

            – Leo Liu-MSFT
            Nov 22 '18 at 7:39











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408075%2fforce-evaluate-floating-version-packages-with-lock-file-via-msbuild-csproj%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2















          By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.




          I am afraid we could not do that at this moment. According to the nuget wiki,



          Enable repeatable package restore using lock file:



          enter image description here



          There is no such MSBuild equivalent option for option --force-evaluate, so we could not use --force-evaluate directly with an MsBuild option in the csproj.



          Hope this helps.






          share|improve this answer





















          • 1





            Thanks, but where is Re-evaluate and Restore?

            – maxence51
            Nov 21 '18 at 12:27











          • @maxence51, This is a preparing feature. It will appear on a later version. I am sorry that I mentioned it too early, I have updated the answer. I hope this does not bring you too much trouble.

            – Leo Liu-MSFT
            Nov 22 '18 at 1:31








          • 1





            Ok thank you Leo, I will deal with the CLI until this will appears in Visual Studio.

            – maxence51
            Nov 22 '18 at 7:38











          • @maxence51, You are always welcome! :)

            – Leo Liu-MSFT
            Nov 22 '18 at 7:39
















          2















          By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.




          I am afraid we could not do that at this moment. According to the nuget wiki,



          Enable repeatable package restore using lock file:



          enter image description here



          There is no such MSBuild equivalent option for option --force-evaluate, so we could not use --force-evaluate directly with an MsBuild option in the csproj.



          Hope this helps.






          share|improve this answer





















          • 1





            Thanks, but where is Re-evaluate and Restore?

            – maxence51
            Nov 21 '18 at 12:27











          • @maxence51, This is a preparing feature. It will appear on a later version. I am sorry that I mentioned it too early, I have updated the answer. I hope this does not bring you too much trouble.

            – Leo Liu-MSFT
            Nov 22 '18 at 1:31








          • 1





            Ok thank you Leo, I will deal with the CLI until this will appears in Visual Studio.

            – maxence51
            Nov 22 '18 at 7:38











          • @maxence51, You are always welcome! :)

            – Leo Liu-MSFT
            Nov 22 '18 at 7:39














          2












          2








          2








          By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.




          I am afraid we could not do that at this moment. According to the nuget wiki,



          Enable repeatable package restore using lock file:



          enter image description here



          There is no such MSBuild equivalent option for option --force-evaluate, so we could not use --force-evaluate directly with an MsBuild option in the csproj.



          Hope this helps.






          share|improve this answer
















          By checking the NuGet Client code, it seems that a RestoreForceEvaluate option exists in Msbuild NuGet.targets but I have no idea how to use it.




          I am afraid we could not do that at this moment. According to the nuget wiki,



          Enable repeatable package restore using lock file:



          enter image description here



          There is no such MSBuild equivalent option for option --force-evaluate, so we could not use --force-evaluate directly with an MsBuild option in the csproj.



          Hope this helps.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 22 '18 at 1:25

























          answered Nov 21 '18 at 9:54









          Leo Liu-MSFTLeo Liu-MSFT

          20.9k22634




          20.9k22634








          • 1





            Thanks, but where is Re-evaluate and Restore?

            – maxence51
            Nov 21 '18 at 12:27











          • @maxence51, This is a preparing feature. It will appear on a later version. I am sorry that I mentioned it too early, I have updated the answer. I hope this does not bring you too much trouble.

            – Leo Liu-MSFT
            Nov 22 '18 at 1:31








          • 1





            Ok thank you Leo, I will deal with the CLI until this will appears in Visual Studio.

            – maxence51
            Nov 22 '18 at 7:38











          • @maxence51, You are always welcome! :)

            – Leo Liu-MSFT
            Nov 22 '18 at 7:39














          • 1





            Thanks, but where is Re-evaluate and Restore?

            – maxence51
            Nov 21 '18 at 12:27











          • @maxence51, This is a preparing feature. It will appear on a later version. I am sorry that I mentioned it too early, I have updated the answer. I hope this does not bring you too much trouble.

            – Leo Liu-MSFT
            Nov 22 '18 at 1:31








          • 1





            Ok thank you Leo, I will deal with the CLI until this will appears in Visual Studio.

            – maxence51
            Nov 22 '18 at 7:38











          • @maxence51, You are always welcome! :)

            – Leo Liu-MSFT
            Nov 22 '18 at 7:39








          1




          1





          Thanks, but where is Re-evaluate and Restore?

          – maxence51
          Nov 21 '18 at 12:27





          Thanks, but where is Re-evaluate and Restore?

          – maxence51
          Nov 21 '18 at 12:27













          @maxence51, This is a preparing feature. It will appear on a later version. I am sorry that I mentioned it too early, I have updated the answer. I hope this does not bring you too much trouble.

          – Leo Liu-MSFT
          Nov 22 '18 at 1:31







          @maxence51, This is a preparing feature. It will appear on a later version. I am sorry that I mentioned it too early, I have updated the answer. I hope this does not bring you too much trouble.

          – Leo Liu-MSFT
          Nov 22 '18 at 1:31






          1




          1





          Ok thank you Leo, I will deal with the CLI until this will appears in Visual Studio.

          – maxence51
          Nov 22 '18 at 7:38





          Ok thank you Leo, I will deal with the CLI until this will appears in Visual Studio.

          – maxence51
          Nov 22 '18 at 7:38













          @maxence51, You are always welcome! :)

          – Leo Liu-MSFT
          Nov 22 '18 at 7:39





          @maxence51, You are always welcome! :)

          – Leo Liu-MSFT
          Nov 22 '18 at 7:39




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408075%2fforce-evaluate-floating-version-packages-with-lock-file-via-msbuild-csproj%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Guess what letter conforming each word

          Port of Spain

          Run scheduled task as local user group (not BUILTIN)