Reputation: 937
I have a solution with an aspnet core targeting full .net framework 4.6.1 on windows 10, referencing other csprojs, inside the same solution.
All projects use project.json for nuget (instead of package.config).
Everything worked as intended yesterday, compiling from visual studio, or from command line using msbuild. After updating my aspnet core 1.0.1 to 1.1, everything is working good compiling using visual studio, but when I build with msbuild, build succedes, but starting webserver using
dotnet run projectfolder
kestrel, more precisely microsoft.aspnetcore.hosting throws exception:
System.BadImageFormatException: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0...
Is it a known bug? Is it ok to use msbuild also after 1.1 version?
Thank you in advance,
Andrea
Upvotes: 0
Views: 314
Reputation: 937
I couldn't repro, on your github example, but I did solve the problem targeting directly project. In my case (Im wondering why) I couldn't use /t:ProjectName, I had to use
msbuild ./Folder/ProjectName.xproj
Upvotes: 0
Reputation: 2000
I hit the same issue and was able to workaround by explicitly specifying project to build. Try...
msbuild.exe solutionfile.sln /t:ProjectName
where ProjectName
is the project you are trying to start (more details how to specify project - https://msdn.microsoft.com/en-us/library/ms171486.aspx?f=255&MSPPError=-2147217396).
In my case it depends how msbuild chooses to build project dependecies (classic class libraries with project.json). If it chooses to build them before building xproj it fails with the same exception you mentioned. When they are build in context of xproj build it works. See my response in your gihub issue https://github.com/aspnet/Home/issues/1824 for more detials and simple repro.
Upvotes: 2