Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Unable to build sample project in Visual Studio #26

Closed
Pzixel opened this issue Jun 2, 2017 · 23 comments
Closed

Unable to build sample project in Visual Studio #26

Pzixel opened this issue Jun 2, 2017 · 23 comments

Comments

@Pzixel
Copy link
Contributor

Pzixel commented Jun 2, 2017

I always get the same error:

6>------ Rebuild All started: Project: CodeGeneration.Roslyn.Tasks, Configuration: Debug Any CPU ------
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4825,5): warning MSB3061: Unable to delete file "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.dll". Access to the path 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.dll' is denied.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 2 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 4 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 6 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 7 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 8 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 9 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): warning MSB3026: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Beginning retry 10 in 1000ms. The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): error MSB3027: Could not copy "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". Exceeded retry count of 10. Failed.
6>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4148,5): error MSB3021: Unable to copy file "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\bin\CodeGeneration.Roslyn.Tasks.Helper\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll" to "C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll". The process cannot access the file 'C:\Users\Alex\Source\Repos\CodeGeneration.Roslyn\src\..\bin\CodeGeneration.Roslyn.Tasks\Debug\net46\CodeGeneration.Roslyn.Tasks.Helper.dll' because it is being used by another process.
6>Done building project "CodeGeneration.Roslyn.Tasks.csproj" -- FAILED.

I have just cloned repository, rebooted and only process running is VS so I don't know what's wrong with this I have even resintalled VS :) It didn't work.

Probably it's because of uncommon place for binaries, but I have fresh VS installation and fresh repo so it should be something with repo itself, environment is fine.

@masaeedu
Copy link

masaeedu commented Jun 4, 2017

@Pzixel Are you applying the attribute in the same project where you have your code generator defined?

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 5, 2017

@masaeedu I haven't this code changed at all. I just did git clone & start vs & build solution

@masaeedu
Copy link

masaeedu commented Jun 5, 2017

@Pzixel Is this a consistent issue across machines? Maybe try nuking your repo and trying again. I just tried the following and get a successful build:

git clone git@github.com:AArnott/CodeGeneration.Roslyn.git
cd .\CodeGeneration.Roslyn\src
dotnet restore
msbuild .\CodeGeneration.Roslyn.sln

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 6, 2017

@masaeedu yes, it works (a little win here).

However, if you build solution through VS you get these errors:

image

@Pzixel Pzixel changed the title Unable to build sample project Unable to build sample project in Visual Studio Jun 6, 2017
@masaeedu
Copy link

masaeedu commented Jun 6, 2017

@Pzixel The actual problem seems to be: The 'GenerateCodeFromAttributes' task failed unexpectedly. System.MethodMissingException: Method not found: '...ImmutableArray`1<SyntaxTree>'. Did you restore your nuget packages?

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 6, 2017

@masaeedu I ran VS build after building in console thus all packages have to be restored.

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 13, 2017

No idea what's wrong here?

@orellabac
Copy link

@Pzixel Isee from the screenshot that the console build was run as administrator. Are you running the VS as administrator too?

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 13, 2017

@orellabac of course. I even set compatibility mode this programm require additional permisions when I install VS to be sure that it's always in administrator mode.

@orellabac
Copy link

orellabac commented Jun 13, 2017

@Pzixel mmm I was able to reproduce your issue by using a similar path to what you are using.
I do not know yet if the path has any influence. But I will be checking it.
capture

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 14, 2017

Bug is fixed in VS2017 update 2.

@Pzixel Pzixel closed this as completed Jun 14, 2017
@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 16, 2017

@orellabac Few days later I tried to build it again, and encountered this issue again. So it's not being fixed by update2. I can provide any additional information but I don't really know what's causing the issue.

@Pzixel Pzixel reopened this Jun 16, 2017
@masaeedu
Copy link

masaeedu commented Jun 16, 2017

@Pzixel Seems like a flaky issue. I don't know if you have a cloud storage account (onedrive/dropbox etc.), but if you could take a snapshot of a VM in which you've reproduced the issue and share the files we can experiment with it. I've personally been using the nuget packages in VS 2017 preview, and haven't had any issues. Even managed to implement XML type providers for C# 😄

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 16, 2017

@masaeedu good idea. However, I'm not really sure if it's easy to share 30gb-minimum-image of VM where this issue is reproducable. However, I think it's a good idea to test on fresh VM, because it may be environment problem.

To be honest, if I add CodeGeneration.Roslyn as NuGet reference, it works fine. So I can continue my work anyway. It's just an interesting case, because I was thinking that it would be easier to download a whole sample and study it while now it seems very complicated :)

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 17, 2017

Ok, I just installed the freshest W10 and VS and was able to repro this issue. I'm studying how can I share it (it's 50 GB), becuase I have only 30GB in my OneDrive. I'd appreciate If someone know any free service where I can upload it.

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 18, 2017

Here is link to my OneDrive folder. It's HyperV VM, 7gb archived, 20gb unzipped. Issue is totally reproducable there.

@Pzixel
Copy link
Contributor Author

Pzixel commented Jun 21, 2017

Hey, what I found! If you open visual studio and try to compile form msbuild you get the same error! :)
image

@Pzixel
Copy link
Contributor Author

Pzixel commented Sep 11, 2018

This could be solved with killing all msbuild processes and starting build (not rebuild) again.

@Pzixel Pzixel reopened this Sep 11, 2018
@Pzixel
Copy link
Contributor Author

Pzixel commented Sep 11, 2018

So, There is a workaround, but issue is still here.

@amis92
Copy link
Collaborator

amis92 commented Sep 11, 2018

File locks are no longer an issue since v0.4.74 by #83, I think?

@Pzixel
Copy link
Contributor Author

Pzixel commented Sep 11, 2018

Hmm, interesting. Gonna check it later, thank you.

@AArnott
Copy link
Owner

AArnott commented Sep 20, 2018

Ya, I thought #83 would have avoided this. Otherwise, what I tended to do was unload the project that couldn't build since it rarely needed to build during regular development in the sln anyway.

@amis92
Copy link
Collaborator

amis92 commented Jan 22, 2019

I'll close this as it's possibly resolved, and I can't repro it with current master.

@amis92 amis92 closed this as completed Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants