NuGet does not add dependencies to package - wpf

I'm trying to package my WPF application with the NuGet pack command. So far I found out that adding -IncludeReferencedProjects resolves the problem of referenced projects not getting packed.
./nuget.exe pack {path}.csproj -NonInteractive -OutputDirectory C:\test -Properties Configuration=release -version 0.1.0 -Verbosity Detailed -IncludeReferencedProjects
The problem I face is that the project's dependencies are not getting packed. They however do show up in the log as you can see below. Dependencies: EntityFramework.
But the dependencies are never added to the package. Even when I manually inspect or deploy the package only Data.dll and {name}.exe are deployed.
What I've already tried (by searching Google/SO):
Adding a NuSpec file for the csproj file
NuGet.config with a reference to the correct packages folder (in case NuGet did not find it)
EDIT: added generated .nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>{path}.UpgradeDatabase</id>
<version>0.1.4</version>
<title>{path}.UpgradeDatabase</title>
<authors>stephanbisschop</authors>
<owners>stephanbisschop</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<copyright>Copyright © 2016</copyright>
<dependencies>
<dependency id="EntityFramework" version="6.1.3" />
</dependencies>
</metadata>
</package>
Thank you in advance,
Stephan

Problem solved.
It wasn't my NuGet package that was missing the dependencies.. it was Octopus Deploy that wasn't restoring the packages. We fixed it by adding entries in the appropriate .NuSpec files. Now all the .dll, .config , etc.. files get packaged with the package.

Related

Can't install IdentityServer4.Template

Why I can't install IdentityServer4 template using dotnet new --install IdentityServer4.Templates::4.0.1?
When I run the command it does not show any errors, it just shows the list of templates I have.
I checked my Windows user NuGet configuration and there seems nothing wrong with it.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear/>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="IdentityServer Local" value="./nuget" />
</packageSources>
</configuration>
I've also tried using this command dotnet new -i identityserver4.templates --nuget-source https://api.nuget.org/v3/index.jsonbut it does not work either.
I still didn't have the solution to the problem but I found a workaround by downloading the nuget package file of the IdentityServer Template. Then I run dotnet new -i <path>\identityserver4.templates.4.0.1.nupkg.
Check the path (eg. 'C:\Users\username.templateengine\packages' for windows) where the identityserver4.template already exist and delete it. You can now install idp.

How can i include a master changelog file inside another master changelog file in liquibase

I have a requirement where am pulling changelog files containing changesets as a maven dependency from other project module. I need to include the master changelog file of other project (which has reference to all the changesets in it)in current project from where i will execute the maven liquibase update / rollback or spring boot liuqibase setup. Is there a way to make it work?
I tried to do that like shown below
<?xml version="1.0" encoding="UTF-8" standalone="no"?><databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangeloghttp://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<property name="blob" value="bytea" dbms="postgresql"/>
<property name="blob" value="blob" dbms="derby"/>
<preConditions>
<or>
<dbms type="derby"/>
<dbms type="postgresql"/>
</or>
</preConditions>
<include file="db/changelog/db.changelog-master.xml"/>
<include file="db/changelog/changesets/2019-06-001-modeler.changelog.xml"/>
</databaseChangeLog>
But i get error
Error setting up or running Liquibase: liquibase.exception.SetupException:
Error Reading Migration File: Found 2 files that match db/changelog/db.changelog-master.xml
I have same folder structure in all the projects.
This was a reported bug a while back and is now fixed with the later versions of Liquibase.
Please try to use the latest Liquibase version and see if the issue goes away.
Below is a reference for Liquibase releases.
https://github.com/liquibase/liquibase/releases
Liquibase can't understand which of your files with same name it should use.
If it's possible you should change path to your changelog.
So if your changelogs are both on path db/changelog/db.changelog-master.xml try to rename the paths at least. For example use db/changelog/module1/db.changelog-master.xml or db/changelog/db.changelog-module1-master.xml.

WIX Setup doesn't build

I am using the WIX binaries from a local folder instead of the common installation. So i had to overwrite my Paths like this:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WixToolPath>$(TeamProjectBuildUtilsDir)Tools\WIX\</WixToolPath>
<WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
<WixTasksPath>$(WixToolPath)WixTasks.dll</WixTasksPath>
</PropertyGroup>
</Project>
It was working ok, but today i tried it again and get this:
System.IO.FileLoadException" in WixTasks.dll:
> Additional information: The file or assembly
> "file:///D:\Repos\MyProject\BuildUtils\Tools\WIX\candle.exe" or a
> dependency could not be found. To progress is not supported.
> (Exception of HRESULT: 0x80131515)
I am not very expirenced with WIX and don't know what to do. It worked fine.
My VS freezes after this build step.
If you downloaded the WiX binaries .zip, you need to "unblock" the file (remove the stream that indicates it was downloaded from the Internet). .NET won't load files that are marked as coming from the Internet.

Install nuget package to a custom folder

I have created an ASP.NET 5 app in Visual Studio Community Edition. Then I tried to install the nugget package angularjs.TypeScript.DefinitelyTyped using the command Install-Package angularjs.TypeScript.DefinitelyTyped as well as through the NuGet Package Manager. Both these commands dropped the package in the C:\Users\john\.dnx\packages folder.
I changed the repositoryPath in the nuget.config. Still the packages are saved in the same folders and not under the project.
How can I save the nuget packages under the project and not under c:\users.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<config>
<add key="repositoryPath" value="C:\Projects\HelloWorld\src\Scripts"/>
</config>
</configuration>
This is where the packages are dropped.
C:\Users\john\.dnx\packages\angularjs.TypeScript.DefinitelyTyped\4.2.8
But I want it under C:\Projects\HelloWorld\src
This is part of the not very well documented global.json. This global.json file creates a packages sub dir relative to it, where all the nuget packages end up when you restore them.
{
"packages": "packages",
"sdk": {
"version": "1.0.0-beta8",
"runtime": "coreclr",
"architecture": "x64"
}
}

Can I include an MSI file inside a Chocolatey package?

Can I put an MSI file or ISO image into a Chocolatey package?
So when I choco install foo, it won't download the MSI from another URL, but take the file from inside the package?
Yes, this is definitely possible. This is actually exactly what the ChocolateyGUI package does. You can see its .nuspec file here:
https://github.com/chocolatey/ChocolateyGUI/blob/develop/nuspec/chocolatey/ChocolateyGUI.nuspec
<?xml version="1.0"?>
<package>
<metadata>
<id>chocolateygui</id>
<version>$version$</version>
<title>Chocolatey GUI</title>
<authors>Chocolatey</authors>
<owners>Chocolatey</owners>
<projectUrl>https://github.com/chocolatey/ChocolateyGUI</projectUrl>
<projectSourceUrl>https://github.com/chocolatey/ChocolateyGUI</projectSourceUrl>
<packageSourceUrl>https://github.com/chocolatey/ChocolateyGUI/tree/develop/nuspec/chocolatey</packageSourceUrl>
<iconUrl>https://raw.githubusercontent.com/chocolatey/choco/master/docs/logo/chocolateyicon.gif</iconUrl>
<licenseUrl>https://raw.githubusercontent.com/chocolatey/ChocolateyGUI/develop/LICENSE</licenseUrl>
<bugTrackerUrl>https://github.com/chocolatey/ChocolateyGUI/issues</bugTrackerUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Chocolatey GUI is a nice GUI on top of the Chocolatey command line tool.
## Features
* View all **installed** and **available** packages
* **Update** installed but outdated packages
* **Install** and **uninstall** packages
* See detailed **package information**
## Notes
This package will only work correctly on Windows 7 SP1 through Windows 10 (1708) or Windows Server 2008 R2 SP1 through Windows Server 2016, and requires .NET Framework 4.5.2 at minimum.
</description>
<summary>A GUI for Chocolatey</summary>
<releaseNotes>
All release notes for Chocolatey GUI can be found on the GitHub site - https://github.com/chocolatey/ChocolateyGUI/releases
</releaseNotes>
<tags>chocolateygui chocolatey admin foss</tags>
<dependencies>
<dependency id="Chocolatey" version="[0.10.3, 0.11)" />
</dependencies>
</metadata>
<files>
<file src="chocolateyInstall.ps1" target="tools"/>
<file src="chocolateyUninstall.ps1" target="tools"/>
<file src="..\..\BuildArtifacts\ChocolateyGUI.msi" target="tools"/>
<file src="..\..\LICENSE" target="tools\LICENSE"/>
<file src="VERIFICATION.txt" target="tools"/>
</files>
</package>
Then, as you pointed out, you would then use Install-ChocolateyInstallPackage to perform the installation, which would then use the local MSI within the package, rather than first downloading it. You can see the installation script for ChocolateyGUI here:
https://github.com/chocolatey/ChocolateyGUI/blob/develop/nuspec/chocolatey/chocolateyInstall.ps1
$ErrorActionPreference = 'Stop';
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$fileLocation = Join-Path $toolsDir 'ChocolateyGUI.msi'
$packageArgs = #{
packageName = $env:ChocolateyPackageName
softwareName = 'Chocolatey GUI'
file = $fileLocation
fileType = 'msi'
silentArgs = "/qn /norestart /l*v `"$env:TEMP\$env:ChocolateyPackageName.$env:ChocolateyPackageVersion.log`""
validExitCodes= #(0,1641,3010)
}
Install-ChocolateyInstallPackage #packageArgs
Remove-Item -Force $packageArgs.file
You can do the exact same thing with an ISO image file, and there is a walkthrough on the established best practice for using that ISO file here:
How To Mount An Iso In Chocolatey Package
NOTE: If you are planning on pushing the package to Chocolatey.org, please bear in mind the size of the MSI/ISO file. If this is especially large, it is probably best not to include it within the nupkg, but rather use a download link.
Like Gary said, you can include arbitrary files in the package.
I'd emphasize that it's not a great idea. You have to download the package file itself (that's what happens when you choco install foo). Moving the MSI/ISO inside the package means you'll be downloading it with the package file and, depending on the size, slowing down feedback at the console.
Using the proper helpers and external URLs gives you a lot of great behaviors, least of which, is the download progress bar!
If file storage is a problem, there are many free options including: GitHub, Google Drive, DropBox, etc. If you're creating "internal" packages for your company, a network share can work with file:// URLs.

Resources