Questions tagged [dotnet-publish]

70 questions
17
votes
1 answer

error NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier

I am running following command to publish .NET CORE 5.0 web api project using command line on windows 10 box. c:\test\Service>dotnet publish -c release Emp.sln --framework net5.0 /p:DebugType=None /p:DebugSymbols=false --nologo --self-contained…
OpenStack
  • 5,048
  • 9
  • 34
  • 69
16
votes
3 answers

Could not load file or assembly Newtonsoft.Json when running app from the dotnet publish output folder

I am finding a problem with Newtonsoft.Json library throwing a System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file…
diegosasw
  • 13,734
  • 16
  • 95
  • 159
8
votes
1 answer

In ASP.NET Core 6, why language folders needed in Published output for System.Private.ServiceModel.resources.dll and how to eliminate them?

In ASP.NET Core 6 when publishing as a self contained win-x86 website a bunch of language folders are created in the publish folder. These folders contain a single dll which is System.Private.ServiceModel.resources.dll. These folders where not…
RonC
  • 31,330
  • 19
  • 94
  • 139
6
votes
2 answers

Dotnet publish looking for dependency in Debug directory instead of Release

I have a project Project.Api that references another project Project.DomainModel. When I build the API project for release by running dotnet restore && dotnet build -c Release It builds successfully. However, when I try to publish dotnet publish…
Sello Mkantjwa
  • 1,798
  • 1
  • 20
  • 36
4
votes
0 answers

Publish ASP.Net Core in a Windows Service with different environment

I have managed to successfully publish a ASP.Net Core application and run it as a service on my local machine. What I want to know is how do I publish for my different appsettings.{environment}.json? I have largely followed these docs for guidance…
Koobz866
  • 166
  • 1
  • 2
  • 17
4
votes
3 answers

"dotnet publish" command within dotnetcoresdk container produces EXE without Details

We are attempting to build a .NET core 3.1 app within a container, using dotnet publish, dotnet build or dotnet msbuild commands, with different parameters. Which succeeds, but the problem is that EXE output never shows any file Details (Copyright,…
DevOpsVR
  • 43
  • 6
4
votes
0 answers

dotnet publish cmd with profile not working

I'm trying to publish an aspnetcore 2.1 webapi application through cmd using an ftp profile. When I publish through vs2017, it works fine. But when I try to do it by command line it is not sent to the ftp server. It publishes in the…
3
votes
1 answer

Publishing a wpf application with WinExe is still opening a console host window

The publish is being done via docker. DockerFile FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build // restore ... // build .. // publish RUN dotnet publish --no-build -c Release /p:PublishSingleFile=true -r win-x64…
3
votes
2 answers

Different Newtonsoft.Json.dll dotnet publish vs publish with Visual Studio

I have a .NET Core Web Application with target framework .netcoreapp2.0. If i publish my application via Visual Studio (folder profile) I get a different Newtonsoft.Json.dll then with the command dotnet publish --configuration Release --output…
3
votes
0 answers

ASP.NET Core 3.1 app does not run on IIS when Target runtime is portable: assembly not found

I wrote a simple ASP.NET Core 3.1 Web app based on the Template in VS2019. Published the app to the file system targetting netcoreapp3.1 in Framework-Dependent deployment mode and targetting the portable runtime. The app works fine on my dev box…
Stephan Steiner
  • 1,043
  • 1
  • 9
  • 22
3
votes
1 answer

Dotnet publish copies appsettings*.json only for Asp.Net (but not Console)

I am running dotnet publish (via VS2019 GUI or a command, same result) on an ASP.Net project and on a Console project. It seems that behaviour differs. All appsettings*.json are being copied automatically in ASP.Net, but on console only if I set…
Ilya Chernomordik
  • 27,817
  • 27
  • 121
  • 207
3
votes
0 answers

Is this dotnet vstest equivalent to this dotnet test command?

I have build and published my .NET Core MsTest test library using this command: dotnet publish .\XunitTestLib\XunitTestLib.csproj -o Tester --self-contained -r win7-x64 /p:UseAppHost=true /p:RuntimeIdentifier=win7-x64 I usually run the project with…
Matt W
  • 11,753
  • 25
  • 118
  • 215
2
votes
0 answers

Prevent dotnet publish from marking dll files as executable on linux

When I run dotnet publish on linux, it stages the server dll as well as the dll files of dependencies. All are marked as executable. That makes no sense (might even be a bug?). So I use chmod -x *.dll in a post-publish task. Can I disable this…
lonix
  • 14,255
  • 23
  • 85
  • 176
2
votes
1 answer

IsPublishable is ignored in .NET 5 unit test projects

I have some .NET projects in a solution. When I publish them, I'd like to publish just the DLL of my src projects, not the test ones. Both https://github.com/dotnet/docs/issues/13365 and…
diegosasw
  • 13,734
  • 16
  • 95
  • 159
2
votes
0 answers

Steps sequence to deploy a .NET Core Worker Service into a Linux systemd service unit/daemon

This article offers a step-by-step guide to deploy a .NET Core Worker Service into a linux systemd service unit/daemon. Thanks to the author I successfully achieved the desired result. There is one thing, however, I am finding counter-intuitive in…
Veverke
  • 9,208
  • 4
  • 51
  • 95
1
2 3 4 5