Could not find a part of the path ... bin\roslyn\csc.exe
Asked Answered
S

60

1307

I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added all assembly references and I am able to build and compile successfully without any error or warning.

But I get the following error in the browser:

Could not find a part of the path 'C:\B8akWorkspace\B8akProject\B8akSolution\B8AK.Portal\bin\roslyn\csc.exe'.

Here is a full screenshot of the error page.

enter image description here

After few days of research, I understood that Roslyn is a .NET compiler platform that offers advanced compiling features. However, I do not understand why my build is trying to find \bin\roslyn\csc.exe because I did not configure anything related to Roslyn. Nor did I intend to use Roslyn in my project.

Segno answered 25/9, 2015 at 10:36 Comment(0)
C
594

The problem with the default VS2015 templates is that the compiler isn't actually copied to the tfr\bin\roslyn\ directory, but rather the {outdir}\roslyn\ directory

Add this code in your .csproj file:

<Target Name="CopyRoslynFiles" AfterTargets="AfterBuild" Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'">
    <ItemGroup>
      <RoslynFiles Include="$(CscToolPath)\*" />
    </ItemGroup>
    <MakeDir Directories="$(WebProjectOutputDir)\bin\roslyn" />
    <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>
Coca answered 25/9, 2015 at 10:44 Comment(15)
This does not resolve my issue. Now I get 'Could not find file 'C:\B8akWorkspace\B8akProject\B8akSolution\B8AK.Portal\bin\roslyn\csc.exe'. Please notice that when I create a new MVC project in VS2015 I don't see the mentioned configuration in .csproj and it runs perfectly fine in the browserSegno
Thanks. I am now able to build and run the project in the browser after I downloaded the Roslyn directory and placing it in the /bin folder. I did not put the PstBuildEvent mentioned above and it still works. Maybe you want to edit your answer above and mention the need to manully placing the Roslyn files and to better reflect the solution.Segno
Well, in a normal situation; you should have the compiler inside your $(OutDir)roslyn*.* folder, so this script will copy the compiler to the binfolder of your project. Apparently your installation of vs2015 did not include the compiler.Coca
Hmm... Wouldn't the "start /min" mean that xcopy is running in a separate process while your build process continues merrily on its way creating a potential race condition?Aciculate
Actually it is not a matter of VS. The compiler comes from a NuGet package - see my answer below. Adding the compiler binaries manually to the project is not the right solution I think.Tittle
This should work without modifying the proj files. that's just fixing the symptom. doing a full rebuild should result in those files being there.Luxate
@Segno Update MS dos.compiler in Nuget as wellFrodine
I've used this to deploy in the AppHarbor also. Just make sure to include csc.exe and all *.dll in the packages folder of Microsoft.Net.Compilers package. I am using VS 2017 CE, ASP .NET MVC 5 targeting .NET 4.5.2 Framework just for reference.Seamark
I found updating Microsoft.CodeDom.Providers.DotNetCompilerPlatform to 1.0.8 and Microsoft.Net.Compilers 2.6.1 helped me a lot. I didnt need to add this extra target. Looks like something similar was added in a later version of the tooling: github.com/aspnet/RoslynCodeDomProvider/commit/…Epicene
I dont know but adding this target does not copy roslyn folder. I am using VS 2017.Kattiekatuscha
I have updated the version of Microsoft.Net.Compilers to version 2.10.0 from the Nuget and it has been the solution for me. I'm using targetFramework="4.6.2"Manatee
suggest deleting obj and bin folder first before experimenting on newer the new ides.Emotive
Don't add code to your solution just because VisualStudio is not behaving! Look at the other answers below.Egocentrism
hmm.. similar to this issue -- Nugets fix itPyrrhonism
Solved for me after removing <system.codedom> from web.configHorsley
T
1955

TL; DR

run this in the Package Manager Console:

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r

More information

This problem is not related to Visual Studio itself, so answers suggesting adding build steps to copy files over are rather a workaround. Same with adding compiler binaries manually to the project.

The Roslyn compiler comes from a NuGet package and there is/was a bug in some versions of that package (I don't know exactly which ones). The solution is to reinstall/upgrade that package to a bug-free version. Originally before I wrote the answer back in 2015 I fixed it by installing following packages at specific versions:

  • Microsoft.Net.Compilers 1.1.1
  • Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.1

Then I looked into .csproj and made sure that the paths to packages are correct (in my case ..\..\packages\*.*) inside tags <ImportProject> on top and in <Target> with name "EnsureNuGetPackageBuildImports" on the bottom. This is on MVC 5 and .NET Framework 4.5.2.

Tittle answered 21/12, 2015 at 8:23 Comment(1)
For some reason, I had to go into the Nuget Package Manager and manually select the latest version (3.6.0) for this to work, if anyone still faces the error after running the command above.Tonkin
C
594

The problem with the default VS2015 templates is that the compiler isn't actually copied to the tfr\bin\roslyn\ directory, but rather the {outdir}\roslyn\ directory

Add this code in your .csproj file:

<Target Name="CopyRoslynFiles" AfterTargets="AfterBuild" Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'">
    <ItemGroup>
      <RoslynFiles Include="$(CscToolPath)\*" />
    </ItemGroup>
    <MakeDir Directories="$(WebProjectOutputDir)\bin\roslyn" />
    <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>
Coca answered 25/9, 2015 at 10:44 Comment(15)
This does not resolve my issue. Now I get 'Could not find file 'C:\B8akWorkspace\B8akProject\B8akSolution\B8AK.Portal\bin\roslyn\csc.exe'. Please notice that when I create a new MVC project in VS2015 I don't see the mentioned configuration in .csproj and it runs perfectly fine in the browserSegno
Thanks. I am now able to build and run the project in the browser after I downloaded the Roslyn directory and placing it in the /bin folder. I did not put the PstBuildEvent mentioned above and it still works. Maybe you want to edit your answer above and mention the need to manully placing the Roslyn files and to better reflect the solution.Segno
Well, in a normal situation; you should have the compiler inside your $(OutDir)roslyn*.* folder, so this script will copy the compiler to the binfolder of your project. Apparently your installation of vs2015 did not include the compiler.Coca
Hmm... Wouldn't the "start /min" mean that xcopy is running in a separate process while your build process continues merrily on its way creating a potential race condition?Aciculate
Actually it is not a matter of VS. The compiler comes from a NuGet package - see my answer below. Adding the compiler binaries manually to the project is not the right solution I think.Tittle
This should work without modifying the proj files. that's just fixing the symptom. doing a full rebuild should result in those files being there.Luxate
@Segno Update MS dos.compiler in Nuget as wellFrodine
I've used this to deploy in the AppHarbor also. Just make sure to include csc.exe and all *.dll in the packages folder of Microsoft.Net.Compilers package. I am using VS 2017 CE, ASP .NET MVC 5 targeting .NET 4.5.2 Framework just for reference.Seamark
I found updating Microsoft.CodeDom.Providers.DotNetCompilerPlatform to 1.0.8 and Microsoft.Net.Compilers 2.6.1 helped me a lot. I didnt need to add this extra target. Looks like something similar was added in a later version of the tooling: github.com/aspnet/RoslynCodeDomProvider/commit/…Epicene
I dont know but adding this target does not copy roslyn folder. I am using VS 2017.Kattiekatuscha
I have updated the version of Microsoft.Net.Compilers to version 2.10.0 from the Nuget and it has been the solution for me. I'm using targetFramework="4.6.2"Manatee
suggest deleting obj and bin folder first before experimenting on newer the new ides.Emotive
Don't add code to your solution just because VisualStudio is not behaving! Look at the other answers below.Egocentrism
hmm.. similar to this issue -- Nugets fix itPyrrhonism
Solved for me after removing <system.codedom> from web.configHorsley
S
283

A clean and rebuild worked for me!

Scutter answered 5/1, 2017 at 11:55 Comment(8)
I dont think the clean is required. According to this discussion of the issue a rebuild not a regular build will always put the roslyn file back. github.com/dotnet/roslyn/issues/15556Incunabula
Rebuild resolved for me, I noticed this in the output Copying file from "C:\Users\medmondson\Source\UK\Portal\Branches\v12\Source\packages\Microsoft.Net.Compilers.1.3.2\tools\csi.exe" to "bin\Debug\roslyn\csi.exe".Beersheba
DotNetCompilerPlatform 1.0.3, Microsoft.Net.Compilers 1.3.2, VS Pro 2017 15.9.4 here. A clean/rebuild didn't work for me, even before and after restarting Visual Studio. Finally, a Build > Batch Build... > Rebuild All did the trick. It must have whispered just the right sweet-nothing to get VS to see it was missing the bin/roslyn directory in the output.Hassan
Clean and Rebuild did the trick for me. For those saying just doing rebuild will work...rebuild's behavior can be modified and does not always just do a clean and build. See #2 of this answer.Unfasten
@pipedreambomb, you're correct but you won't want to clean/rebuild all the time.Benzoyl
I did a Rebuild at the solution level and fixed for me. Over time I've found a few nuget packages where the default build doesn't trigger some of their setup properly, but a Solution Rebuild does.Hexagram
Clean + Rebuild did the trick for me as well. The issue probably was that I've used another VS (2022 Preview) on the same project and probably it messed up with the compiler directory/version.Hardy
What is wrong with VS 2019? This simple method will kill the error.Langdon
M
210

NOTE: If you are not interested in using Roslyn, follow this answer and remove it

The Roslyn:

Your build is trying to find \bin\roslyn\csc.exe because the following packages have been added to your project. Just review your packages.config file, you can have both of them there

Microsoft.CodeDom.Providers.DotNetCompilerPlatform
Microsoft.Net.Compilers

What is Roslyn and Who added them(packages) in the project : If you’re using .net Framework 4.5.2 to create projects using VS2015, you might have noticed that the project templates use Roslyn by default. Actually, Roslyn is one of open-source compilers for .NET languages from Microsoft.

Why should we delete Roslyn: If your project has Roslyn references and you are interested to deploy it on the server, you will get unwanted errors on the website as many hosting providers still have not upgraded their servers and hence do not support Roslyn. To resolve this issue, you will need to remove the Roslyn compiler from the project template.

How to remove it:

1. Remove NuGet packages, use the following commands from Nuget Package Console

PM> Uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
PM> Uninstall-package Microsoft.Net.Compilers

2. After you do this, your web.config file should be auto-updated. In case it is not, look for the below code in web.config file and if it is found, delete this piece of code.

<system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"></compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"></compiler>
    </compilers>
</system.codedom>
Motherland answered 29/7, 2016 at 22:20 Comment(10)
I have deleted all but still getting that error any idea?Adnah
This isn't really a solution if you actually want to use the new compiler and the new features.Zr
You're advocating against the future.Nadinenadir
This worked for me, but only after I replaced all usages of "nameof" and some other C# 6 features. I agree with @Nadinenadir that it would be best to keep up, but I don't have much sway on which versions of the .NET framework are available on our web server.Rew
@Nadinenadir why is it the future? I just think it should be straigthforward to use, but it looks many people are having troubles with it.Galantine
@Alisson - Roslyn is the direction things are going in. It contains newer language features, is more performant, cross-platform, and open source. It came out after the other tools - hence future. Nothing says you need to use it, most upgrades incur some cost. See the "Why Roslyn compilation in ASP.NET?" section: blogs.msdn.microsoft.com/webdev/2014/05/12/…Nadinenadir
@Nadinenadir I apologize if I expressed myself in a bad way, I just like to understand the benefits of things, rather than using just for the sake of it. If I understood correctly, if I used c# 7 features, I'd need Roslyn in order to build the project. Is that correct?Galantine
@Alisson no worries, didn't take anything in a bad way. Difficult to say the exact feature set since it varies across versions of each compiler over time, but yes you will get new language features sooner on Roslyn. I've personally used it to get the ability to write c# 7 syntax in razor views.Nadinenadir
I only removed <system.codedom> block from production web.config & my application starts running like a charm.Catchword
if you want to publish MVC project to GoDaddy shared windows hosting, this is the answer. GoDaddy does not run executables like csc.exeSensibility
G
67

Too late for an answer but still posting incase it helps anyone.
Following the below steps fixed the error for me:

  1. delete packages folder
  2. open VS
  3. rebuild
  4. observe that NuGet packages are restored, but bin\roslyn isnt created
  5. unload project
  6. reload project
  7. rebuild
  8. observe that the bin\roslyn has been created now.
Godber answered 1/6, 2020 at 15:55 Comment(2)
Following these steps solved the problem for me. Used Visual Studio 2017.Latterday
This is the only real solution, as it is a Visual Studio related problem, not a csc.exe one.Gillam
D
65

0. The quick fix

As already noted in the currently highest voted answer, the quick fix is to use the package manager, Tools > Nuget Package Manager > Package Manager Console, to run

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r

Packet Manager Console - how to open

1. Code to reproduce the error

Here is code that reproduces the error:
https://user.it.uu.se/%7Ehesc0353/SrvrErr-reproduce.zip
(Originally from https://github.com/aspnet/AspNetDocs/tree/master/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client/sample/server/ProductsApp)

Consider trying the example code provided in the zip file above.
If no changes are made, Ctrl+F5 will reproduce the error.

Server Error '/' in Application

2. A more robust solution

An alternative solution is to remove an attribute from the project's Web.config file.
(Web.config is in the same directory as the .csproj file.)
This will automatically and silently recreate your packages if they are missing.

Open the Web.config file in a text editor or in Visual Studio.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings></appSettings>
  ...
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
</configuration>

In the tag configuration > system.codedom > compilers > compiler language="c#;cs;csharp", completely remove the type attribute. – In short, remove the line that starts with type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, . 1

Visual Studio will take care of the rest. – No more Server Error in '/' Application.

3. HTTP Error 403

In the example provided above, hitting Ctrl+F5 will now result in an HTTP Error 403.

HTTP Error 403.14 - Forbidden

Try replacing http://localhost:64195 in your web browser with http://localhost:64195/api/products. The web API now displays correctly:

A web API containing products


As a provocation, I tried removing the whole package directory from the Visual Studio project.
It was automatically and silently recreated as soon as the project was rebuilt.

References


1 Presumably, the same fix works for Visual Basic as well as for C#, but I haven't tried it.

Dorsey answered 4/10, 2019 at 14:45 Comment(2)
Similar: Could not find file … bin\roslyn\csc.exe.Dipody
This solved my problem, point number 2 fixed the issue! thank you.Anguilla
D
64

Here is a more MSBuild way of doing this.

<Target Name="CopyRoslynFiles" AfterTargets="AfterBuild" Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'">
    <ItemGroup>
      <RoslynFiles Include="$(CscToolPath)\*" />
    </ItemGroup>
    <MakeDir Directories="$(WebProjectOutputDir)\bin\roslyn" />
    <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>

But I notice that the roslyn files are also in my bin directory (not in a folder). The app seems to work, though.

Deadandalive answered 7/10, 2015 at 23:49 Comment(1)
You can put it anywhere in your .csproj file, at the same level as another <Target> tag. I usually put it toward the bottom.Deadandalive
I
52

As noted in an issue in the Roslyn project on GitHub, a solution (that worked for me) is to simply unload and reload the project in Visual Studio.

The "bin\roslyn" folder wasn't created on build or rebuild until I reloaded the project.

Invalid answered 3/5, 2019 at 7:23 Comment(0)
H
34

I followed these steps and it worked perfectly

  • Delete all the bin and obj folders
  • Clean solution and rebuild
  • Run this command in powershell

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r

Hexastich answered 24/1, 2019 at 7:19 Comment(0)
A
33

I was also having same issue while running the project. Here are the steps that I followed.

  1. Right click in solution
  2. select Clean solution
  3. After clean succeeded,Again build your project
  4. Run the project again

This time I didn't see the same error. This works as expected.

Allometry answered 4/8, 2017 at 6:25 Comment(0)
K
26
  1. Clean Solution
  2. Rebuild Solution ,These two steps worked for me.
Kaplan answered 2/4, 2019 at 18:42 Comment(2)
Works. I accidentally pressed Ctrl C when I was in the middle of checking out a branch in git and it screwed my repo up. git reset --hard didn't work, so I git clean -xdf and had to rebuild the project. However I ran into this error so I simply cleaned and rebuilt the project again and it worked for me.Halophyte
This answer already existed for years before you posted it.Deepen
R
24

After trying all of the fixes with no cigar I fixed it by updating this Nuget Package in Visual Studios:

Microsoft.CodeDom.Providers.DotNetCompilerPlatform

Mine was from 1.0.0 to 2.0.0 for reference (The error no longer shows)

Ricky answered 12/7, 2018 at 14:34 Comment(1)
I did this too. Now the roslyn folder is created in my output path. I also see no "roslyn" reference in my csproj. It could be that Target Name="CopyRoslyn... is a VS2015 thing and not necessary in (the version of) 2017 I have. Worth to note: Since I updated DotnetCompilerPlatform before I played around with adding a copying target (the one I mentioned) I have a cleaner csproj.Ephemerality
Z
19

NuGet Package Manager

You need to install Microsoft.CodeDom.Providers.DotNetCompilerPlatform.BinFix, was especially created for that error

Zulazulch answered 19/3, 2018 at 13:57 Comment(4)
This didn't work - I suspect that package is not actually for this exact purpose.Eat
I tested with VS 2017 and it works fine, it could be an issue with other versions.Orellana
I am not installing random packages from random person with 'dsx' as nickname. That is big security no...Dyan
@Dyan or one that would fix my non-APS.NET [sic] folder structureTumultuous
B
19
  • Right click on your project and select Manage Nuget Packages
  • Find "Microsoft.CodeDom.Providers.DotNetCompilerPlatform"
  • Simply Update to an older or newer version (doesn't matter which), and then update again back to your original version.

This re-installs all the dependencies and files of the package (like csc.exe)

Nuget - DotNetCompilerPlatform

Beal answered 26/2, 2019 at 15:55 Comment(1)
thanks, downgrading to 3.11.0.0 worked for me. I think there is something wrong with the latest new version, 4.1.0Gospodin
H
19

For VS 2019 remove the following node completely:

<system.codedom>
</system.codedom>
Haiku answered 12/1, 2020 at 15:22 Comment(0)
I
18

In my case, before trying any of the other solutions, I switched to a "Release" configuration, rebuilt (the folder got created) and then switched back to "Debug", while the folder remained intact.

This was a checkout from source control of an older solution and apparently the original (automatic) package restore and building the project didn't create that folder in the bin directory.

Note that at time of writing this, the blamed component has reached v.2.

Iverson answered 14/10, 2020 at 19:46 Comment(0)
B
14

Updating nuget packages worked for me Right click on the solution > Manage NuGet packages for solution and update all the packages and specially: Microsoft.Net.Compilers and Microsoft.CodeDom.Providers.DotNetCompilerPlatform

Broth answered 29/11, 2016 at 22:52 Comment(0)
A
12

This is a known issue with Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.6. Downgrading to 1.0.5 fixed this for me.

Aramanta answered 11/8, 2017 at 13:25 Comment(0)
A
11

So, Rob Cannon's answer essentially worked for me, but I had to tweak a handful of the options. Specifically, I had to remove the condition on the target, as well as change the Include attribute, as $CscToolPath was empty when the project was being built on our build server. Curiously, $CscToolPath was NOT empty when running locally.

<Target Name="CopyRoslynFiles" AfterTargets="AfterBuild" >
  <ItemGroup>
    <RoslynFiles Include="$(SolutionDir)packages\Microsoft.Net.Compilers.1.1.1\tools\*" />
  </ItemGroup>
  <MakeDir Directories="$(WebProjectOutputDir)\bin\roslyn" />
  <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)\bin\roslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>
Asthmatic answered 15/1, 2016 at 19:58 Comment(3)
The behavior is even worse. Locally, if you go to your package folder and delete the two folders Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.n.n and build you code, then the $CscToolPath will be empty. If you build a second time, then it'll not be empty. The problem happens all the time on your build server, because it is always considered as a "first build". Your code works perfectly, but if you update the Microsoft.Net.Compilers package, then you'll have to update the .csproj. Thank you.Geminian
Note that this solution will fail (or has to be adjusted) if the Microsoft.Net.Compilers's version changes.Whittling
I upgraded the Microsoft.CodeDom.Providers.DotNetCompilerPlatform and then was able to proceed.Joppa
H
11

In my case I have had issue in Jenkins when it tried to deploying it in Octopus with following error:

MSBUILD : OctoPack error OCT-1676060969: Failed to build the path for '\bin\roslyn\csc.exe' relative to 'T:\workspace\machine.engine\Machine.engine.Test': Invalid URI: The format of the URI could not be determined.. See the inner exception for more details. [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969: System.Exception: Failed to build the path for '\bin\roslyn\csc.exe' relative to 'T:\workspace\machine.engine\Machine.engine.Test': Invalid URI: The format of the URI could not be determined.. See the inner exception for more details. ---> System.UriFormatException: Invalid URI: The format of the URI could not be determined. [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at System.Uri..ctor(String uriString) [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at OctoPack.Tasks.Util.OctopusPhysicalFileSystem.GetPathRelativeTo(String fullPath, String relativeTo) in Z:\buildAgent\workDir\20ba9f2e0d5e4022\source\OctoPack.Tasks\Util\OctopusPhysicalFileSystem.cs:line 211 [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    --- End of inner exception stack trace --- [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at OctoPack.Tasks.Util.OctopusPhysicalFileSystem.GetPathRelativeTo(String fullPath, String relativeTo) in Z:\buildAgent\workDir\20ba9f2e0d5e4022\source\OctoPack.Tasks\Util\OctopusPhysicalFileSystem.cs:line 224 [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at OctoPack.Tasks.CreateOctoPackPackage.AddFiles(XContainer nuSpec, IEnumerable`1 sourceFiles, String sourceBaseDirectory, String targetDirectory, String relativeTo) in Z:\buildAgent\workDir\20ba9f2e0d5e4022\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 443 [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at OctoPack.Tasks.CreateOctoPackPackage.Execute() in Z:\buildAgent\workDir\20ba9f2e0d5e4022\source\OctoPack.Tasks\CreateOctoPackPackage.cs:line 190 [T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj]
Done Building Project "T:\workspace\machine.engine\Machine.engine.Test\Machine.engine.Test.csproj" (default targets) -- FAILED

Cause

After spending some time, I was using an internal developed component that was using Microsoft.Net.Compilers. The reason the internal component was using Microsoft.Net.Compilers was to overcome this issue (C#: throw invalid expression compilation) and was solved this way (How to use C# 7 with Visual Studio 2015?). This result in, when I installed the component on the main program, the Microsoft.Net.Compilers get added it selves automatically.

Solution

My work around was, uninstall following from our internal component by (following @malikKhalil answer)

PM> Uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
PM> Uninstall-package Microsoft.Net.Compilers

And chose C# 7 compiler in Jenkins instead of C# 6 and rebuild, this is to ensure everything is working and building correctly.

Than finally in my main program I tried to update my internal component. And everything than build again. It has built without any problems or issues.

Hierology answered 2/2, 2018 at 11:30 Comment(0)
H
10

Per a comment by Daniel Neel above :

version 1.0.3 of the Microsoft.CodeDom.Providers.DotNetCompilerPlatform Nuget package works for me, but version 1.0.6 causes the error in this question

Downgrading to 1.0.3 resolved this issue for me.

Haskins answered 9/8, 2017 at 15:43 Comment(2)
1.0.6 has a bug: github.com/aspnet/RoslynCodeDomProvider/issues/13Admiral
1.0.7 is still affected in certain scenarios github.com/aspnet/RoslynCodeDomProvider/issues/17Adhere
K
9

In my case I just needed to go to the bin directory in Visual Studio Solution Explorer (web application project) and include the roslyn project directly. By right clicking the folder and selecting Include In Project. And check in the solution again to trigger the build process.

The roslyn folder was not included by default.

Kitchenmaid answered 6/11, 2015 at 18:10 Comment(0)
A
9

Upgrading Microsoft.CodeDom.Providers.DotNetCompilerPlatform from 1.0.0 to 1.0.1 fixed this for me.

Alika answered 13/8, 2016 at 21:28 Comment(0)
H
8

If you were adding ASPNETCOMPILER to compile your Razor views in MVC, like in this StackOverflow question, then change PhysicalPath to place where Roslyn nuget package is located (usually pointed via $CscToolPath variable):

<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(CscToolPath)" />

Hyson answered 3/5, 2016 at 10:8 Comment(0)
C
8

In my case by just Deleting everything inside the bin folder and recompiling did all the work for me.

Centeno answered 9/5, 2019 at 20:26 Comment(3)
I think this is more simple and effective. Usually I get this error after cloning a project from a repository into a new computir.Ashia
After trying this, I got 403 Forbidden from IIS Express when running in the debugger. Restarting Visual Studio did not help, either, but rebooting Windows did.Dido
This repeats the answer from user1903050 from a few years prior. And the answer from MasoudDeepen
S
7

In my case, similar to Basim, there was a NuGet package that was telling the compiler we needed C# 6, which we didn't.

We had to remove the NuGet package Microsoft.CodeDom.Providers.DotNetCompilerPlatform which then removed:

  1. <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" /> from the packages.config file
  2. <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> </compilers> </system.codedom>

In the system.codedom node, you can see why it was bringing in roslyn: compilerOptions="/langversion:6

Sage answered 18/2, 2016 at 14:15 Comment(2)
All I had to do was uninstall the NuGet package "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" and that solved it for me (my project targets .NET 4.5.2).Eldoree
This worked for me. You'll also want to remove Microsoft.Net.Compilers as there is no reason to keep this additional dependency around either.Zachariahzacharias
T
7

The problem with the default VS2015 templates is that the compiler isn't actually copied to the {outdir}_PublishedWebsites\tfr\bin\roslyn\ directory, but rather the {outdir}\roslyn\ directory. This is likely different from your local environment since AppHarbor builds apps using an output directory instead of building the solution "in-place".

To fix it, add the following towards end of .csproj file right after xml block <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">...</Target>

<PropertyGroup>
  <PostBuildEvent>
    if not exist "$(WebProjectOutputDir)\bin\Roslyn" md "$(WebProjectOutputDir)\bin\Roslyn"
    start /MIN xcopy /s /y /R "$(OutDir)roslyn\*.*" "$(WebProjectOutputDir)\bin\Roslyn"
  </PostBuildEvent>
</PropertyGroup>

Reference: https://support.appharbor.com/discussions/problems/78633-cant-build-aspnet-mvc-project-generated-from-vstudio-2015-enterprise

Terriss answered 4/4, 2016 at 14:54 Comment(1)
The /d option copies only newer files (stands for "date"). Keep in mind deploying into cloud/azure where the time could be behind/in front of the local time.Tito
S
7

Open the project file and remove all references with Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0....

Open web.config and remove all system.codedom compilers attributes

Simony answered 12/5, 2016 at 14:21 Comment(0)
O
7

Delete the Bin folder in your solution explorer and Build the solution again. That would solve the problem

Omnivore answered 16/12, 2016 at 15:51 Comment(0)
W
7

I had the same problem when installing my application on the server when everything worked perfectly on localhost.

None of these solutions woorked, I always had the same error:

Could not find a part of the path 'C:\inetpub\wwwroot\myApp\bin\roslyn\csc.exe'

I ended up doing this:

  • on my setup project, right clic, view > file system
  • create a bin/roslyn folder
  • select add > files and add all files from packages\Microsoft.Net.Compilers.1.3.2\tools

This solved my problem.

Wandy answered 13/2, 2017 at 14:36 Comment(0)
B
5

I have webproject without csproj file and solutions mentiond here did not work for me.

Changing target .NET framework, reinstalling packages (Update-Package -reinstall) and then building the project worked for me. You can even change target framework back after this operation(make suere you reinstall nuget packages again after).

Battleplane answered 15/3, 2018 at 12:20 Comment(1)
This is a "website project". I used this command to just reinstall the one package: update-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -reinstallHitormiss
F
4

Other than deleting the Bin diretory from all projects inside the solution, delete the obj folders too.

In the main solution diretory remove the folder .vs

Worked for me when trying to bring an already done project into a blank solution created on git.

Farver answered 13/3, 2018 at 17:11 Comment(0)
B
4

In my case I had this issue when i was running two visual studio IDE simultaneously. So the solution was to clean the project and close the other instance.

Brahmanism answered 12/2, 2019 at 23:37 Comment(0)
D
4

Reboot Windows.

This is the only solution that worked for me after trying rebuild, delete contents of bin and rebuild, restart Visual Studio.

It's yet another example of how terrible C#/.NET build tools are.

I think (after reading many of the answers), the overall conclusion is that the cause and solution of this problem heavily depends on the setup and project, so if one answer does not work, just try another. Try non-intrusive/destructive solutions, such as restarting Visual Studio, rebooting, rebuilding, etc., FIRST, before messing with NuGet packages or reinstalling development tools. Good luck!

(NOTE: Using Visual Studio 2019, and project file was originally created in Visual Studio 2015. Maybe this helps someone investigate the issue)

(EDIT: Could this be caused by not rebooting after installing/modifying the Visual Studio installation or updating Visual Studio when the installer prompts to reboot?)

Dido answered 1/7, 2019 at 13:41 Comment(1)
closing visual studio and deleting the contents from the bin folder and rebuild/clean solution or project fixed this issue.Whittle
R
4

I tried multiple top answers until the below steps worked (ASP.NET project targeting .NET Framework 4.6.2, Visual Studio 2019 on a system with crazy restrictive group policies, March 2021).

I needed to:

  • run VS as Admin

  • in package manager console run

    Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -v 2.0.1
    
  • Clean & Rebuild Solution

Without running VS as Admin, group policies blocked ps1 scripts that Update-Package needed to run.

PS. Before this worked, I tried numerous other answers (and ran git reset --hard after they failed). I do not know if any of them contributed to this eventually working. I tried:

Russo answered 30/3, 2021 at 11:8 Comment(0)
H
4

For those struggling through this when compiling on the build server (TFS or Bamboo), I was able to solve this by removing the "clean" option from the "/t:" msbuild options.

Headship answered 20/8, 2021 at 14:48 Comment(0)
A
3

my solution is using Nuget to update below items to latest version: - Microsoft.Net.Compilers - Microsoft.CodeDom.Providers.DotNetCompilerPlatform Then rebuilt the project. Since my project is a website so no *.csproj file. The error above appears when I tried to view a cshtml in browser.

The error fixed after the two items above updated to latest version. I am in VS2015 and windows7 SP1

Andel answered 28/1, 2018 at 10:9 Comment(0)
P
3

I had this issue on the server I was deploying to, and determined that I did not need

Microsoft.CodeDom.Providers.DotNetCompilerPlatform

So, I uninstalled it via nuget, and removed the reference in the web config. No more issues.

I originally tried to added target node to the .proj file as mentioned in some of the other answers, but that just lead to another error where the msbuild could not copy the pagefile.sys which seemed from what I read to be a bug in the nuget package.

Premature answered 3/10, 2019 at 22:44 Comment(2)
Thanks for this. That worked for me. Just wondering if you know why DotNetCompilerPlatform was added in the first palce, what package usually adds this?Coparcenary
@Coparcenary it is a default for MVC/WebAPI projects and I believe it is used for dynamic compilation. Replacement CodeDOM providers that use the new .NET Compiler Platform ("Roslyn") compiler as a service APIs. This provides support for new language features in systems using CodeDOM (e.g. ASP.NET runtime compilation) as well as improving the compilation performance of these systems.Premature
I
3

The following solved this issue for me:

  • Updating to the latest version of Visual Studio 2017 (using the installer app)

  • Clean and rebuild the solution

Indicative answered 25/1, 2020 at 1:22 Comment(1)
Clean & rebuild was enough for me since I already have VS2017Jacobean
B
2

Add PropertyGroup to your .csproj file

<PropertyGroup>
  <PostBuildEvent>
    if not exist "$(WebProjectOutputDir)\bin\Roslyn" md "$(WebProjectOutputDir)\bin\Roslyn"      
    start /MIN xcopy /s /y /R "$(OutDir)roslyn\*.*" "$(WebProjectOutputDir)\bin\Roslyn"
  </PostBuildEvent>
</PropertyGroup>
Baculiform answered 13/5, 2016 at 9:8 Comment(1)
Didn't work for me, all variables are undefined (empty)Tito
A
2

I had this error for Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.06 but also with 1.0.7 that worked for @PrisonerZERO. However when Microsoft released 1.0.8 2017-10-18 it finally started working for me again and I did not have to downgrade.

https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform/

Alcott answered 14/2, 2018 at 13:2 Comment(0)
A
2

On my case, i Noticed that the "build" folder was not present in "packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0" path. And that was the reason why the roslyn folder was not beeing created.

So the solution for me was:

  1. Clean solution
  2. Go to Nuget Package Manager
  3. Uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform
  4. Clean solution
  5. Install Microsoft.CodeDom.Providers.DotNetCompilerPlatform again from Nuget package manager.
  6. Clean/Rebuild

And there you go. None of the solution above worked for me . Hope this helps anyone

Ault answered 31/1, 2022 at 14:30 Comment(1)
This seems to repeat many answers already present.Deepen
I
2

I had a project running in VS2019 and then i open(in VS2019) another project for the first time and i got the above issue. what I did as follow:

  1. I close the running project,
  2. Clean and rebuild the new project

Only point no. 2 was not working for me.

Interpretative answered 10/1, 2023 at 3:53 Comment(0)
B
2

enter image description here

Change Target Framework in properties and then rebuild project Or build project then Unload and Reload project and then rebuild again.

Bromidic answered 5/8, 2023 at 19:17 Comment(0)
E
1

To prevent the build from also copying the Roslyn files to the bin directory, you have to also comment out this line that gets placed at the top of your Web application project:

<!--  <Import Project="..\..\..\DAS\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\..\..\DAS\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.1\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" /> -->
Ephesians answered 17/12, 2015 at 20:57 Comment(0)
B
1

I ran into this problem after updating some packages through NuGet. A rebuild (instead of a normal build) has worked for me.

Bassorilievo answered 14/8, 2017 at 9:45 Comment(0)
P
1

I had the same problem after updating DotNetCompilerPlatform. Solved by Restarting Visual Studio > Clean Project > Build Project.

Portingale answered 23/8, 2017 at 17:26 Comment(0)
U
1

FYI...

As of 8/31/2017 upgrading to Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.7 is works.

Unseal answered 31/8, 2017 at 18:28 Comment(0)
B
1

This can be done in the following easy way-:

  • Create a new project of similar type anywhere in your system. Build it and copy over the roslyn folder to your bin directory.
Bullheaded answered 26/11, 2017 at 17:20 Comment(0)
D
1

A lot of these answers are referring to the Nuget packages and/or cleaning and reloading your project.

If you have WCF service references and invalid endpoints, you can also get this error message. Make sure your endpoints are correct and update the service configuration with the correct endpoint in the .config and when you configure the service reference from the GUI.

Image of Service Reference Configuration GUI

Dimple answered 30/4, 2019 at 17:13 Comment(0)
L
0

I had to change the WebAPI and MVC project files to not build views:

<MvcBuildViews>false</MvcBuildViews>

This resolved my TFS 2015 Build server error with roslyn. Still not sure why csc.exe was copied to \bin\csc.exe, yet the publish process was looking for \bin\Roslyn\csc.exe...couldn't find the transformation causing that discrepancy.

Lycian answered 21/10, 2016 at 18:13 Comment(0)
F
0

I experienced this error on a Jenkins build server running MSBuild, which outputs the build files to a separate folder location (_PublishedWebsites). Exactly the same - the roslyn folder was not in the bin directory, and all the roslyn files were lumped in with the bin files.

@igor-semin 's answer was the only thing that worked for me (as I am using the C# 6 language features, I cannot simply uninstall the nuget packages as per other answers), but as I am also running CodeAnalysis, I was getting another error on my deployment target server:

An attempt to override an existing mapping was detected for type Microsoft.CodeAnalysis.ICompilationUnitSyntax with name "", currently mapped to type Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax, to type Microsoft.CodeAnalysis.VisualBasic.Syntax.CompilationUnitSyntax.

The reason for this is that as the roslyn files are getting dumped into the main bin directory, when you run the xcopy to recreate them in the nested roslyn folder, you now have 2 copies of these files being compiled and there is a clash between them. After much frustration I decided on a 'hack' fix - an additional post-build task to delete these files from the bin directory, removing the conflict.

The .csproj of my offending projects now looks like:

................... more here ......................

 <PropertyGroup>
   <PostBuildEvent>
   if not exist "$(WebProjectOutputDir)\bin\Roslyn" md "$(WebProjectOutputDir)\bin\Roslyn"
   start /MIN xcopy /s /y /R "$(OutDir)roslyn\*.*" "$(WebProjectOutputDir)\bin\Roslyn"
 </PostBuildEvent>
</PropertyGroup>
<Target Name="DeleteDuplicateAnalysisFiles" AfterTargets="AfterBuild">
   <!-- Jenkins now has copies of the following files in both the bin directory and the 'bin\rosyln' directory. Delete from bin. -->
   <ItemGroup>
     <FilesToDelete Include="$(WebProjectOutputDir)\bin\Microsoft.CodeAnalysis*.dll" />
   </ItemGroup>
   <Delete Files="@(FilesToDelete)" />
</Target>

................... more here ......................

Frown answered 21/12, 2016 at 11:32 Comment(0)
M
0

I ran into this issue with the publishing pipeline (which produces a _PublishedWebsites directory), and used this as a Target in the project:

<Target Name="CopyRoslynCompilerFilesToPublishedWebsitesDirectory" AfterTargets="AfterBuild" Condition="Exists('$(OutDir)\_PublishedWebsites\$(TargetName)')">
    <Copy SourceFiles="@(RoslyCompilerFiles)" DestinationFolder="$(OutDir)\_PublishedWebsites\$(TargetName)\bin\roslyn" ContinueOnError="true" SkipUnchangedFiles="true" />
</Target>

The downside is that there will be two copies of the Roslyn files in the output.

Microbicide answered 22/6, 2017 at 6:7 Comment(0)
G
0

I had this error after renaming a solution and some included projects, and playing around with removing nuget packages. I compared the new project with the last working project, and found the following lines were missing and needed to be added back in:

  <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
  <Import Project="..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" />
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />

Doing so resolved the issue for me.

Grenier answered 31/7, 2017 at 12:58 Comment(0)
W
0

In my situation, our team don't want to keep 'packages' folder, so we put all dlls in other directory like 'sharedlib'.

I used build event to solve this problem.

if "$(ConfigurationName)" == "Release" (
goto :release
) else (
goto:exit
)

:release
if not exist $(TargetDir)\roslyn mkdir $(TargetDir)\roslyn

copy /Y "$(ProjectDir)..\..\Shared Lib\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\tools\Roslyn45\*" "$(TargetDir)\roslyn"
goto :exit

:exit
Workroom answered 26/7, 2019 at 3:23 Comment(0)
C
0

None of the other answers worked for me. After doing a folder compare before/after vs my expected committed files, i discovered that GIT was ignoring a required folder. If you are tracking the compiler in a repository, make sure the BUILD folder is tracked. If it's not, the compiler won't ever be built and will throw this exact error after publish. I added this line to my .gitignore file:

!**/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1/build/

and now it's deploying to other computers properly.

Cloninger answered 17/10, 2019 at 15:8 Comment(0)
S
-1

Issue

Be aware that the NuGet PM breaks the Rosalyn behavior. Click Tools > NuGet Package Manager > Manage NuGet Packages for Solution If an update Exists for Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Microsoft.Net.Compilers, or Microsoft.Net.Compilers.netcore, update them and the Solution will break! This occurs because the ASP Sites templates are set to use specific versions at project creation. To See the problem, click Show All Files in the Solution Explorer.

Fix

At project creation the $(WebProjectOutputDir)\bin doesn't exist, therefore when Rosalyn is added as a dependency by NuGet it installs it properly. After Updating the Solution Packages, the $(WebProjectOutputDir)\bin directory looks like so:

$(WebProjectOutputDir)\bin\bin\rosalyn

The easiest fix is to Cut & Paste rosalyn to the proper location, and then delete the extra bin folder. You can now Refresh the page and the site will load.

Shipboard answered 28/7, 2016 at 20:1 Comment(0)
W
-1

The answer for this is different for Website project and Web application Project. The underlying issue is same that NuGet package is behaving differently on different machine. It may be rights issue or some execution policy which stops it from copying to Bin folder As you know Roslyn is new compiler. you should have it in Bin folder for these Projects Go to your website NuGet Packages check this Folder Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0 \code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0 Do you see it ? Can you see code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\tools\RoslynLatest in it Now as part of compiling this Folder should get copied to your website under bin like this. \code\WebSite1\Bin\Roslyn some how that is not happening for you . Try running Visual studio as Admin . Copy Roslyn folder manually. Try uninstall and install of NuGet Package. Remember this package compile your folder and if its not there you cannot compile anything and so you cannot add anything too. Try copying this package to offline version tools -> options-> nuget package Manager->Package source-> Microsoft Visual Studio Offline Packages C:\Program Files (x86)\Microsoft SDKs\NuGetPackages

Wifely answered 28/2, 2019 at 19:8 Comment(0)
M
-1

Install nudget package: Microsoft.CodeDom.Providers.DotNetCompilerPlatform.BinFix https://www.nuget.org/packages/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.BinFix/1.0.0

Mylander answered 21/5, 2021 at 10:36 Comment(0)
Q
-1

I was also facing same issue got resolve by running the below command in nuget console

Install-Package Microsoft.Net.Compilers -Version 3.3.1

Quiddity answered 11/1, 2022 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.