2015-06-19 71 views
1

我嘗試將自定義操作添加到安裝程序項目。我添加了一個自定義操作項目與下面的代碼:Visual Studio安裝程序項目:自定義操作 - >找不到入口點

public class CustomActions 
    { 
    [CustomAction] 
    public static ActionResult CustomAction1(Session session) 
    { 
     session.Log("Begin CustomAction1"); 

     return ActionResult.Success; 
    } 
    } 

在我的安裝項目,我加入到CustomAction_project參考,並添加以下條目添加到自定義操作 - >安裝:

名稱:從CustomAction主輸出(活動) 入口點:CustomAction1 InstallerClass:假 SOURCEPATH:路徑CustomAction.dll

現在,如果我嘗試建立我的安裝項目我獲得以下錯誤:

ERROR: Entry point 'CustomAction1' not found in module 'PATH\CustomAction.dll' for custom action 'Primary output from CustomAction (Active)'.

  • 我該怎麼做?自定義操作代碼由Visual Studio 2013自動生成!

回答

1

你已經建立了一種旨在爲WiX的設置託管代碼自定義操作項目。如果您使用本機Visual Studio安裝程序項目,則需要安裝程序類自定義操作。這些可能幫助:

https://msdn.microsoft.com/en-us/library/vstudio/d9k65z2d(v=vs.100).aspx

http://www.c-sharpcorner.com/uploadfile/ddoedens/usinginstallerclassestoeasedeploymentinvs.net12012005061649am/usinginstallerclassestoeasedeploymentinvs.net.aspx

http://vbcity.com/forums/t/145818.aspx

基本上你添加一個安裝程序類到您的項目,並覆蓋安裝方法。

0

如果你想使用CustomActions從Microsoft.Deployment.WindowsInstaller(不是安裝程序類) 您需要:

  1. here安裝WiX的工具集。
  2. 在VS
  3. 參考創建一個新的類項目的維克斯%SDK%\ Microsoft.Deployment.WindowsInstaller.dll
  4. 創建一個類像this
  5. 編譯。
  6. 編譯的結果應該是一個projectName.dll和projectName.CA.dll的projectName.CA.dll必須包含在安裝項目是這樣的:

enter image description here

快樂正在安裝... :)

相關問題