I've been developing on one machine and recently tried to install my application on another PC. I think I've deduced to to the nuget packages not being found since in .NET Core, nuget puts the packages in the local 'Users' folder path.
I initially added the <RunTimeIdentifier>
tag to create an exe (which worked on my developer machine). When running the exe on a different machine, the console window will flash very quickly and application stops with no error output (even in Event Viewer).
I also added this tag <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest
in the *.csproj which did not make a difference.
So I tried running dotnet project.dll
which gave me this error on the other machine.
An assembly specified in the application dependencies manifest (project.deps.json) was not found:
package: 'Localization.AspNetCore.TagHelpers', version: '0.3.0'
path: 'lib/netstandard1.6.1/Localization.AspNetCore.TagHelpers.dll'
When I 'recreated' the folder structure, lo-and-behold, everything was working. Is there a way on compile/build that those packages are copied to the bin folder and paths reference those instead? Or am I building/compiling wrong?
Also note that thie project was updated from .NET Core 2.0 to 2.1.
The global-packages folder is where NuGet installs any downloaded package. Each package is fully expanded into a subfolder that matches the package identifier and version number. Projects using the PackageReference format always use packages directly from this folder.
Description. The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file.
By default, dotnet pack builds the project first. If you wish to avoid this behavior, pass the --no-build option. This option is often useful in Continuous Integration (CI) build scenarios where you know the code was previously built.
You don't have to run dotnet restore because it's run implicitly by all commands that require a restore to occur, such as dotnet new , dotnet build , dotnet run , dotnet test , dotnet publish , and dotnet pack . To disable implicit restore, use the --no-restore option.
It sounds like you want a self-contained deployment. That is what dotnet publish --self-contained --runtime <some-runtime>
outputs to the publish
directory.
Lets say we have an app at C:\temp\temp.csproj
, and we want to publish it to two target platforms.
If we publish like this...
dotnet publish --self-contained --runtime win-x86
... the self-contained executable will be here:
C:\dev\temp\bin\Debug\netcoreapp2.1\win-x86\publish\temp.exe
If we publish like this...
dotnet publish --self-contained --runtime ubuntu-x64
... the self-contained executable will be here:
C:\dev\temp\bin\Debug\netcoreapp2.1\ubuntu-x64\publish\temp
If we then copy the entire publish
directory to the destination computer, we can execute the temp
executable, because all of its dependencies are present.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With