0

I have a sln that has an identity provider web app, and a blazor assembly. To publish I use this line:

dotnet publish MyApi.sln -c Release -o C:\My\Publish --self-contained false

This will publish MyApi but it never publishes the identity provider. On top of that I have had to add all dlls as project references to MyApi so they will all be published. The sln is setup to have all the dependencies it needs. I do not understand why publish does not honor what is there. It does not even copy a directory and its contents that are created as a build post event. How can I get everything in the sln and things built by post build into the publish directory?

I also discovered that the all of the dependencies for the identity provider are missing.

Is there someway to just get the Release build to be deployable without needing to publish?

Update

This is the project structure

Project Structure

There are two web aps Gt.IDP (identity provider) and Gt.WebApi which is a blazor webassembly and api. Both depend on the common libraries: GtData, GtBase, GtResources etc. GtData has a post build event that creates two directories x86 and x64 and copies an x86 and x64 library to each directory.

Both Gt.IDP and Gt.WebApi have the error:

Found multiple publish output files with the same relative path for the library versions copied to x86 and x64.

When doing a normal build this is not flagged, yet with publish it is. In the publish there is no Gt.IDP.exe or Gt.WebApi.exe not sure why that is. I am not worried about AOT that publish can produce. I just want what is in my Release directory and whatever files are added by publish to allow me to host the exe as windows services.

Update 1

I used the answer here to get rid of the error with multiple files, but again isn't this coming from publish doing too much. Then Gt.IDP.exe was created, however Gt.WebApi.Server.exe is not created. Plus the directories x86 and x64 and their content are not copied.

Update 2

I put false, for PublishTrimmed, in the blazor server and client projects to remove another error.

Then I used the command line publish

dotnet publish GtWebApi.sln -c Release -o C:\Repository\Gt\Publish --self-contained false -r win-x64

But this runs into the error self-contained false cannot be specified with runtime which I thought was fixed with net 7.

Then using:

dotnet publish GtWebApi.sln -c Release -o C:\Repository\Gt\Publish -r win-x64

This publishes the identity provider, but not the blazor webassembly, and makes it self contained which we don't want.

I went back and tried the publish from vs 2022 17.6.3 and it publishes the web api but not the identity provider. It publishes everything needed and is not self contained, but it does not push the directories x86 and x 64. Why does publish just publish everything in the sln.

dgxhubbard
  • 703
  • 2
  • 7
  • 18
  • I no longer develop under VS but back in the time what I did was to create a setup project, which includes all the dependencies you might have for your executable to run. – RudyMartin Jun 29 '23 at 17:48
  • Part of build process creates the release build which is everything we need to build. Another part of build process creates the setup. – dgxhubbard Jun 29 '23 at 18:20
  • the Setup Project I was referring to can create a MSI installer (at least in VS2008 which was the latest version I used, idk what came after that), which contains all the files needed to install your main project into another computer I suggest to experiment a bit creating a setup project in your solution – RudyMartin Jun 29 '23 at 18:42

1 Answers1

0

Check if the particular project is set to "Build" at the solution level. Right click on the solution file -> Properties and make sure that the "Build" checkbox for the project is checked (don't forget about setting proper configuration).

In Rider it looks like this: enter image description here But in VS it's almost the same.

You can also edit the *.sln file directly adding the configuration line to the ProjectConfigurationPlatforms section like this:

{<PROJECT GUID>}.Release|Any CPU.Build.0 = Release|Any CPU
Posio
  • 962
  • 4
  • 15
  • In Configuration Manager all project builds are checked. There is a deploy option but these are disabled – dgxhubbard Jun 29 '23 at 18:36
  • try to add a `-v detailed` to the command. You should be able to find the reason why the project has been skipped from the publication. Could you please give me more details about how the solution structure look like ? Projects with it's types ? – Posio Jun 29 '23 at 18:43