-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade asp.net core targeting framework 4.6.1 from vs2015 to vs2017 - One or more compilation references are missing #958
Comments
how are you running your project? I would not expect project.json to be referenced at all when running a migrated (csproj) project. |
I have tried via VS2017 and multiple cli version (even tried the nightly alpha build). Did not understand what you meant by the second statement? can you please explain? |
The error message that you pasted above:
It mentions properties that exist in project.json and mentions project.json. But my understanding is that you have migrated to csproj. So, my guess is that you are using a project.json based CLI to run your project. Can you check if you have a global.json file in the root of you repo and if it has a version property in it pointing to preview2 or preview2-1 of the CLI. The property should be under sdk in the global.json. |
I don't have global.json(I deleted the file before the migration). I'm mainly running via visual studio. I assume vs uses it owns tools therefore the version installed is not relevant?(correct me if i'm wrong). |
@livarcocc The "project.json" error message is actually hardcoded in MVC: https://github.com/aspnet/Mvc/blob/rel/1.1.2/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRoslynCompilationService.cs#L158 |
cc @mlorbetske |
@vijayrkn @dsplaisted it looks like the compilation context hasn't been preserved even though it's set in the project file, any ideas? cc @Eilon for the hard coded string |
Derp. I filed aspnet/Mvc#5931 to track fixing MVC's bad error message. |
Update - Created a new project from VS template, copied all the source code into the new project and it's working. I don't know why but something in the migration process was 🙈. |
@ErezSavir the PreserveCompilationContext flag is set by default to True in Microsoft.NET.Sdk.Web, so it's not required to be present in the project file. Migration likely adds it as this setting is not web specific, but it's not defaulted on the other SDKs |
Sorry, closed by accident |
@ErezSavir We still need to track down the migration issue. Can you provide a repro with a project.json project that ends up in this bad state after migration? |
@nguerrera I didn't managed to repro the issue. I can upload the original projects project.json if it would help. |
@ErezSavir So, as of now, if you |
Since this does not seem to be a problem anymore and we can't repro the issue, I am closing it. Please, re-activate if you run into it again and provide the original project.json that migrated to a bad state. |
@livarcocc
@using ClassLibrary2 example: WebApplication1.zip |
This seems related to an issue I had with Visual Studio 2017 when I moved from VS2015. If you have targetframework = net461 and you have mscorlib.dll in your project folder or subfolders (not bin, obj), you will get the "One or more compilation references are missing" error message. This can happen if you publish to a folder other than the default bin directory, e.g. to publish subfolder in project folder where mscorlib.dll will be copied and other dll's. If you build using the dotnet cli from the command line, mscorlib.dll needs to be in the root project folder for the issue to appear. If you are using Visual Studio 2017 to build your project, mscorlib.dll can be in any subfolders. To reproduce it:
|
I got the same error message, in my case I had to fully qualify my Model (@model Project.Namespace.Classname) and then it worked. Best regards |
I'm encountering the issue with a just-migrated project: Is there already some workaround available? |
We have no plans to continue to change dotnet migrate at this moment. As such, I am going to close this issue. |
…0190912.1 (dotnet#958) - Microsoft.AspNetCore.Mvc.Analyzers - 5.0.0-alpha1.19462.1 - Microsoft.AspNetCore.Mvc.Api.Analyzers - 5.0.0-alpha1.19462.1 - Microsoft.AspNetCore.Analyzers - 5.0.0-alpha1.19462.1 - Microsoft.AspNetCore.Components.Analyzers - 5.0.0-alpha1.19462.1
have upgraded my asp.net core,using project.json and targeting .net framework 4.6.1 on visual studio 2015 to visual studio 2017.
I have multiple projects in the solution where the main application is referencing them by project reference(all of them target net461).
When running the application I get
One or more compilation references are missing. Possible causes include a missing 'preserveCompilationContext' property under 'buildOptions' in the application's project.json.
Screenshot:
And my csproj:
webapp.txt
I'll try to create a project to see if I can reproduce.
The text was updated successfully, but these errors were encountered: