开发者

Issue with transformation files in a nuget package

开发者 https://www.devze.com 2023-02-13 00:17 出处:网络
I am creating nuget packages for OSGeo.FDO and I am having the following issue. FDO uses a providers.xml file that lists all the providers it can use. So I created a main package called OSGeo.FDO con

I am creating nuget packages for OSGeo.FDO and I am having the following issue.

FDO uses a providers.xml file that lists all the providers it can use. So I created a main package called OSGeo.FDO containing the following:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<FeatureProviderRegistry/>

And then, I am creating a nuget package for each provider. In each one of them I include a providers.xml.transform with, for example, the following:

<FeatureProviderRegistry>
   <FeatureProvider>
      <Name>OSGeo.PostgreSQL.3.6</Name>
      <DisplayName>OSGeo FDO Provider for PostgreSQL/PostGIS</DisplayName>
      <Description>Read/write access to PostgreSQL/PostGIS-based data store. Supports spatial data types and spatial query operations.</Description>
      <IsManaged>False</IsManaged>
      <Version>3.6.0.4707</Version>
      <FeatureDataObjectsVersion>3.6.0.4707</FeatureDataObjectsVersion>
      <LibraryPath>.\PostgreSQLProvider.dll</LibraryPath>
   </FeatureProvider>
</FeatureProviderRegistry>

When I install only one provider package, it works as expected, but once I install another one, it just doesn't change the providers.xml file at all. Although it tells me it has been modified and visual studio asks me if 开发者_如何学GoI want to reload it. I say I do, but it doesn't add anything to it.

Is there something wrong with what I'm doing?


The NuGet XML transform can be a little quirky. The way you can make this work if the schema allows it is to make each tag unique by adding an attribute. e.g. if you had

<FeatureProviderRegistry>
   <FeatureProvider name="OSGeo.PostgreSQL.3.6">
       etc...
   </FeatureProvider>
</FeatureProviderRegistry>

And then

<FeatureProviderRegistry>
   <FeatureProvider name="Other Name">
       etc...
   </FeatureProvider>
</FeatureProviderRegistry>

Then it should do what you want. I realize that this may not be the way you want your XML schema, but if you can do that, it can be a workaround.

0

精彩评论

暂无评论...
验证码 换一张
取 消