Azure Artifacts fails to provide package - .net-core

We use our own Azure Artifacts instance to provide a private Nuget feed. It has a default setup, with the #Local view as the default view.
After updating a project on one of the developer machines from dotnet core 3.x to 5.0 all went fine on the dev machine. But then other developers started getting problems with restoring packages.
These developers tried dotnet nuget locals all -c then dotnet clean && dotnet restore after making sure they have the correct SDK installed (5.0). But the Azure Artifacts server cannot provide the correct package version, specifically;
error NU1102: Unable to find package Microsoft.AspNetCore.App.Ref with version (= 5.0.0)
I am aware that this package is an "internal package" in dotnet, and I have confirmed that it is not explicitly defined as a dependency in the projects that reports errors. It is some sort of implicit dependency.
I am also aware of that Microsoft says that one must add packages to a private feed that one wants the consumers of the feed to have available.
How can I possibly add such an "internal package" to the Nuget feed, when it is not meant to be consumed explicitly?
Why cannot Microsoft query a upstream package source when the requested package is not found in the private feed? (the 5.0.0 package version actually exists on nuget!)
How come that I do not have to download such a package myself when running dotnet restore, but my peers have to? (and fails at it, even though their dev environment is similar to mine)

Related

Publishing a Self-contained Console app fails

I installed the .NET SDK 2.1.301-win-x64.exe and afterwards updated all the nuget packages to 2.1.1.
In my WebApp I have the Nuget Package Microsoft.AspNetCore.All 2.1.1 and Microsft.NETCore.App 2.1.0. In the Nuget Window I see that there's also the Version 2.1.1, but I can't select it (Blocked by Project)
Same story in my Console App: Microsft.NETCore.App 2.1.0
My first question: Is here already something wrong? Or is this expected behavior?
If I build the WebApp as self contained App, that works well.
If I biuld the Console App as self contained App (Self-contained / win-x64). I get the follwoing Error:
The project was restored using Microsoft.NETCore.App version 2.1.1,
but with current settings, version 2.1.0 would be used instead. To
resolve this issue, make sure the same settings are used for restore
and for subsequent operations such as build or publish. Typically
this issue can occur if the RuntimeIdentifier property is set during
build or publish but not during restore."
The source of this error is a referenced project.
What do I do wrong? Let me know if you need additional information, then I will add it.
This is a known issue for the moment. In your referenced project's csproj file, set the TargetLatestRuntimePatch property:
<PropertyGroup>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
This only happens when a .NET Core application references another .NET Core application and self-contained roll-forward only partially kicks in during publish.
For portable applications, it is enough to target 2.1.0 version of Microsoft.NETCore.App and when run on a target machine, the latest patch available on the machine will be used automatically. In recent tooling, a change was made so that the tooling would use the latest known patch version for self-contained applications so you automatically bundle the latest patch release with your application. However, this doesn't flow over project-to-project references.
See Self-contained deployment runtime roll forward for more information.

SignalR on Mono (Linux Ubuntu)

I am having a hard time referencing the SignalR in my ASP.Net (4.5) application that I run on Mono (Linux Ubuntu). When I tries to add SignalR from nuget packages, then I get the following error: "Could not install package 'jQuery 1.6.4'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author." Then I tried to install SignalR from source. I followed the instruction given on this page https://github.com/SignalR/SignalR to install SignalR. After that, I created a sample project as described here: https://learn.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr#setup. However, when I open my browser it says that could not be found (this is the script referenced in my index.html file). I couldn't find that file, it seems this file is autogenerated. I am really stuck on this issue, not sure how to resolve it.
Not sure what I am doing wrong. I followed the same tutorial (https://learn.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr#setup) on windows and it worked fine.

asp.net 5 cannot find rc2 nuget packages

I have a simple asp.net 5 web application.
My project.json file contains dependency:
"Microsoft.IdentityModel.Tokens": "5.0.0-rc2-301060021"
When I restore nuget packages, this package is restored well on my machine. project.json file is in source control, but it does not work on other machine. It says that this package is not found.
Anyway, in nuget configuration Im pointing to my local nuget packages repository, which does not even contain asp.net 5 nuget packages. Where all of these packages come from?
RC2 has not yet been made public, we're still on RC1. Here is the roadmap schedule, which indicates sometime this year. If you do somehow have the package on your machine, you could setup another NuGet feed that others on your project could point to -- then simply place the package in there, so it's on shared feed.
Here is some helping documentation that shows you how to do that.

What the point of the dnx-mono package in NuGet?

When developing an ASP.NET 5 app, I can install the mono runtime into it via NuGet. For example, the latest to date dnx-mono.1.0.0.rc1-update1.
As far as I've tested, the thing is the actual runtime I'm installing on, for example, Linux via DNVM tool to run ASP.NET apps on it.
If I installed the package into a project, I can't then chose it in project properties, nor I can chose it when publishing into a folder - only Windows clr versions are available.
So what's the point of installing it right into the application project?
Or maybe it is not intended to be installed into a project, but exists solely for DNVM could find and pick it up?
You're right. It is used by DNVM and your application should never reference it directly.

How to build .sqlproj projects on a build server?

I have many .sqlproj projects that need to be built on our build server. I don't want to install all of Visual Studio on the build server just so I can install SSDT to build these. How can I build .sqlproj projects without a full VS install?
Here's the raw error I get on the build server when trying to build without SSDT intstalled:
C:\MyProject\MyProj.sqlproj (4): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Answer: Microsoft now has an official NuGet package (see blog post).
Old answer, prior to August 2016; provided in case the NuGet package doesn't work for you:
Install dacframework.msi (x86|x64)
Install SQLDOM.MSI (x86|x64)
Install SQLLS.MSI (x86|x64)
Install SQLSysClrTypes.msi (x86|x64)
Install SSDTBuildUtilities.msi (from the "Administrator Install Point" as setup in step 3 here)
Done!
Source: Headless MSBuild Support for SSDT (*.sqlproj) Projects.
Microsoft SQL Server Data Tools:
http://msdn.microsoft.com/en-us/data/hh297027
Install the tools on build machine to fix the problem.
The Microsoft SQL Server Data Tools team has released a NuGet package named Microsoft.Data.Tools.Msbuild, which helps to build SQL Projects on build servers.
see : https://blogs.msdn.microsoft.com/ssdt/2016/08/22/releasing-ssdt-with-visual-studio-15-preview-4-and-introducing-ssdt-msbuild-nuget-package/
NuGet package : https://www.nuget.org/packages/Microsoft.Data.Tools.Msbuild/
SSDT v12.0.50730.0 requires Visual Studio to be installed beforehand. I found the easiest solution was to install the bare minimum Visual Studio components which were downloaded from MSDN Subscriber downloads:
Visual Studio 2013 Isolated
Visual Studio 2013 Shell
Then SSDT installed fine.
I also used part of the solution outlined above.
* Install dacframework.msi
* Install SQLDOM.MSI
* Install SQLLS.MSI
* Install SQLSysClrTypes.msi
I use MSBuild 12.0 to perform the build which is also available as a separate download.
I was having the exact same issue building a SQL Server project on an Azure DevOps CI/CD pipeline. None of the pre-built build tasks would work for me.
Some answers mention a NuGet package, but I am not sure how can I use it, because SQL Server projects do not allow to install NuGet packages.
I solved this by avoiding to add a SQL Server project to the solution.
I achieved this by using an MSBuild SDK, capable of producing a SQL Server Data-Tier Application package (.dacpac) from the set of SQL scripts. By adding this second project to the solution, I managed to continue taking advantage of linking the project to a live database through SQL Server Object Explorer on Visual Studio. I gave a more detailed explanation about my implementation in this answer.

Resources