Aklımda Kalası Kelimeler

* давайте работать вместе
* Zarf ve Mazruf, Zerafet(xHoyratlık) ile aynı kökten(za-ra-fe) gelir
* Bedesten
* Suç subuta ermiştir - Suç sabit olmuştur
ILMerge etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
ILMerge etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

2 Ağustos 2011 Salı

Bir web servisinin çekilerek cs'inin oluşturulması ve ardından dll'e çevirilmesi.

Output tabına pek bakmayız ama ben bir bakayım dedim ve şunları gördüm:
------ Build started: Project: C:\...\WebSite4\, Configuration: Debug Any CPU ------
Validating Web Site
Building directory '/WebSite4/'.

C:\Users\Administrator\Documents\Visual Studio 2008\WebSites\WebSite4\WebUserControl2.ascx.cs(7,7): error CS0246: The type or namespace name 'FMCTR' could not be found (are you missing a using directive or an assembly reference?)
Validation Complete
------ Build started: Project: CinsiyetOranlari, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:"..\..\GoogleChartAPI\trunk\bin\Debug\FMC.Google.Chart.dll" /reference:"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /keyfile:Properties\CinsiyetOranlari.snk /optimize- /out:obj\Debug\CinsiyetOranlari.dll /target:library "Properties\AssemblyInfo.cs" CinsiyetOranlari\CinsiyetOranlari.cs Properties\Settings.Designer.cs "Web References\CinsiyetDagilimi\Reference.cs"
D:\Projeler\FMC.FMedula.Rapor.WebPart\CinsiyetOranlari\CinsiyetOranlari\CinsiyetOranlari.cs(97,30): warning CS0168: The variable 'ex' is declared but never used

Compile complete -- 0 errors, 1 warnings
CinsiyetOranlari -> D:\Projeler\FMC.FMedula.Rapor.WebPart\CinsiyetOranlari\bin\Debug\CinsiyetOranlari.dll
========== Build: 1 succeeded or up-to-date, 1 failed, 0 skipped ==========


error CS1668 : Warning as error : Invalid search path 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib' specified in 'LIB 
environment variable' -- 'The system cannot find the path specified. '
Hatası oluştuğunda C:\Program Files\Microsoft SDKs\Windows\v6.0A klasörüne boş bir lib dosyası oluşturmak yeterli.
ref:frazzleddad.blogspot.com

Bir sınıfı DLL'e çevirmek


Özetle Kodu:
csc /t:library /out:MyCodeLibrary.dll /recurse:*.cs /doc:myDoc.xml /keyfile:C:\MyKeyPair\myKeypair.snk

Kaynaklar:
MSDN
www.akadia.com
misc.feedfury.com
http://www.lcbridge.nl/vision/publickeytoken.htm

Bu DLL'i GAC'a yüklemek için


Ref: Gacutil.exe (Global Assembly Cache Tool)
c:\>gacutil.exe -if c:\temp\servis.dll



cls
echo Web Servisinden bir SINIF olusturuluyor:
@SET WSDL="c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\wsdl.exe"

%WSDL% /language:cs /out:c:\temp\servis.cs http://localhost:85/raporws/hastaraporlari.asmx?WSDL



echo Bu SINIFI strongly name type haline getirmek icin .snk dosyasi olusturuluyor:
@SET SN="c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\sn.exe"

%SN% -k c:\temp\servis.snk




echo Bu SNK dosyasiyla SINIF hem DLL, hemde PublicKeyToken sahibi oluyor:
@SET CSC="c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe"

%CSC% /target:library /out:c:\temp\servis.dll c:\temp\servis.cs /keyfile:C:\temp\servis.snk



echo DLL imizi GAC a yukluyoruz:
@SET GACUTIL="c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe"

%GACUTIL% -if c:\temp\servis.dll


Birazda bu kaynaklara bakılabilir:
Essential Batch File Commands

GAC içindeki assembly hakkında bilgi almak


C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64>gacutil.exe /l deneme.dll
Microsoft (R) .NET Global Assembly Cache Utility. Version 3.5.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.

The Global Assembly Cache contains the following assemblies:
deneme, Version=0.0.0.0, Culture=neutral, PublicKeyToken=2894795580ed377b,
cessorArchitecture=MSIL

Number of items = 1

ASMX Servisleri otomatik olarak DLL'e çeviren ve STRONGLY NAMED TYPE'a çeviren ve GAC'a yükleyen


cls
@echo off

@SET folder=D:\Projeler\FMCTR.WebServices\FMCTR.FMedula.Rapor.WS\dllOlusturGonder\
@SET serviceFolder=D:\Projeler\FMCTR.WebServices\FMCTR.FMedula.Rapor.WS\
@SET outputDLL=toplu.dll
@SET hostName=http://localhost:1866/

@SET asmxAdresi=HastaRaporlari
@SET dosyaAdi=%asmxAdresi%

@SET asmxFiles=(HastaRaporlari Yardimci)

rem for %%a in %asmxFiles% do (
for %%a in (%serviceFolder%*.asmx) do (
echo off
call :MakeCS %%a
)
goto end


:MakeCS
@SET WSDL="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\wsdl.exe"
%WSDL% /language:cs /out:%folder%%1.cs %hostName%%1.asmx?WSDL 

call :CreateSNK %1
goto end


:CreateSNK
@SET SN="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sn.exe"
%SN% -k %folder%%1.snk

call :MakeDLL %1
goto end

:MakeDLL
@echo %1  
@SET CSC="C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe"
%CSC% /target:library /out:%folder%%1.dll %folder%%1.cs /keyfile:%folder%%1.snk

call :LoadGAC %1
goto end


:LoadGAC
echo on
@SET GACUTIL="C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\gacutil.exe"
%GACUTIL% -if %folder%%1.dll
goto end


:MergeDll
@echo %1  
@SET ILMerge="C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe"
%ILMerge% %1 /out=%folder%%outputDLL%
goto end

:end


ILMerge ile assembly dosyalarını birleştirmek


Kaynaklar:
www.developerfusion.com
www.codeproject.com

We made a command line tool which takes parameters and sends e-mails. We wanted to distribute this as an .exe but couldn't because it referenced a .dll. This meant that we had to send along the .dll and that it had to be in the same directory as the .exe. We wanted a way to have just one .exe but Visual Studio .NET doesn't offer this (a linker). Luckily, at the Microsoft Research Download Page there is a free tool called ILMerge which does just this. This is how you use it:
1.download ILMerge
2. put "ILMerge.exe" in your \WINNT directory
3.In VS.NET, right click project, Properties, Common Properties, Build Events
4. In "Post-build Event Command Line" enter:
ilmerge /out:$(TargetDir)YOURAPPNAME.exe $(TargetPath) $(TargetDir)YOURDLLNAME.dll
5.Then compile the Release version (not the debug version).
6.In your "bin\Release" directory, you will find a YOURAPPNAME.exe which can be run on its own without the .dll.