Description
Hi,
I have a serious problem after upgrading to VS 2015 Update 1 RTM.
I am trying to do cross-platform development for my RethinkDB Driver for both CoreCLR/DNX and full .NET 4.5 framework.
I don't want to convert everything to a DNX build project because the CoreCLR/DNX stuff has not RTM'd. So, I'd just like to use standard RTM tools when developing the .NET 4.5 target, then, later when Visual Studio is closed, do dnu build
_as a separate thing_.
When I have .CSPROJ open in Visual Studio and I try to compile, I get an error that was not here prior to Update 1:
Your project.json doesn't have a runtimes section.
You should add '"runtimes": { "win": { } }' to your project.json and
then re-run NuGet restore. RethinkDb.Driver
Okay... So I attempt to add:
"runtimes": { "win": { } }
Q1: why do I need this "win" tag since I'm doing cross-platform targeting with CoreCLR? I am not, in any way, targeting "windows" with CoreCLR/DNX).
So, I place the tag inside project.json, but still no dice. Now I'm getting even more errors:
Some packages are not compatible with DNXCore,Version=v5.0 (win). 0
System.Runtime.Extensions 4.0.11-beta-23516 provides a compile-time reference assembly for System.Runtime.Extensions on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win. 0
System.Net.Primitives 4.0.11-beta-23516 provides a compile-time reference assembly for System.Net.Primitives on DNXCore,Version=v5.0, but there is no run-time assembly compatible with win. 0
Now it looks like this new "win" runtime tag is causing even more problems. Can someone tell me why MSBUILD is so unhappy now?
Even better, can someone tell me how to force _MSBUILD + VS + NUGET_ to 🚫 STOP 🚫 probing for project.json when I have my classic .CSPROJ open? I _do not_, want project.json even being considered or looked at when I have my classic .CSPROJ open in Visual Studio. I'd prefer my PACKAGES.CONFIG ✅ considered when my classic project is open. I don't understand why the tooling from both DNX (project.json) and CSPROJ are conflicting. IMHO, these should be two completely different things at this stage.
Feel free to fork or download the project. My sources here: https://github.com/bchavez/RethinkDb.Driver
There are two solutions:
RethinkDb.Driver.Dnx.sln
- DNX Project SolutionRethinkDb.Driver.sln
- Classic .csproj Solution
Thanks,
Brian
Activity
bchavez commentedon Dec 7, 2015
Okay, I sort of solved this by downgrading .csproj
Toolsversion
to 4.0 (from 14.0)<Project ToolsVersion="4.0"
.weshaggard commentedon Dec 7, 2015
cc @Pilchie @jasonmalinowski
Pilchie commentedon Dec 7, 2015
project.json
and .csproj files are NOT two differently things.project.json
is used by more than just DNX. It can also be used in conjunction with .csproj files as a replacement for packages.config, to allow .csproj files to take advantage of features like transitive dependencies, build time resolution of assets, etc.The reason you are being prompted to add a runtime section is because the build time asset resolution is trying to copy assets from your dependencies to allow you to run, but it needs to know what assets you want to copy.
Having a project.json meant to be used for DNX in the same directory as a packages.config to be used by msbuild isn't something that's supported today, but you can have two different project.json files, one for msbuild and one for DNX. To do that, create a
<projectname>.project.json
(where<projectname>
is the name of your .csproj. This will allow you to specify the existing framework from your .csproj, instead of of DNX.Finally, if you are building a library and you don't want to copy runtime assets to your output directory, you can add
<CopyNuGetImplementations>false</CopyNuGetImplementations>
to your .csproj, in which case you won't need aruntimes
section in your<projectname>.project.json
.Hope this helps.
(Also tagging @yishaigalatzer and @ericstj)
bchavez commentedon Dec 7, 2015
Thanks @Pilchie
Thank for explaining this: I'll migrate off packages.config
If I understand correctly, then, how do I tell the build time asset resolution that I only want outputs for
net45
full framework right now when I build the solution in VS2015 and not bother with any DNX stuff?Again, thanks for your help
bchavez commentedon Dec 7, 2015
Maybe, specify
runtime: { "win":{}}
in name.project.json, but leave it out in the rootproject.json
?Pilchie commentedon Dec 7, 2015
I edited my markdown so that the xml doesn't disappear in in the rendered output.
Right - also, name.project.json should just have a single entry like
net451
in the frameworks section.bchavez commentedon Dec 7, 2015
Fantastic. Thank you. That seems to have solved everything. Once again, happily compiling! I'm sure other will find this information really useful. Just had to do one last solution wide "nuget restore" after the changes.
bchavez commentedon Dec 11, 2015
This is a bit strange. So, check this out:
System.Threading.Timer
toproject.json
:System.Threading.Timer
, save, build-clean, and "Restored NuGet" packages. Even restarted Visual Studio and a _still_ get an error message.So, now _what_ is going on? I have
name.project.json
with the necessary "runtime", and aproject.json
without any runtimes as we discussed few days ago.I dunno, but to me it seems natural to revert my 1 line edit should get me back to where I was but I cannot back out of a 1-line edit. I cannot get rid of this error. 👎. Back to square one in this original issue.
Latest code, "name.project.json" & "project.json" files here:
https://github.com/bchavez/RethinkDb.Driver/tree/master/Source/RethinkDb.Driver
CI server's Build Error:
https://ci.appveyor.com/project/bchavez/rethinkdb-driver/build/282#L654
bchavez commentedon Dec 11, 2015
I deleted these
*.lock.json
files and it seems to build again. I still think this is a symptom of a larger problem.I delete _ALL_ lock files (and ensure NO lock files exist in the build DIR), I can run
msbuild source\RethinkDb.Driver.sln
, _BUILD SUCCESS_ ✅Restore Packages from Visual Studio 2015 Update 1, generates
RethinkDb.Driver.project.lock.json
, and the command:msbuild source\RethinkDb.Driver.sln
_BUILD FAIL_ ❌ with error message below:So, ironically, Restore Packages breaks the build. 🎱
jasonmalinowski commentedon Dec 19, 2015
So there's a two things there:
Since NuGet/Home#1859 is tracking the first strangeness you observed, and the second issue is addressed by updating your project.json as described, can you close this bug once you've confirmed you're unblocked?
bchavez commentedon Dec 19, 2015
Hi @jasonmalinowski,
project.json
with all the necessary references.name.project.json
with theruntimes: { "win-anycpu" }
and"frameworks": { "net45":{}}
.This should work. But it does not. I think it's likely due to No.1 NuGet/Home#1859. But once NuGet/Home#1859 as you suggested is fixed, I fear I will be in a state where I will no longer be able to build this project. NuGet/Home#1859 actually allows me to build the project normally _without_ failing on this "runtimes" compiler error.
bchavez commentedon Dec 19, 2015
Please feel free to checkout / clone the repo here:
https://github.com/bchavez/RethinkDb.Driver/tree/master/Source/RethinkDb.Driver
I have MSBuild hacks everywhere just trying to get this to build for
net45
anddnx
CoreCLR. All the msbuild hacks are inside this BauBild file30 remaining items