how to update all the reference of a .net standard app's csproj of a specific package during installtion

Aditya Dalai 25 Reputation points
2023-11-20T05:19:05.8033333+00:00

currently when I install a nuget package inside .net standard app i can only able update the PackageReference indie the csproj

<PackageReference Include="sip-si" Version="4.0.10" />

rest of all the referance are not able to update the updated version inside the same csproj file ex


  <Target Name="CopyReferenceDll" AfterTargets="Build">
	<Copy SourceFiles="..\..\_Common\packages\sip-si.4.0.9\lib\netstandard2.0\Wrapper.dll" DestinationFolder="$(TargetDir)" />
	<Copy SourceFiles="..\..\_Common\packages\sip-si.4.0.9\lib\netstandard2.0\Wrapper.pdb" DestinationFolder="$(TargetDir)" />
  </Target>

and it gives an error after installation and i need to update them manually is there any way to modify the sip-si.nuspec file so after installtion of the nuget pack the target section also will get updated with the particular version.

and can we run a powershell script during installation of a nuget package automatically

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,799 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,848 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiale Xue - MSFT 44,501 Reputation points Microsoft Vendor
    2023-11-21T08:26:03.2166667+00:00

    Hi @Aditya Dalai , Welcome to Microsoft Q&A,

    Microsoft employees said here that the powershell script of the package reference has been deprecated, and it is not recommended to use scripts in packages:

    https://github.com/NuGet/Home/issues/4318#issuecomment-343255043

    The target after build target method you use can be tested here:

    User's image

    The principle is to replace the dll and pdb of the current project.

    If there is a problem, it may be because you did not choose to rebuild, so the previous metadata file is still used.

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.