Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2012 排除NuGet中某一类型的所有文件_Visual Studio 2012_Nuget_Nuget Package - Fatal编程技术网

Visual studio 2012 排除NuGet中某一类型的所有文件

Visual studio 2012 排除NuGet中某一类型的所有文件,visual-studio-2012,nuget,nuget-package,Visual Studio 2012,Nuget,Nuget Package,问题:我的Visual Studio项目中有.sql文件,我想从NuGet包中排除这些文件。这些.sql文件嵌套在不同的目录中,我无法成功地从我的nuget包中排除所有.sql文件 1:我通过在目标项目上运行以下命令创建了一个.nuspec文件: nuget spec 2:我编辑了生成的nuspec文件,使其看起来像这样: <?xml version="1.0"?> <package > <metadata> <id>$id$<

问题:我的Visual Studio项目中有.sql文件,我想从NuGet包中排除这些文件。这些.sql文件嵌套在不同的目录中,我无法成功地从我的nuget包中排除所有.sql文件


1:我通过在目标项目上运行以下命令创建了一个.nuspec文件:

nuget spec
2:我编辑了生成的nuspec文件,使其看起来像这样:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Security Core Impl</description>
    <releaseNotes>Security Core Impl</releaseNotes>
    <copyright>Copyright 2013</copyright>
    <tags>Security Core</tags>
  </metadata>
  <files>
    <file src="**\*.dll" target="lib\net40\" exclude="**\*.sql;" />
  </files>
</package>

但是,每当我将这个包安装到另一个项目中时,就会包含.sql文件。我尝试了上面排除的几种不同变体,并尝试了-exclude开关。似乎什么都不管用

所有.sql文件都标记为:

  • 构建操作:无
  • 复制到输出目录:不复制
我还尝试通过VisualStudio选项清除NuGet缓存


注意:NuGet软件包托管在一台专用服务器上。

我假设您的*.sql文件位于软件包的
内容
文件夹下

告诉NuGet在lib\net40下添加所有.DLL文件。SQL文件被忽略,因为您的include没有包含它们


你能尝试将
添加到nuspec中吗?

我刚刚遇到了完全相同的问题,但是有.txt文件。一位同事指出的解决方案是将构建操作从“内容”更改为“无”。

您是否尝试在没有nuspec的情况下执行此操作?我的意思是删除生成的nuspec并执行
nuget pack myproj.csproj-Exclude**.sql-Prop Configuration=Release
您打算在.sql后面加一个分号吗?这对我来说很有效
(facepalm)我仍然很好奇,为什么OP(和我)无法让exclude工作,但感谢这一点。添加会导致错误:NotSpecified:(缺少必需的属性“src”。:String)
nuget pack -Prop Configuration=Release