Missing package after publishing and moving site t...
# help-with-umbraco
m
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
s
The dll is not in the correct folder it seems..
You did a
dotnet publish
and moved the resulting files over yeah?
m
so in my local dev it's located at d:\dotnet\draglobal.com but on uat it's under a different directory
yes
yes
it seems that some path is set somewhere for my dev machine, the library is definately in the directory I can see it
s
check if the output runs on your local machine
m
is there a better way to perform the upgrade (it's only an upgrade from 11 > 12)
yeah local machine works perfectly
s
you're seeing local paths because that's where the build happened, that's normal 🙂
m
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
s
A better way than..? Nuget update is how it's done 🙂
I understand, that's a steep learning curve!
m
so 1) local dev nuget upgrade done 2) dotnet publish 3) move files to the final destination (overriding the existing files)
s
I don't know, if v11 ran on the server than 12 should too..
m
but now for some reason the path where it's looking for the package seems to reference the build path
s
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!
m
yeah net 7 is working, both uat and prod runs v11 on dotnet7
s
The file should be in the root of the output directory where you told
dotnet publish
to put it
m
sorry here is the output
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
s
12.0.1 shouldn't make a difference 😅
dotnet publish -c Release -o .\publish
is what I use to produce that output.
m
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?
s
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.
m
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.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
s
well.. is there a wwwroot folder in the build output (hint: there should be)
m
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
s
Yeah again, it's the paths of the machine it was compiled on, not where it's copied to 🙂
m
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
s
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. 🙂
m
alright
im going to replicate it to see if that works
s
You don't need to.. It seems like wwwroot is not a folder on the server?
m
but it is
the screenshot above is from the actual uat server
so the wwwroot is def there
s
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?
m
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
s
sure! it'll be localhost:5000 by default I think
m
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.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?
s
I think try to get the properties of that
draglobal.com
directory and on the security tab, make sure that the worker process user has all the access it needs, think full control is probably fine
nobody would do that no 🙂 if you mean
dotnet publish
You'll need to know which user is used for the identity of the application pool in IIS
I haven't managed an IIS server for many years, so I can't remember exactly but it seems
IIS_IUSRS
is the user group to give permissions to if it's set to
ApplicationPoolIdentity