Package Manager Console Commands in Prebuild Event

Earlier this week, I posted a question on how to efficiently share files between multiple web applications as part of a solution . NuGet was proposed as a solution, and after a while I was able to implement the solution, but I have one problem that is currently blocking me from completing it.

At this moment, I have two web application projects:

  • Project.Common.Presentations
  • Project.Website.Presentations

Each time a project Project.Common.Presentationsis created, a new NuGet package with a higher version is created. This package is used in my main web project Project.Website.Presentations. Initially, I add the project.common.presentation NuGet project to this project via a GUI. Immediately after that, I set up a pre-build where I do a NuGet update from the command line to pull out the latest version of the package Project.Common.Presentations.

But somehow, using the NuGet update on the command line adds a link to my project using a location that is actually not on the disk, which leads to this problem:

Failed to resolve this link. Could not find assembly "Project.Common.Presentations". Make sure the assembly exists on disk. If this link is required for your code, you may get compilation errors.

This is how I created the structure:

  • I created a NuSpec file for my project Project.Common.Presentationsusing the file .csproj.
  • As an event post-build in my Project.Common.Presentations, I use: $(ProjectDir)nuget.exe pack -sym $(ProjectPath). This creates a new NuGet package every time a project is created. Before executing this build event, I use a script to remove old NuGet packages.
  • As the pre-build event in mine Project.Website.Presentations, I use:$(ProjectDir)NuGet.exe update $(ProjectDir)packages.config

, .csproj dll , . , , .csproj , , - . GUI " NuGet" NuGet, , .

. - , , , . . ? .

+5
1

NuGet - , ( ) . NuGet - NuGet.

, .

: -

+3

All Articles