Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 6

how to use VC100 for MSBuild ?

Solved! Go to Solution.

I want to build a project developed with Visual studio 2010. The installed version is 2017 or 2019 and I want to know how to build another version.

 

Thanks.

 

5 Replies
Solution
Pilot Lvl 1
Message 2 of 6

Re: how to use VC100 for MSBuild ?

Install VS2010.

 

I have a project for VS2010 which i cannot update (yet) without breaking it, and that's the only working solution i found. While on local you can use VS2017 to work with files, you still need VS2010 installed for v100 toolset...

 

Anyway, someone put all what's needed on Chocolatey, so under Actions it's one-liner...

- run: choco install vcexpress2010

..which downloads and runs

https://download.microsoft.com/download/1/D/9/1D9A6C0E-FC89-43EE-9658-B9F0E3A76983/vc_web.exe

 

This adds ~5-6 minutes to job run time, just to grab and prepare VS2010; not so great, but not so terrible either. Would love to see better/faster solution for this one, but currently it's all i got.

Copilot Lvl 3
Message 3 of 6

Re: how to use VC100 for MSBuild ?

Oh. Thank a lot ^^

Copilot Lvl 3
Message 4 of 6

Re: how to use VC100 for MSBuild ?

I don't know how to run vcexpress after installation

 

Also Can I patch the sdk separately?

 

just, I would like to use like below code

 

start msbuild env

call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86

 

and build

msbuild Build.proj /t:%TARGET% /p:Platform="%PLATFORM%";PlatformToolset="%TOOLSET%"

 

Thanks

Pilot Lvl 1
Message 5 of 6

Re: how to use VC100 for MSBuild ?


@kerry-Cho wrote:

 

vcvars

 

Sweet gods. I switched to CMake so long ago i totally forgot it exists...

 

If you can (and i'm fully aware it might be overkill for some projects), i'd recommend doing the same, so you don't have to worry about such stuff anymore:

md Build
cd Build
cmake -G "Visual Studio 10 2010" ..
cmake --build . --config Release

That's more or less what i'm using, leaving all dirty work to smart people maintaining CMake.

 


 

If that's not an option... oh boy.

 

In theory this should work...

 

- run: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
- run: "C:\Path\To\MSBuild.exe" ...

...but gods knows if Actions will keep env variables set inside .bat or not, didn't tried yet. If they doesn't for w/e reason, that's not a [big] problem; you can extract all "set" from vcvars into something like this...

@set PATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;%PATH%
@set PATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN;%PATH%
@set LIB=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;%LIB%
@set LIB=C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Lib;%LIB%
@set LIB=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;%LIB%
@set INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;%INCLUDE%

...and convert it to fancy Actions step:

- name:  Environment
run: | echo ::add-path::C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE echo ::add-path::C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN echo ::set-env name=LIB::C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;%LIB% echo ::set-env name=LIB::C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Lib;%LIB% echo ::set-env name=LIB::C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;%LIB% echo ::set-env name=INCLUDE::C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;%INCLUDE%
shell: cmd

That should configure environment just like vcvars would, for all later steps; see ::add-path and ::set-env docs for details.

 

What's left is finding and running MSBuild; i have no bloody idea where installer puts it, neither i have any machine with VS2010 installed currently to check. Explore! :> Once you find it, just add it to PATH and...

- run: msbuild OhNoesLegacyCode.sln [options]

...like there's no tommorow.

 

Easy, right? :)

 

Wish i could help more than just wild guessing above, but it's been years since i compiled anything on windows from scratch using vcvars + msbuild...

Copilot Lvl 3
Message 6 of 6

Re: how to use VC100 for MSBuild ?

Thanks you so much , sloved with your help.

The configuration time is a bit longer, but it doesn't matter because the build time is longer.

 

Below is a Sample Repo

https://github.com/kerry-Cho/Actions_msbuild2010