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"
}
}
Related
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.
I have created a C# WinForms Application which depends on the .NET Framework Version 4.6.1 and GhostScript 9.2.1 (32-bit Windows). I made a simple Windows Installer ( .msi file) for the WinForms App, but the GhostScript library refused to install. Therefore, I decided to make a bundle installer using the WiX bootstrapper.
In the bootstrapper project I packaged the GhostScript exe installer and the simple msi installer from earlier. I think I also took care of the .NET framework in the first few lines of the bootstrapper.
Now, I'm still facing an issue while with the Bootstrap Installer. The issue is that the installation skips over the msi installer. How do I get the Bootstrap installation to successfully complete?
Here is the XML for the bootstrapper project:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Bootstrapper1" Version="1.0.0.0" Manufacturer="POD" UpgradeCode="390cbc0b-980b-4f35-a9de-a11228f75b69">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<PayloadGroup Id="NetFx461RedistPayload">
<Payload Name="redist\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"
SourceFile="C:\Users\Admin\Downloads\NDP461-KB3102436-x86-x64-AllOS-ENU.exe"/>
</PayloadGroup>
<Chain>
<!-- TODO: Define the list of chained packages. -->
<!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
<PackageGroupRef Id="NetFx461Web"/>
<ExePackage Id="Ghostscript_32_bit_Version_9.2.1"
Cache="yes"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="C:\Users\Admin\Downloads\gs921w32new.exe"
InstallCommand="/passive /norestart" />
<MsiPackage Id="POD_Measuring_Tool"
Cache="yes"
Compressed="yes"
Permanent="yes"
Vital="yes"
SourceFile="C:\Users\Admin\Documents\POD\Workspace Folder\c# projects\6lumber\toolPOD\Debug\toolPOD.msi" />
</Chain>
</Bundle>
</Wix>
I reference the WixBalExtension and the WixNetFxExtension, and the msi file and ghostscript exe are from my computer.
The issue is that the installation skips over the msi installer.
This may indicate that the product is already install. MsiPackage will automatically detect if the msi is already installed by checking the product code in the registry.
The MsiPackage/#Permanent attribute will also mean that your product will not be removed when uninstalling your Bootstrapper - so check that you did remove your msi manually and logging helps with the -l logfile.txt switch.
I want to publish my dacpac file using VSTS. I will be giving only DACPAC file to Dev ops team. I want to ignore drop table that is not in source. If i Publish it from SSDT, I can change in advanced settings. How to do that for VSTS. I can see an option under debug menu, But I am unable to check that option, Screen shot is attached in below URL.
https://i.stack.imgur.com/TBQPe.png
You can give publish.xml along side your dacpac and include a similar setting in that xml as well such as mentioned below
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludeCompositeObjects>True</IncludeCompositeObjects>
<TargetDatabaseName>dbname</TargetDatabaseName>
<DeployScriptFileName>dbname.sql</DeployScriptFileName>
<TargetConnectionString>Data Source=<name>;Integrated Security=True;Persist
Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect
Timeout=60;Encrypt=False;TrustServerCertificate=True</TargetConnectionString>
<BlockOnPossibleDataLoss>False</BlockOnPossibleDataLoss>
<DropObjectsNotInSource>False</DropObjectsNotInSource>
<ProfileVersionNumber>1</ProfileVersionNumber>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
</Project>
and while deploying dacpac (using cmd or powershell) you need to pass this xml file path in /Profile: parameter to pick this xml for deployment settings
I'm trying to use FSharp.Data.SqlClient on Windows
c:\...> dotnet new console -lang f# -o test5
c:\...> cd test5
Now add <Import Project="fsc.props" /> to test5.fsproj and add fsc.props from https://raw.githubusercontent.com/fsprojects/FSharp.TypeProviders.SDK/master/fsc.props. Then
c:\...\test5> dotnet add package FSharp.Data.SqlClient
And edit Program.fs as follows:
open FSharp.Data
open FSharp.Data.SqlClient
[<Literal>]
let connectionString =
#"Data Source=.\SQL14X64;Initial Catalog=test;User=sa;Password=***"
[<EntryPoint>]
let main argv =
use cmd = new SqlCommandProvider<"
SELECT 1
" , connectionString>(connectionString)
0
Trying to compile it:
c:\...\test5> dotnet build
Have error:
The type 'SqlCommand' is required here and is unavailable.
You must add a reference to assembly 'System.Data.SqlClient, Version=0.0.0.0, ...
Ok, installing System.Data.SqlClient:
c:\...\test5> dotnet add package System.Data.SqlClient
Have error:
The type 'SqlCommand' is required here and is unavailable.
You must add a reference to assembly 'System.Data.SqlClient, Version=4.2.0.1, ...
O-key, let install 4.2.0.1:
c:\...\test5> dotnet remove package System.Data.SqlClient
c:\...\test5> dotnet add package System.Data.SqlClient --version 4.2.0.1
c:\...\test5> dotnet build
Have error:
The type 'SqlCommand' is required here and is unavailable.
You must add a reference to assembly 'System.Data.SqlClient, Version=4.1.0.0, ...
Hm... Replace with 4.1.0.0:
c:\...\test5> dotnet remove package System.Data.SqlClient
c:\...\test5> dotnet add package System.Data.SqlClient --version 4.1.0.0
c:\...\test5> dotnet build
Have same error again:
The type 'SqlCommand' is required here and is unavailable.
You must add a reference to assembly 'System.Data.SqlClient, Version=4.1.0.0, ...
Cannot really move any further with it.
OS: Windows, .NET Core: 2.1.2
I'm sure others are still struggling with this from time to time, so here is what I had to do in order to get the FSharp.Data.SqlClient running in a .NET Core project on a Mac (yes, it does work, beautifully!).
I believe most of it will apply to Windows as well, except that you won't need Mono.
At compile time you need full .NET framework, so you have to install Mono if you are running Linux or Mac. The project still compiles to clean .NET Core.
You need fsc.props in your project folder (place it in the same folder as your project file). Fsc.props contains the path to the tool to use at compile time. In my fsc.props file the relevant path was described as follows (I can't remember whether or not I had to edit it to get things running):
<PropertyGroup Condition="'$(IsOSX)' == 'true' AND Exists('/Library/Frameworks/Mono.framework/Versions/Current/Commands/fsharpc')">
<FscToolPath>/Library/Frameworks/Mono.framework/Versions/Current/Commands</FscToolPath>
<FscToolExe>fsharpc</FscToolExe>
</PropertyGroup>
Next you need to reference fsc.props in your .fsproj file, and DisableAutoSetFscCompilerPath:
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="fsc.props" />
<PropertyGroup>
<DisableAutoSetFscCompilerPath>true</DisableAutoSetFscCompilerPath>
<DotNetFscToolPath></DotNetFscToolPath>
<DotnetFscCompilerPath></DotnetFscCompilerPath>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="mySQLCode.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Data" Version="3.3.3" />
<PackageReference Include="FSharp.Data.SqlClient" Version="2.0.6" />
</ItemGroup>
</Project>
The relevant lines are lines 2 through 8.
Of course you also have to get the Fsharp.Data and FSharp.Data.SqlClient using your favourite package manager, which will add the PackageReference lines to the project.
Happy coding
Roland
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.