C# 将数据从解决方案发送到Nuget包

C# 将数据从解决方案发送到Nuget包,c#,nuget,C#,Nuget,我读了很多关于这个问题的帖子,但是每个解决方案/描述都不适合我的具体问题 在我的WPF项目中,我使用了一个由我实现的Nuget包 现在我想在我的Nuget包中设置一些需要的配置。为了简化问题,让我们假设一个文件的路径 我当前的解决方案是,使用我的nuget包的项目必须创建一个nuget.config文件,并将其“Copy to output Directry”属性设置为“Copy always”。因此,在发布编译后的项目时,存在一个现有的nuget.config nuget.config如下所示

我读了很多关于这个问题的帖子,但是每个解决方案/描述都不适合我的具体问题

在我的WPF项目中,我使用了一个由我实现的Nuget包

现在我想在我的Nuget包中设置一些需要的配置。为了简化问题,让我们假设一个文件的路径

我当前的解决方案是,使用我的nuget包的项目必须创建一个nuget.config文件,并将其“Copy to output Directry”属性设置为“Copy always”。因此,在发布编译后的项目时,存在一个现有的nuget.config

nuget.config如下所示:

<configuration>
    <packageSources>
        <add key="myPath" value="/some/path" />
    </packageSources>
</configuration>
var settings = Settings.LoadDefaultSettings(Directory.GetCurrentDirectory()); // bin/Debug directory
var paths = settings.GetConfigFilePaths();

// Somehow filter out the global configs
// ...

// Load the nuget.config from the bin/Debug directory
var setting = Settings.LoadSpecificSettings(myNugetConfigFile);
var packageSourceProvider = new PackageSourceProvider(setting);

// Go throw the complete configurationa and search sections by their name
我越是朝这个方向努力,我就越觉得这很奇怪,因为这需要很多曼纽尔的工作。 这种方法真的是微软想要解决这个问题的方法,还是有一种更干净的方法来解决这个问题