ashwin_k_s

I am using devenv.exe /build debug to build my solution. Now, I want to build it in release mode. Is this possible using devenv.exe /build release.At present I am writing this in a bat file and then executing it. This is what I am writing in my bat file:

writer.WriteLine("devenv.exe /build debug /out \"" + strLog + "\" \"" + strSolution + "\"");

I want my solution to build in release mode.

If I have posted my post in wrong forum,please let me know. I saw all MSDN forums and could not find suitable for this post than this forum.

Regards




Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

DanMoseley - MSFT

You have to choose the release configuration. It's a little confusing because you need to have the platform as well.

The string devenv.exe will expect will look something like "Release|AnyCPU" where AnyCPU is the platform, which is visible in the configuration properties window in VS. devenv / explains where it goes.

Dan






Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

ashwin_k_s

Hi Dan,

I replaced ("devenv.exe /build release /out \"" + strLog + "\" \"" + strSolution + "\"") with ("msbuild.exe \"" + strSolution + "\" /p:configuration=release"). All is fine and sln is building in release mode but how can I specify the /out when using msbuild.exe. I could find any parameter of this kind for msbuild. I need this log file.

Regards






Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

sluggy

There are a couple of ways to do this, one is real esy and the other is considerably more complex. The complex way is to specify a logger as a command line option to MSBuild, this is documented here: http://msdn2.microsoft.com/en-us/library/ms171470.aspx.

The other real simple way to do it is to just redirect the output when you invoke MSBuild on the command line, like this:

msbuild someBuildFile.proj /t: someTarget > someLogFile.log





Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

ashwin_k_s

Hi sluggy,

Thanks for your post.I am sorry but I am not able to get what someTarget means here. Like, If I use devenv then I use

writer.WriteLine("devenv.exe /build release /out \"" + strLog + "\" \"" + strSolution + "\"");

Do you want to say that I should write this:

writer.WriteLine("msbuild.exe \"" + strSolution + "\" /p:configuration=release /t:"+ strLog);

Where strLog is the name of logfile that I am using.

Regards






Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

sluggy

You almost have it, but not quite. To use your previous example, try this:

writer.WriteLine("msbuild.exe \"" + strSolution + "\" /p:configuration=release >"+ strLog);

Notice the > sign that i coloured red, that redirects any output to the specified file. In my example, the /t: switch is the shortened version of /target:, and it specifies which target(s) MSBuild should invoke within your proj file.





Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

ashwin_k_s

Thanks a lot for providing me the answer. Just a little doubt. I saw following option for creating output log file:

/l:FileLogger,Microsoft.Build.Engine;logfile=" + strLog)

How does this differ from your solution I read that this (/l:FileLogger) uses msbuild engine to create a log file.Which one should be used first

Thanks and regards,






Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

sluggy

That is the more complex option i mentioned in my first post, and i gave you a link to the MS doco on it. Basically, you can create your own logging class for MSBuild to use, the details supplied after the /l: switch are what MSBuild needs to use reflection to load the class. Follow the link i gave you, it describes it way better than i can in a sentence or two Smile





Re: Visual Studio MSBuild Building solution in release mode using devenv.exe

ashwin_k_s

Hi,

I used ("msbuild.exe \"" + strSolution + "\" /p:configuration=release >" + strLog) by writing it in a batch file. When I run the batch file, i see that there is Logfile but doesnot contain any content(i.e. 0kb file). But, When I run the same command from Command prompt, I get log file with build information. I tried using

("msbuild.exe \"" + strSolution + "\" /p:configuration=release /l:FileLogger,Microsoft.Build.Engine;logfile=" + strLog)

, but this doesnot write any log file.

How can i get logfile written when I run it in a batch file.Is it possible to build solution in release mode using devenv.exe I am looking at it because it was working fine with its /out parameter. the only problem was that it was building in Debug mode.

My bat file has following content:

cd c:\Program Files\Microsoft Visual Studio 8\Common7\IDE
msbuild "C:\Inetpub\wwwroot\TestSolution\SolutionTest\SolutionTest.sln" /p:configuration=release

/l:FileLogger,Microsoft.Build.Engine;logfile="C:\TestLog1.txt"

when i run batch file containing above code, it doesnot write C:\TestLog1.txt file

Regards