In VS2017 I created a new Winforms project using the XAF Solutions Wizard ( Entity Framework Code - First)
The wizard adds references according to options I select.
Now I want to change all the packages to use my Nuget Feed for the Dev Express References.
XAF does have Nuget packages
Is there a Nuget command that I can use to do this automatically?
Cross posted to Dev Express
There is no way to do this with Nugets unless you script your way out as we are doing in XAF community project expandFramework. For some cases it won't work, however for a similar case here is what we do.
Parse all your projects for References start with DevExpress and construct a list of assemblies
For all assemblies in the list add them to packages.config
For all assemblies use the DevExpress.PackageContent project to link to the containing the packages.
Get-DxNugets 18.2.6
Install the found packages from step 3
`Nuget Install packageName -OutputFolder $commonOutputFolder
Update the DevExpress references HintPath to the packages installation folder.
Update-HintPath -OutputPath "$packageInstallationfolder" -SourcesPath $rootPath -filter "DevExpress*"
all powershell functions come from the XpandPosh project. There are many helpful methods there unfortunately no docs. But you can get support
Related
If I understand Scott Hanselman's post here correctly then I should be able to reference a .net standard library from a framework 4.7.2 solution.
I want to use Nuget to install such a reference.
I am using Azure DevOps Artifacts for the Nuget package. When I push my .net standard solution I can see that the package does create and that the Nuget install command is
Install-Package SBD.Standard -version 2.0.0-CI-etc
However when I try this at the PM console for my framework 4.7.2 project I get
Could not install package 'SBD.Standard 2.0.0-etc'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that
framework
moreover I do not see SBD.Standard as an avialable package in the relevant feed from within VS2019 -> Manage nuget packages for solution.
I think I need packages.config
I was able to create a new 4.7.2 project and add the nuget package that used .net standard 2.0 (but not 2.1)
When I tried to add the nuget package I got a dialog asking me to select the Nuget package manager format
so I chose Packages.config and that worked.
I am not sure I have it right. I solved my problem but am not sure whether this was it after all. SInce PackageReference is more recent it should work.
Some additional explanations for this issue.
There is an issue for NuGet restore when you using new SDK-based project type or PackageReference in the .net framework:
https://github.com/NuGet/Home/issues/5461
https://github.com/dotnet/sdk/issues/1755
When we use packages.config projects or non-SDK based project type, NuGet do not check compatibility during install/restore.
So, to resolve this issue, we need make sure the referenced project is an old style csproj or use packages.config.
That the reason why the packages.config works for you.
Hope this helps.
So I decided to take a look at this new Visual Studio 14 CTP. When I tried to add a package from Nuget library (Raven Database Server precisely) to my ASP.NET vNext Web Application, it felt like nothing really happened. Not a single piece of solution has changed, and the References remained the same.
I tried adding it manually using my "Project.json" file (as seen in this article), but IntelliSense didn't provide me with any fill. I actually tried it in a lot of different ways, with a whole lot of Nuget packages, with the same result.
Can anybody explain this situation?
ASP.NET vNext supports two targets: .NET 4.5 and CoreCLR. When targeting .NET 4.5 (net45) you can add any existing NuGet reference. When targeting CoreCLR (k10) you can only add NuGet references that support it; today, only some packages support that.
The package that you mention is only available for net45. To add a reference to it, add the package as a dependecy in the net45 section of project.json - just like autofac is added in this file
The entry should be: "RavenDB.Server":"2.5.2879"
PS: the manage NuGet references dialog is not functional for ASP.NET vNext projects in this version of VS
I coordinate a project (Fluent Assertions.MVC) which has a separate builds for MVC 3 and 4. At the moment it is distributed via two NuGet packages.
Is this the best (only?) way, or is it possible to ship one package and have NuGet reference the correct .dll in the target project?
The solution is quite simple:
you add into your package the DLLs for all supported versions of MVC
(3 and 4 in your case);
then write install.ps1 script to find out
what version of MVC is used in the target project and remove
unnecessary DLLs from project references.
Here you can find more detailed instructions and an example of install.ps1 script:
http://blogs.korzh.com/2013/12/nuget-package-different-mvc-versions.html
Currently NuGet can install separate sets of reference dlls by target framework, such as .net40, net45, netcore45 etc. Please refer to http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package for more details.
For MVC3 vs. MVC4 though, the best I can think of is to have install.ps1 in your package and try to use DTE objects to determine which version of MVC the project is using (maybe by checking MVC assembly version) and then install references accordingly.
I have been trying to use NuGet in a complex solution (with around 100 project files) and been struggling with updating the existing references (from a /ext/.. directory ) to that of official NuGet directory. As far as I understand we need to manually select the project files (from the PackagaManager GUI/Manage Assemblies) and update the references. This is cumbersome to know which project uses what out of 100 odd projects. Is there any way (built-in to nuget or any other workaround) to update assemblies to nuget directory without having to manually select projects?
This is not supported as yet and I've registered an issue under codeplex's nuget project.
I'm trying to create a NuGet package from a .csproj. I have successfully compiled the project and the output folder contains all of the necessary files (my assembly and all of its dependencies). However, NuGet only seems to be placing the assembly created by the .csproj into the package and not any of its dependencies. My command line looks like this:
nuget pack MyProject.csproj -Property Configuration=Release
and my resulting .nupkg file only has my assembly in the lib folder. I have successfully gotten NuGet to work for other projects, but it just so happens that this project is referencing the Enterprise Library logging block, but it was NOT retrieved via NuGet. I'm not sure if that could be related to my problem or not.
Any thoughts on why it's not picking up the dependenices?
If you need to keep your nuspec file up-to-date automatically, its really just an XML file (as I'm sure you know) so there are some very nice tools you can use from MSBuild to automate nuspec creation/updates. Out of the box, MSBuild provides a few tasks that can update or transform XML, and I've used MSBuild Community Tasks to customize the initial nuspec. For example, the default nuspec contains a few lines with broilerplate that I don't need, so I use XmlUpdate tasks to delete them.
Although I have not looked into scanning the csproj file for non-nuget references, I think its likely possible with a little research. Here are some links to blog entries describing my experiences with NuGet automation, they may help you get a head start:
Creating Packages with NuGet the MSBuild Way - This article includes some basic NuSpec updates because the package described is not that different from the type of package NuGet already knows how to automate.
Manage Your MEF Parts With Nuget - This article includes some more complex updates to support distributing MEF parts as runtime-only references.
If you plan on doing this alot, don't want to mess with MSBuild, or just want to get back the behavior you liked from the pre-1360 version of ProjectFactory.cs, NuGet supports third-party extension through MEF. You could go into the source control and grab the earlier code that you liked and create a custom command (for example custompack) that provides that behavior. Then you could use it from the command line like so:
nuget custompack MyProject.csproj -Property Configuration=Release
I think this is a really cool aspect of NuGet but I haven't played with it myself yet. Here is an article that explains how to do it:
Extend NuGet Command Line
So even though David mentioned that NuGet is not designed to support this scenario, if the scenario is correct for you then you can go this route to extend NuGet to meet your needs.