How to run regasm.exe from command line other than Visual Studio command prompt?

后端 未结 10 2083
盖世英雄少女心
盖世英雄少女心 2020-12-08 02:40

I want to run regasm.exe from cmd. which is available in c:\\windows\\Microsoft.net\\framework\\2.057

I do like this c:\\ regasm.exe

It gives regasm is n

10条回答
  •  暖寄归人
    2020-12-08 02:43

    I really dislike the hard coding of paths to get to regasm, when you install a new .Net or run on a machine with a different version, you need to ensure you find a version of regasm. Here's a solution to find the regasm.exe from the most current .Net installed regasm.

    Within a bat file:

    for /f %%a in ('dir %windir%\Microsoft.Net\Framework\regasm.exe /s /b') do set currentRegasm="%%a"
    %currentRegasm% "full\path\to\your.dll" /options
    

    Outside of a bat file (i.e. command prompt), just use %a instead of %%a

提交回复
热议问题