Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Running Visual Studio with /useenv option breaks projects using CoApp-created packages #105

Open
dakotahawkins opened this issue May 5, 2015 · 1 comment

Comments

@dakotahawkins
Copy link

Example repository here: https://github.com/dakotahawkins/TestCoApp

Built packages are in the "NuGetPackages" directory, main solution is "TestCoApp.sln".

If you launch Visual Studio 2013 from a command prompt using the "RunVS.bat" file, project link fails because Visual Studio can't find\run mt.exe. This is not an issue launching Visual Studio without the /useenv option, and it isn't an issue when CoApp-created package is not being used.

Here is the error:

1>Link:
1>     Creating library D:\TestCoApp\Debug\ApplicationDLL.lib and object D:\TestCoApp\Debug\ApplicationDLL.exp
1>LINK : fatal error LNK1158: cannot run 'mt.exe'
1>
1>Build FAILED.

Here are the contents of "RunVS.bat":

@echo off
setlocal ENABLEDELAYEDEXPANSION

if "%DEVENVDIR%" == "" (
    if exist "%VS120COMNTOOLS%" (
        call "%VS120COMNTOOLS%vsvars32.bat"
        if ERRORLEVEL 1 (
            echo Unable to initialize Visual Studio 2013 build environment
            GOTO Error
        )
    ) else (
        echo Unable to initialize Visual Studio 2013 build environment
        GOTO Error
    )
)

devenv /useenv

EXIT /B 0
:Error
EXIT /B 1

The reason we want to run this way is because we want to dynamically set an environment variable that is used in our project settings. In this case we would set the environment variable prior to launching Visual Studio with the /useenv option.

@dakotahawkins
Copy link
Author

It turns out this is a symptom of Issue #104. Manually editing the redist package and changing the SetEnv task to add a semicolon resolved the error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant