#Missing package after publishing and moving site to uat server (umbraco 12 upgrade via nuget)

1 messages Β· Page 1 of 1 (latest)

midnight crown
#

I've upgraded to Umbraco12 using nuget, then published the project and moved it to the uat server. I effectively replaced all of the files from the published directory and replaced the uat site with the files. the UAT site does not want start up, hinting a missing library: Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL'. The system cannot find the file specified. - I now had a look and at the bottom of the error it seems to reference a path in my local dev directory

shut socket
#

The dll is not in the correct folder it seems..

#

You did a dotnet publish and moved the resulting files over yeah?

midnight crown
#

so in my local dev it's located at d:\dotnet\draglobal.com but on uat it's under a different directory

#

yes

midnight crown
#

it seems that some path is set somewhere for my dev machine, the library is definately in the directory I can see it

shut socket
#

check if the output runs on your local machine

midnight crown
#

is there a better way to perform the upgrade (it's only an upgrade from 11 > 12)

#

yeah local machine works perfectly

shut socket
#

you're seeing local paths because that's where the build happened, that's normal πŸ™‚

midnight crown
#

ahhh

#

(sorry i'm a php dev and adopted this but boy! what a learning curve)

#

I had to upgrade all the way from 7 so had to learn quite a bit

shut socket
#

A better way than..? Nuget update is how it's done πŸ™‚

#

I understand, that's a steep learning curve!

midnight crown
#

so 1) local dev nuget upgrade done 2) dotnet publish 3) move files to the final destination (overriding the existing files)

shut socket
#

I don't know, if v11 ran on the server than 12 should too..

midnight crown
#

but now for some reason the path where it's looking for the package seems to reference the build path

shut socket
#

oh the .net version might have changed, but that was from v10 to 11. Make sure .NET 7 is installed on the server, you'll need that!

midnight crown
#

yeah net 7 is working, both uat and prod runs v11 on dotnet7

shut socket
#

The file should be in the root of the output directory where you told dotnet publish to put it

midnight crown
#

of the actual error

#

there are 3, but at the bottom of the file you will see it seems to reference my local machine

#

my runtimes look different than yours

#

mind is located in the root of the "publish" directory, not in runtimes, going to move it quickly and see

#

so if I look at the event viewer one of the 3 errors (all referencing the same library):

#

at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilder.AddCoreServices()
at Umbraco.Cms.Core.DependencyInjection.UmbracoBuilder..ctor(IServiceCollection services, IConfiguration config, TypeLoader typeLoader, ILoggerFactory loggerFactory, IProfiler profiler, AppCaches appCaches, IHostingEnvironment hostingEnvironment)
at Umbraco.Extensions.UmbracoBuilderExtensions.AddUmbraco(IServiceCollection services, IWebHostEnvironment webHostEnvironment, IConfiguration config)
at draglobal.com.Startup.ConfigureServices(IServiceCollection services) in D:\dotnet\draglobal.com\Startup.cs:line 32

#

the D:\dotnet\draglobal.com part is the incorrect path

#

and when I publish it's simply "dotnet publish"

#

I see 12.0.1 is out, im going to nuget update and do another publish

shut socket
#

12.0.1 shouldn't make a difference πŸ˜…

dotnet publish -c Release -o .\publish is what I use to produce that output.

midnight crown
#

let me give it a shot

#

Upgraded to 12.0.1 and I had unattended upgrade enabled

#

Used your command to publish, I see the new release path is different, my previous was under debug\publish

#

I can then simply override the previous files with the new published files?

shut socket
#

yes, just my way of being able to find the files better, the .\publish in that command is the directory where the files get published β˜‘οΈ

Yes, I would stop the site, delete all file and put the new files in there if I had to do it manually.

midnight crown
#

So now the error is different, but it's still referencing my old path

#

Application: w3wp.exe
CoreCLR Version: 7.0.523.17405
.NET Version: 7.0.5
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.DirectoryNotFoundException: D:\dotnet\draglobal.com\wwwroot
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__1_0(String contentRoot)
at Microsoft.AspNetCore.StaticWebAssets.ManifestStaticWebAssetFileProvider..ctor(StaticWebAssetManifest manifest, Func`2 fileProviderFactory)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
at Microsoft.Extensions.Hosting.HostBuilder.InitializeAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Umbraco.Cms.Web.Common.Hosting.UmbracoHostBuilderDecorator.Build()
at draglobal.com.Program.Main(String[] args) in D:\dotnet\draglobal.com\Program.cs:line 7

shut socket
#

well.. is there a wwwroot folder in the build output (hint: there should be)

midnight crown
#

yup there it is

#

what is strange is that once I moved it to the new server, when I restart the site I would expect it should not referencing anything from d:\dotnet as that is on a complete different machine

#

server is on c:\Documents\UAT\draglobal.com whereas my local machine is d:\dotnet\draglobal.com

#

So it seems that somewhere my absolute path is used

#

maybe i dont understand how the publishing is intended on working

#

like this part of the error: at draglobal.com.Program.Main(String[] args) in D:\dotnet\draglobal.com\Program.cs:line 7

#

that's from the event viewer on the actual uat server, so I cannot understand why my source base seems to be stuck on my old environment

shut socket
#

Yeah again, it's the paths of the machine it was compiled on, not where it's copied to πŸ™‚

midnight crown
#

how do I then overcome this issue?

#

I cannot set the path on my dev machine to be the path of the uat machine as it's 2 different machines

shut socket
#

You can prove this, move the project to a different path, dotnet publish, copy files to server, see the different path from your local machine. πŸ™‚

midnight crown
#

alright

#

im going to replicate it to see if that works

shut socket
#

You don't need to.. It seems like wwwroot is not a folder on the server?

midnight crown
#

but it is

#

the screenshot above is from the actual uat server

#

so the wwwroot is def there

shut socket
#

Maybe I have it completely wrong though, and you have it right.. but.. there's no way we or you are hardcoding this path.

#

Permissions? The server is not allowed to see the directory?

midnight crown
#

can I run dotnet from cli on the published site?

#

maybe there are old files that's causing it, but I have overwritten all files though

shut socket
midnight crown
#

even if I run the draglobal.com.exe file (on the UAT server), it still references a path that is non-existant on that UAT server:

#

nhandled exception. System.IO.DirectoryNotFoundException: D:\dotnet\draglobal.com\wwwroot
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__1_0(String contentRoot)
at Microsoft.AspNetCore.StaticWebAssets.ManifestStaticWebAssetFileProvider..ctor(StaticWebAssetManifest manifest, Func`2 fileProviderFactory)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest)
at Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration)
at Microsoft.Extensions.Hosting.HostBuilder.InitializeAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Umbraco.Cms.Web.Common.Hosting.UmbracoHostBuilderDecorator.Build()
at draglobal.com.Program.Main(String[] args) in D:\dotnet\draglobal.com\Program.cs:line 7

#

so let me ask this, must I publish on the same server the site is hosted?

shut socket
shut socket
#

You'll need to know which user is used for the identity of the application pool in IIS