Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.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
C# Windows批处理文件,将文件夹中的所有DLL部署到GAC_C#_Asp.net_Batch File_Post Build - Fatal编程技术网

C# Windows批处理文件,将文件夹中的所有DLL部署到GAC

C# Windows批处理文件,将文件夹中的所有DLL部署到GAC,c#,asp.net,batch-file,post-build,C#,Asp.net,Batch File,Post Build,我正在一个ASP.NET项目中工作,我在一个文件夹中创建了一堆DLL。我需要写一个cmd或bat文件来获取该文件夹中的所有DLL并将其删除。那么,如何循环一个文件夹中的所有dll呢?这就是我用来部署给定文件夹中所有sql文件的方法,如果需要,您可以调整它以作用于dll文件 @echo off SET dbodir=../Schema Objects/Schemas/dbo/Programmability/Stored Procedures/ SET tpmdir=../Schema Objec

我正在一个ASP.NET项目中工作,我在一个文件夹中创建了一堆DLL。我需要写一个cmd或bat文件来获取该文件夹中的所有DLL并将其删除。那么,如何循环一个文件夹中的所有dll呢?

这就是我用来部署给定文件夹中所有sql文件的方法,如果需要,您可以调整它以作用于dll文件

@echo off

SET dbodir=../Schema Objects/Schemas/dbo/Programmability/Stored Procedures/
SET tpmdir=../Schema Objects/Schemas/TPM/Programmability/Stored Procedures/

echo --- Starting dbo schema

for %%f in ("%dbodir%*.sql") do (echo Running %%f.... && @sqlcmd -U %1 -P %2 -S %3 -d %4 -i "%dbodir%%%f")

echo --- Completed dbo schema

echo --- Starting TPM schema

for %%g in ("%tpmdir%*.sql") do (echo Running %%g.... && @sqlcmd -U %1 -P %2 -S %3 -d %4 -i "%tpmdir%%%g")

echo --- Completed TPM schema

pause

如果有人在寻找powershell的方法

[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish       

$dlls = Get-ChildItem -Path C:\Code\Application\ -Filter *dll -Recurse -ErrorAction SilentlyContinue -Force  | %{$_.FullName}

 foreach ($dll in $dlls) {
   $publish.GacInstall($dll)
 }

对循环使用
。运行
获取/?
获取所有血淋淋的详细信息。没有问题。我首先从stackoverflow那里得到了答案:)