简体   繁体   English

从项目文件添加Nuget包转换

[英]Adding Nuget Package Transformations from project file

I am trying to add Nuget Package transformations which I want to create from project file. 我正在尝试添加要从项目文件创建的Nuget包转换。

I tried few things like creating a content folder and adding it to my project as explained in https://docs.nuget.org/create/transforming-configuration-files-using-dottransform-files but was not able to add keys to project config files after package installation. 我尝试了一些操作,例如创建内容文件夹并将其添加到我的项目中,如https://docs.nuget.org/create/transforming-configuration-files-using-dottransform-files中所述,但无法为项目添加键软件包安装后的配置文件。

Workaround it to create a folder structure as explained in the above url. 解决该问题,以创建上述网址中说明的文件夹结构。 So I created a folders like content for transform files, lib for dlls/assemblies and it is working. 因此,我创建了一个文件夹,例如用于转换文件的内容,用于dll /程序集的lib,并且该文件夹正在运行。 But I think that this is more manual process. 但是我认为这是更手动的过程。

Is there a way to create nuget package transformations using project file? 有没有一种方法可以使用项目文件创建nuget包转换?

Just add to your root files for transformations like: 只需将其添加到根文件中即可进行转换,例如:

  1. web.config.transform web.config.transform
  2. web.Release.config.transform web.Release.config.transform
  3. web.Debug.config.transform web.Debug.config.transform

On update NuGet (from 2.6 version) will automatically transform your config files. 更新后,NuGet(2.6版本)将自动转换您的配置文件。 You can even add XSD schema transformations. 您甚至可以添加XSD模式转换。

Do not forget to mark *.transform files as Content and Do not copy in file properties. 不要忘记将* .transform文件标记为“ 内容”,并且不要在文件属性中进行复制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在没有Visual Studio的项目中添加NuGet包 - Adding a NuGet package to a project without Visual Studio 为什么NuGet包管理器从项目文件中删除了SpecificVersion False - Why is the NuGet Package Manager removing SpecificVersion False from the project file Nuget软件包安装未向项目添加引用 - Nuget Package Installation is Not Adding References To Project Nuget软件包,可将文件放入项目目录,但不放入项目 - Nuget package that puts a file into the project directory but not into the project 将 Nuget 包从一个项目添加到另一个项目 - Adding Nuget Packages From One Project To Another 添加 FacebookWebMvc Nuget Package 后编译 MVC 3 项目时出错 - Error compiling MVC 3 project after adding FacebookWebMvc Nuget Package 将 nuget package 内容文件(类型为.exe)复制到使用该 nuget package 的项目的 output 目录 - Copy nuget package content file (of type .exe) to output directory of project using that nuget package 在不使用Visual Studio的情况下将nuget包添加到项目文件中 - Add nuget package into project file without Visual Studio Nuget包将exe内容文件复制到项目输出目录 - Nuget package to copy exe content file to project output directory 在 NuGet 包中包含一个文件夹,并将其作为文件 .netcore/Razor 安装到项目中 - Including a Folder in NuGet Package and have it install into project as file .netcore/Razor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM