How to run regasm.exe from command line other than

2019-01-21 21:25发布

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 not recognized as internal or external command.

So I understood that I need to set the path for regasm.exe in environment variable.

For which variable do I need to set the path to run regasm as described above?

10条回答
做个烂人
2楼-- · 2019-01-21 22:00

I use the following in a batch file:

path = %path%;C:\Windows\Microsoft.NET\Framework\v2.0.50727
regasm httpHelper\bin\Debug\httpHelper.dll /tlb:.\httpHelper.tlb /codebase
pause
查看更多
不美不萌又怎样
3楼-- · 2019-01-21 22:05

In command prompt:

SET PATH = "%PATH%;%SystemRoot%\Microsoft.NET\Framework\v2.0.50727"
查看更多
放我归山
4楼-- · 2019-01-21 22:05

If you created the DLL using .net 4.5 , then copy and paste this command on command prompt.

 %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe MyAssembly.dll
查看更多
戒情不戒烟
5楼-- · 2019-01-21 22:08

You don't need the directory on your path. You could put it on your path, but you don't NEED to do that.
If you are calling regasm rarely, or calling it from a batch file, you may find it is simpler to just invoke regasm via the fully-qualified pathname on the exe, eg:

c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm.exe   MyAssembly.dll
查看更多
小情绪 Triste *
6楼-- · 2019-01-21 22:09

Like Cheeso said:

You don't need the directory on your path. You could put it on your path, but you don't NEED to do that. If you are calling regasm rarely, or calling it from a batch file, you may find it is simpler to just invoke regasm via the fully-qualified pathname on the exe, eg:

%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\regasm.exe MyAssembly.dll

查看更多
别忘想泡老子
7楼-- · 2019-01-21 22:09

I use this as post-build event in Visual Studio:

call "%VS90COMNTOOLS%vsvars32.bat"
regasm  $(TargetPath) /tlb

Depending on your Visual Studio version, use these environment variables instead:

  1. Visual Studio 2008: VS90COMNTOOLS
  2. Visual Studio 2010: VS100COMNTOOLS
  3. Visual Studio 2012: VS110COMNTOOLS
  4. Visual Studio 2013: VS120COMNTOOLS
  5. Visual Studio 2015: VS140COMNTOOLS
  6. Visual Studio 2017: VS150COMNTOOLS
查看更多
登录 后发表回答