I'm building a solution that contains a class library, a UnitTest Project and a .vdproj setup project. Because MSBuild cannot handle vdproj I'm using devenv.com. I'm calling C:\NuGet\nuget.exe restore "%WORKSPACE%\solution.sln" -ConfigFile C:\NuGet\NuGet.config
before the build starts and build with "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.com" rotring.tacton.export.sln /build "ci"
.
After that I execute the tests with "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "%WORKSPACE%\testproject.test\bin\ci\tests.dll"
.
The nuget restore command tells me that every package has been restored correctly and to the right place:
Added package 'package.1.9.11' to folder 'C:\dev\workspace\solution\packages'
.
But still I'm getting the error:
error CS0234: The type or namespace name 'sometype' does not exist in the namespace 'somenamespace' (are you missing an assembly reference?)
Local builds just work fine even when I'm executing the console build mentioned above manually. Do I need to restore the packages somehow with devenv.com? Isn't the advantage of PackageReference that all packages are stored at the same place compared to packages.config?
Update: I managed to find a partly myself. One thing was that my Test-Project was not migrated to PackageReference and caused an error. However I was able to build the solution by first restoring the packages with MSBuild:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" /t:Restore /p:RestoreConfigFile="C:\NuGet\NuGet.config"
And then building the solution with devenv.com:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.com" solution.sln /build "ci"
Now the only problem I face is that msbuild only restores the packages from the main project and doesn't care about the Test-Project.