Nuget Package with AutomaticMigrationPlan failing to get embedded package.xml file
I recently tried to create a Nuget package which had the sole purpose of creating some doctypes on the target installation. For testing purposes, I created a "dummy" doctype without any dependencies in an existing Umbraco setup, got the package.xml file and went on to create an automatic package migration as described here: https://our.umbraco.com/Documentation/Extending/Packages/Creating-a-Package/
When I try to install the package on a new Umbraco site, though, I get the message "Missing embedded files for planType:" - I made sure I had included the package.xml file as an embedded resource, and also made a zip and added that as well. I can't make it work.
I even switched to a custom migration - this time it was set up, but during running the new Umbraco site I got an "object reference not set to an instance of an object". Again, it seemed like it couldn't find the embedded resource.
What am I missing? I have seen others doing the same (searched for code on GitHub) in exactly the same way. Must be something extremely silly!
Answering my own question here since I've probably spotted what is wrong:
I was trying to set up the package together with installing a new umbraco instance, i.e.
dotnet new umbraco -n somename -p mypackageid
But this would cause issues. Reason unknown.
When I set up the package in a private feed and set it up on an existing Umbraco installation from the command line (dotnet add package) everything went smoothly.
So setting up a package together with an Umbraco installation probably has some issues when the package has migrations? Can't find any other explanation.
I just came across the same issue when trying to do:
dotnet new umbraco -n ProjectXYZ -p PRPackageXYZ
I debugged it and it seems like the issue (for me, anyway) is that it is expecting a package.zip, but I only had a package.xml file because I didn't have any content or media etc, just a doctype and composition.
I got around it by:
Changing it to a package.zip in the package project
Making that the embedded resource
Repacking the package
The issue seems to be in ..\Umbraco.Core\Packaging\PackageMigrationResource.cs line 31 GetEmbeddedPackageZipStream method.
Nuget Package with AutomaticMigrationPlan failing to get embedded package.xml file
I recently tried to create a Nuget package which had the sole purpose of creating some doctypes on the target installation. For testing purposes, I created a "dummy" doctype without any dependencies in an existing Umbraco setup, got the package.xml file and went on to create an automatic package migration as described here: https://our.umbraco.com/Documentation/Extending/Packages/Creating-a-Package/
When I try to install the package on a new Umbraco site, though, I get the message "Missing embedded files for planType:" - I made sure I had included the package.xml file as an embedded resource, and also made a zip and added that as well. I can't make it work.
I even switched to a custom migration - this time it was set up, but during running the new Umbraco site I got an "object reference not set to an instance of an object". Again, it seemed like it couldn't find the embedded resource.
What am I missing? I have seen others doing the same (searched for code on GitHub) in exactly the same way. Must be something extremely silly!
Answering my own question here since I've probably spotted what is wrong:
I was trying to set up the package together with installing a new umbraco instance, i.e.
But this would cause issues. Reason unknown.
When I set up the package in a private feed and set it up on an existing Umbraco installation from the command line (dotnet add package) everything went smoothly.
So setting up a package together with an Umbraco installation probably has some issues when the package has migrations? Can't find any other explanation.
Hi,
I just came across the same issue when trying to do:
dotnet new umbraco -n ProjectXYZ -p PRPackageXYZ
I debugged it and it seems like the issue (for me, anyway) is that it is expecting a package.zip, but I only had a package.xml file because I didn't have any content or media etc, just a doctype and composition.
I got around it by:
The issue seems to be in
..\Umbraco.Core\Packaging\PackageMigrationResource.cs
line 31GetEmbeddedPackageZipStream
method.It turns out there is an existing issue that I think covers this at https://github.com/umbraco/Umbraco-CMS/issues/12125
Thanks for sharing the post
Emma
I was able to solve it with only changing the build action of the
package.xml
. I set it to Embedded resource and I didn't get the exception anymore.is working on a reply...