viktorveis on master
Added comparison between MPFPro… Replaced CPS with VSPS since CP… Replace deprecated Connect with… and 9 more (compare)
I'm trying to distribute a NuGet package as part of my custom project type VSIX, as per these docs:
The package is properly deployed and the
.vstemplate file seems to be working because the
packages.config file is automatically created by the new project template. And, the
packages.config file does have the correct content in it.
However, when I execute the "Manage NuGet Packages" command, I get the error below:
Note that I have declared the
PackageReferences capability, though I don't think it applies here.
PackageReferencescapability is for projects which support
PackageReferences in the project file, I think it's available for all project systems now (since VS 15.5 or 15.6?), and the wizard shouldn't generate a packages.config, as it's not compatible... also see NuGet/Home#4693
@jp2masa Oh, wow. I was poking around those issues and thought I hit a dead end because most references lead to this:
That didn't reference anything on NuGet. So, if
PackageReference works, then that's great. And, Andrew Arnott's comment about not using that wizard-based pattern anymore would certainly apply.
It seems all I need to do is delete all the stuff I thought I needed, and then just have the
@jp2masa So, if I simply add a
PackageReference, then I actually see the same error when I execute "Manage NuGet Packages" on the project.
And, "Manage NuGet Packages for Solution", doesn't list my custom project type in the list of projects.
I've added XAML rules files for
ResolvedPackageReference, taken from the .NET project system.
I've also added those to the
Imports in my targets file.
Is there another step perhaps I missed?
Thanks in advance.
packages.configstyle instead of
packages.configand adds it to the project, and downloads the package to a solution-level
PackageReferenceselected in Tools -> Options as the default and I'm even setting the
RestoreProjectStyleproperty in my project file to
packages.configstyle, installing the package does not inject the automatic
build\<myPackageId>.targetsinto the project file, even though the package manager says installation succeeded.
PackageReferenceis correctly generated.
packages.configstyle is used (as that's all C++ supports, I believe), and the
build\<myPackageId>.targetsis correctly inserted into the project file .
Dependenciesnode in Solution Explorer.
Microsoft.VisualStudio.VCProjectEnginenamespace, but can't find a way to instantiate the
VCProjectEngine. Rather, you start with an
hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, __VSHPROPID.VSHPROPID_ExtObject, out var automationProject); var codeModel = automationProject.CodeModel as VCCodeModel; var vcProject = automationProject.Object as VCProject; var fileCodeModel = automationProject.ProjectItems.Item(i).FileCodeModel as VCFileCodeModel;
@jp2masa , If you're interested, I see the same behavior with the default Project Type template. I attached a minimal project system. All I did was:
Try adding any NuGet package to it via the package manager. It succeeds, but adds a
packages.config and doesn't add the required imports to the project file.
PackageReferencein my project template, then it will restore and build fine.
TargetFrameworkthing looked promising, but this is, of course, not a .NET Framework project - it's my own, so not sure what value to put there anyway.
UnconfiguredProject, or do we have to fall back on
UnconfiguredProjectis tied to
IVsProject, which I know is not available from an unloaded