Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ NuGet and MSBuild are very tightly coupled and a lot of times you need packages
2. Package feed - This allows you to create a file-based package feed of actual `.nupkg` files.

## Package Repository
Create a package repository if you want to generate packages as if they've already been installed. If you want to create actual `.nupkg` packages, see [Package Feed]
Create a package repository if you want to generate packages as if they've already been installed. If you want to create actual `.nupkg` packages, see [Package Feed](#Package-Feed)

### Examples

Expand Down Expand Up @@ -302,7 +302,7 @@ using PackageRepository packageRepository = PackageRepository.Create(TestRootPat
```

## Package Feed
Create a package feed if you want to generate `.nupkg` packages that can be installed by NuGet. If you want to create a repository of packages as if they've already been installed, see [Package Repository].
Create a package feed if you want to generate `.nupkg` packages that can be installed by NuGet. If you want to create a repository of packages as if they've already been installed, see [Package Repository](#Package-Repository).

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,5 +390,27 @@ public void RestoreTargetCanBeRun()

buildOutput.MessageEvents.High.ShouldContain(i => i.Message == "312D2E6ABDDC4735B437A016CED1A68E" && i.Importance == MessageImportance.High, buildOutput.GetConsoleLog());
}

[Fact]
public void RestoreUsesGlobalPropertiesFromCreate()
{
Dictionary<string, string> globalProperties = new Dictionary<string, string>
{
["SomeGlobalProperty"] = "04BB4AFE8AE14B7A8E3511B5F2CD442B",
};

ProjectCreator
.Create(
path: Path.Combine(TestRootPath, "project1.proj"),
globalProperties: globalProperties)
.Target("Restore")
.TaskMessage("$(SomeGlobalProperty)", MessageImportance.High)
.TaskError("SomeGlobalProperty was not defined", condition: "'$(SomeGlobalProperty)' == ''")
.TryRestore(out bool result, out BuildOutput buildOutput);

result.ShouldBeTrue(buildOutput.GetConsoleLog());

buildOutput.MessageEvents.High.ShouldContain(i => i.Message == "04BB4AFE8AE14B7A8E3511B5F2CD442B" && i.Importance == MessageImportance.High, buildOutput.GetConsoleLog());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ private void Restore(IDictionary<string, string>? globalProperties, BuildOutput
#else
Dictionary<string, string?> restoreGlobalProperties =
#endif
new(globalProperties ?? ProjectCollection.GlobalProperties);
new(globalProperties ?? _globalProperties ?? ProjectCollection.GlobalProperties);

restoreGlobalProperties["ExcludeRestorePackageImports"] = "true";
restoreGlobalProperties["MSBuildRestoreSessionId"] = Guid.NewGuid().ToString("D");
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "14.0",
"version": "14.1",
"assemblyVersion": "1.0",
"buildNumberOffset": -2,
"nugetPackageVersion": {
Expand Down
Loading