0

I am battling with an application that I had working fine on my PC. I then rebuilt my PC and cloned the application from my GitHub and I am fighting a build failure VisualStudio due to project references.

Almost every article I have looked up on this suggests that something needs to be amended in my .csproj file, however, this file on my application seems generic.

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <UseIISExpress>true</UseIISExpress> </PropertyGroup> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <WebProjectProperties> <StartPageUrl> </StartPageUrl> <StartAction>CurrentPage</StartAction> <AspNetDebugging>True</AspNetDebugging> <SilverlightDebugging>False</SilverlightDebugging> <NativeDebugging>False</NativeDebugging> <SQLDebugging>False</SQLDebugging> <ExternalProgram> </ExternalProgram> <StartExternalURL> </StartExternalURL> <StartCmdLineArguments> </StartCmdLineArguments> <StartWorkingDirectory> </StartWorkingDirectory> <EnableENC>True</EnableENC> <AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug> </WebProjectProperties> </FlavorProperties> </VisualStudio> </ProjectExtensions> </Project> 

I have tried update-package reinstall from the console. I have also tried bluntly removing the packages folder completely, but still no success. The error I get from VS is as follows:

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props. Riddles2017 C:\Users\Lemus\Source\Repos\The-Fox-The-Chicken-and-The-Corn\Riddles2017.csproj 268 

Can anyone point me in the right direction on this? My GitHub link is: https://github.com/lemusthelroy/The-Fox-The-Chicken-and-The-Corn.git

1 Answer 1

1

Where is your Solution File stored? Nuget restores its packages relative to the solution file. The repo seems to be missing a solution file and looking at the error message, it expects the solution to live in the parent directory of the location you've cloned to. A bit of a weird choice, but that's what it looks like. So, open the Solution, save the solution (from the file menu) and store it in the parent directory of the project. Then restore the nuget packages.

You may want to change the folder structure in your git repo to include the solution file, optionally clearing the repo completely and pushing it afresh.

Alternatively save the solution file in the same directory as the project and update the project files (using notepad if you have to) to change all references to "..\packages" to read ".\packages", then restore the nuget packages.

As you can see in the error message it's looking for:

The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props.

Relative to:

Riddles2017 C:\Users\Lemus\Source\Repos\The-Fox-The-Chicken-and-The- Corn\Riddles2017.csproj 268

So the expected structure is:

c:\users\lemus\Source\Repos +- Mysolution.sln +- \packages\ +- \Microsoft.Net.Compilers.1.0.0\ +- \The-Fox-The-Chicken-and-The-Corn\ +- Riddles2017.csproj 

As opposed to your current structure:

C:\Users\Lemus\Source\Repos\ +- \The-Fox-The-Chicken-and-The-Corn\ +- Mysolution.sln +- \packages\ +- \Microsoft.Net.Compilers.1.0.0\ +- Riddles2017.csproj 

Looking at your project file this would require changing:

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you for coming back to me. I have followed what you have said and created a solution file in the parent directory (..\Repos\The-Fox-The-Chicken-and-The-Corn). I then restored the nuget packages but still come to the exact same error message. Any other thoughts? Thank you for again. edit: I can also confirm that '\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props' Is definitely there...I wonder whether something somewhere is telling VS to look in a different directory?
I'm not sure I follow, my code structure is now... C:\Users\Lemus\Source\Repos\The-Fox-The-Chicken-and-The- Corn\ +- Mysolution.sln +++- packages +- Riddles2017.csproj +++- Microsoft.Net.Compilers.1.0.0 (+++- meaning subfolder)
Struggling to format my comment but The-Fox-The-Chicken-and-The-Corn is my parent directory and the solution file is in there alongside a packages folder. This parent directory is where all of my code is.
I can't find anywhere in the above .csproj file to remove a '..'. I think this is where I am getting stuck
Got there in the end. I was looking at the wrong file. Was looking at the Riddles2017.csproj.user file rather than the Riddles2017.csproj file. Thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.