tag:help.appveyor.com,2012-11-13:/discussions/problems/12764-altcover-fails-to-build-via-dotnet-run-when-the-platform-is-explicitly-specified-in-the-configurationAppVeyor: Discussion 2018-08-25T02:27:10Ztag:help.appveyor.com,2012-11-13:Comment/448615832018-03-08T02:23:31Z2018-03-08T02:23:31ZAltcover fails to build via dotnet run when the platform is explicitly specified in the configuration<div><p>That package is having some problem with the platform environment variable that gets set for each job in the build matrix.<br>
A very straightforward workaround is to add this line to the 'before-build' phase,<br>
<code>- ps: $env:platform = ""</code> as i did for <a href="https://ci.appveyor.com/project/britzkopf/advancedlsupport/build/1.0.13">this build</a>.<br>
This is perhaps not the most robust or ingenious solution but can at least un-block you for now.</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/448615832018-03-08T02:51:23Z2018-03-08T02:51:23ZAltcover fails to build via dotnet run when the platform is explicitly specified in the configuration<div><p>I created an <a href="https://github.com/SteveGilham/altcover/issues/5">issue</a> for it in the github repo for 'altcover'</p></div>Owen McDonnelltag:help.appveyor.com,2012-11-13:Comment/448615832018-03-08T08:55:59Z2018-03-08T08:55:59ZAltcover fails to build via dotnet run when the platform is explicitly specified in the configuration<div><p>@Owen McDonnell</p>
<p>That worked, insofar as I can now build and run altcover. However, testing still fails on x86 targets with a BadImageFormatException. It would seem that the 32-bit dotnet SDK isn't being used.</p></div>Jarltag:help.appveyor.com,2012-11-13:Comment/448615832018-03-09T02:09:02Z2018-03-09T02:09:02ZAltcover fails to build via dotnet run when the platform is explicitly specified in the configuration<div><p>Sorry, should have realized that clearing platform variable before build would allow tests to trivially succeed. I see you corrected that mistake but ran into the coverage tool not running with appropriate dotnet version. The author of that tool gave an analysis of the problem in the issue i linked to above.<br>
I tried his suggestion of specifically invoking the appropriate dotnet version conditionally in the appveyor-coverage batch file in <a href="https://ci.appveyor.com/project/britzkopf/advancedlsupport/build/1.0.33">this build</a> and was able to dodge BadImageFormatException.<br>
But in order to run tests i also had to add conditions to your appveyor-test.bat file like so...<br></p>
<pre>
<code>if "%PLATFORM%"=="x86" (
"C:\Program Files (x86)\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build AdvancedDLSupport.Tests
"C:\Program Files (x86)\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build Mono.DllMap.Tests
)
if "%PLATFORM%"=="x64" (
"C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build AdvancedDLSupport.Tests
"C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build Mono.DllMap.Tests
)
if "%PLATFORM%"=="Any cpu" (
"C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build AdvancedDLSupport.Tests -o AdvancedDLSupport.tests/bin/Debug/netcoreapp2.0/
"C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build Mono.DllMap.Tests -o Mono.DllMap.Tests/bin/Debug/netcoreapp2.0/
)</code>
</pre></div>Owen McDonnell