Geta / geta-notfoundhandler

The popular NotFound handler for ASP.NET Core and Optimizely, enabling better control over your 404 page in addition to allowing redirects for old URLs that no longer works.
Apache License 2.0
20 stars 16 forks source link

Modules folder to copied to output #11

Closed Dandroid5000 closed 2 years ago

Dandroid5000 commented 2 years ago

Hi,

I'm having an issue wherein the ContentFiles for the package are not getting published.

I've noticed that the nuspec file for this package does not direct the 'ContentFiles' (modules/_protected/Geta.NotFoundHandler.Optimizely/module.config) to be included in the output (i.e. 'copyToOutput' is not declared). Could this be the issue?

Thanks

Dan

marisks commented 2 years ago

Aren't those copied after the build? Do you see modules/_protected/Geta.NotFoundHandler.Optimizely/ folder in the VS/Rider? Also, is there module.config as a shortcut in this folder?

Dandroid5000 commented 2 years ago

Hi marisks,

Thanks for getting back to me. In answer to your questions:

Aren't those copied after the build? -> No Do you see modules/_protected/Geta.NotFoundHandler.Optimizely/ folder in the VS/Rider? -> Yes Also, is there module.config as a shortcut in this folder? -> Yes

It's all there. It just isn't getting copied after build.

Note, if I manually edit the ContentFiles line in the nuspec file in my local nuget cache to include 'copyToOutput = true', it works.

Cheers

Dan

marisks commented 2 years ago

That's strange we have a post-build action that copies the files. It is the same as in Optimizely (Episerver) packages. But it is strange that it works with 'copyToOutput = true' as it means that files should be copied to the build folder (bin), not a solution.

marisks commented 2 years ago

@Dandroid5000 Is your project .NET 5 or .NET 6?

Dandroid5000 commented 2 years ago

Hi @marisks

I'm not sure why you think it's strange that files should be copied to the build folder (bin), that's exactly what I'm expecting. Sorry if I'm missing something here.

My understanding would be that the nuget restore/install would copy the Content Files into the solution and then, if they are required at runtime, a build/publish would copy them to the output directory.

From what I can see, all the other required Content Files included in other Optimizely (Episerver) packages specify 'copyToOutput = true'.

For example: image

Thanks again for you help

btw I'm on .NET 5

marisks commented 2 years ago

@Dandroid5000 Thanks! I will update the project and publish new packages today/tomorrow.

P.S. It is strange that packages work for some and not for others. My guess was that it is .NET 5 vs .NET 6 as the post-build action points to .NET 5 path.

Dandroid5000 commented 2 years ago

Thanks so much @marisks . This is working as expect now. Cheers Dan