代码之家  ›  专栏  ›  技术社区  ›  Eran Betzalel

GACed.net库项目仅在第二次尝试后成功生成

  •  1
  • Eran Betzalel  · 技术社区  · 15 年前

    “C:\Program Files(x86)\Microsoft SDK\Windows\v7.0A\Bin\gacutil.exe“-if”$(目标路径)

    ------ Build started: Project: Test.BusinessLogic, Configuration: Debug Any CPU ------   
    Test.BusinessLogic -> C:\Users\Eran\Documents\Test\Trunk\Test.BusinessLogic\bin\Debug\Test.BusinessLogic.dll 
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 3.5.30729.1   
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
         Assembly successfully added to the cache
    
    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
    

    很好-建造成功了。

    ------ Build started: Project: Test.BusinessLogic, Configuration: Debug Any CPU ------   
    Test.BusinessLogic -> C:\Users\Eran\Documents\Test\Trunk\Test.BusinessLogic\bin\Debug\Test.BusinessLogic.dll 
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 3.5.30729.1   
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
         Failure adding assembly to the cache:   Cannot create a file when that file already exists.    
    
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3717,9): error MSB3073: The command ""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe" -if "C:\Users\Eran\Documents\Test\Trunk\Test.BusinessLogic\bin\Debug\Test.BusinessLogic.dll"" exited with code 1.
    ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
    

    这很糟糕也很奇怪。

    2 回复  |  直到 15 年前
        1
  •  1
  •   Olle Sjögren user1810449    13 年前

    你有提到这个集会吗?

    /uf <assembly_name>

    Forces uninstall of an assembly by removing all traced references.
    <assembly_name> is the full name of the assembly to remove.
    Assembly will be removed unless referenced by Windows Installer.
    

    !! 警告:使用 /uf 小心命令,因为应用程序可能无法运行!!

    (在VSD2010的单独脚本中):

    gacutil /uf <assemblyname>
    

    生成程序集时不使用调用gacutil的生成前或生成后操作

    gacutil /if <assemblyname>
    
        2
  •  0
  •   Eran Betzalel    15 年前

    我找到了一个临时的解决方法,可以确保注册工作正常-使用此脚本进行后期生成事件:

    :start 
    "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe" -if "$(TargetPath)"
    IF ERRORLEVEL 1 GOTO start