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

Fix vcxproj global package restore #155

Merged
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
@@ -0,0 +1,88 @@
{
"version": 3,
"targets": {
"native,Version=v0.0": {
"Custom.MSBuildPlugin/1.0.0": {
"type": "package",
"build": {
"buildTransitive/Custom.MSBuildPlugin.targets": {}
},
"buildMultiTargeting": {
"buildMultitargeting/Custom.MSBuildPlugin.targets": {}
}
}
}
},
"libraries": {
"Custom.MSBuildPlugin/1.0.0": {
"sha512": "YrfgJpLLhkaTNf2pbg1fKk6W5hTts3RejwxWEnj0NQ/ZADzLO5u25wxIA5yPk1PaK/Lw0OL0jOdcJuTQ0Evo4A==",
"type": "package",
"path": "custom.msbuildplugin/1.0.0",
"files": [
".nupkg.metadata",
"custom.msbuildplugin.1.0.0.nupkg.sha512",
"custom.msbuildplugin.nuspec",
"build/Custom.MSBuildPlugin.targets",
"buildMultitargeting/Custom.MSBuildPlugin.targets",
"buildTransitive/Custom.MSBuildPlugin.targets"
]
}
},
"projectFileDependencyGroups": {
"native,Version=v0.0": [
"Custom.MSBuildPlugin >= 1.0.0",
]
},
"packageFolders": {
"C:\\Users\\Default\\.nuget\\packages\\": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\src\\Example.vcxproj",
"projectName": "Example",
"projectPath": "C:\\src\\Example.vcxproj",
"packagesPath": "C:\\Users\\Default\\.nuget\\packages\\",
"outputPath": "C:\\src\\obj\\",
"projectStyle": "PackageReference",
"centralPackageVersionsManagementEnabled": true,
"configFilePaths": [
"C:\\src\\NuGet.Config",
"C:\\Users\\Default\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net7.0"
],
"sources": {
"https://nuget.org": {}
},
"frameworks": {
"native": {
"targetAlias": "net7.0",
"projectReferences": {}
}
},
"warningProperties": {
"allWarningsAsErrors": true
}
},
"frameworks": {
"native": {
"targetAlias": "net7.0",
"dependencies": {
"Custom.MSBuildPlugin": {
"include": "Runtime, Build, Native, ContentFiles, Analyzers",
"suppressParent": "All",
"target": "Package",
"version": "[1.0.0, )",
"versionCentrallyManaged": true
},
},
"centralPackageVersions": {
"Custom.MSBuildPlugin": "[1.0.0, )",
}
}
}
}
}
11 changes: 10 additions & 1 deletion src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Microsoft.NuGet.Build.Tasks.Tests/Json/Json.resx
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@
<data name="WithTargets_assets" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>WithTargets.assets.json;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="GlobalMSBuildPlugin_vcxproj" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>GlobalMSBuildPlugin.vcxproj.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
9 changes: 8 additions & 1 deletion src/Microsoft.NuGet.Build.Tasks.Tests/NuGetTestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ public static ResolvePackagesResult ResolvePackagesWithJsonFileContents(
task.RuntimeIdentifier = runtimeIdentifier;
task.ProjectLockFile = projectLockJsonFile.Path;
task.ProjectLanguage = projectLanguage;
task.TargetMonikers = new ITaskItem[] { new TaskItem(targetMoniker) };
if (targetMoniker != null)
{
task.TargetMonikers = new ITaskItem[] { new TaskItem(targetMoniker) };
}
else
{
task.TargetMonikers = Array.Empty<ITaskItem>();
}

// When we create the task for unit-testing purposes, the constructor sets an internal bit which should always
// cause task.Execute to throw.
Expand Down
Loading