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

Add instructions to install MSBuildSdk packages #9268

Merged
merged 4 commits into from
Oct 12, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public DisplayPackageViewModelFactory(IIconUrlProvider iconUrlProvider)
// Lazily load the package types from the database.
viewModel.IsDotnetToolPackageType = package.PackageTypes.Any(e => e.Name.Equals("DotnetTool", StringComparison.OrdinalIgnoreCase));
viewModel.IsDotnetNewTemplatePackageType = package.PackageTypes.Any(e => e.Name.Equals("Template", StringComparison.OrdinalIgnoreCase));
viewModel.IsMSBuildSdkPackageType = package.PackageTypes.Any(e => e.Name.Equals("MSBuildSdk", StringComparison.OrdinalIgnoreCase));
}

if (packageKeyToDeprecation != null && packageKeyToDeprecation.TryGetValue(package.Key, out var deprecation))
Expand Down
1 change: 1 addition & 0 deletions src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class DisplayPackageViewModel : ListPackageItemViewModel

public bool IsDotnetToolPackageType { get; set; }
public bool IsDotnetNewTemplatePackageType { get; set; }
public bool IsMSBuildSdkPackageType { get; set; }
public bool IsAtomFeedEnabled { get; set; }
public bool IsPackageDeprecationEnabled { get; set; }
public bool IsPackageVulnerabilitiesEnabled { get; set; }
Expand Down
15 changes: 15 additions & 0 deletions src/NuGetGallery/Views/Packages/DisplayPackage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@
}
};
}
else if (Model.IsMSBuildSdkPackageType)
{
packageManagers = new PackageManagerViewModel[]
{
new PackageManagerViewModel("SDK")
{
Id = "sdk",
InstallPackageCommands = new [] { string.Format("<Sdk Name=\"{0}\" Version=\"{1}\" />",
Model.Id, Model.Version) },
AlertLevel = AlertLevel.Info,
AlertMessage = string.Format("For projects that support Sdk, copy this XML node into the project file to reference the package."),
CopyLabel = "Copy the SDK XML node",
}
};
}
else
{
packageManagers = new PackageManagerViewModel[]
Expand Down