English 中文(简体)
不能找到一条道路......双os鱼。
原标题:Could not find a part of the path ... bin oslyncsc.exe

我正试图管理一个协会。 NET MVC (model-view- Controller) 项目从TFS(Team基金会服务器)源控制中检索。 我增加了所有的大会参考资料,而且我能够成功地建立和汇编,避免任何错误或警告。

但是,在浏览器上我有以下错误:

Could not find a part of the path C:B8akWorkspaceB8akProjectB8akSolutionB8AK.Portalin oslyncsc.exe .

这里是该错误页的全貌。

“entergraph

经过几天的研究,我的理解是,Roslyn是一个提供先进汇编特征的网络汇编平台。 然而,我不理解,为什么我建筑试图在oslyncsc.exe中找到,因为我没有混淆与Roslyn有关的任何东西。 我也不打算在我的项目中使用Roslyn。

最佳回答

违约的VS2015模板问题在于,汇编者是tfrin oslyn <>tfrin oslyn的目录,而是{outdir} oslyn的目录。

在你档案中添加这一法典:

<Target Name="CopyRoslynFiles" AfterTargets="AfterBuild" Condition="!$(Disable_CopyWebApplication) And  $(OutDir)  !=  $(OutputPath) ">
    <ItemGroup>
      <RoslynFiles Include="$(CscToolPath)*" />
    </ItemGroup>
    <MakeDir Directories="$(WebProjectOutputDir)in
oslyn" />
    <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)in
oslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>
问题回答

<>strong>TL;DR

在包裹管理员Console实施:

Update-Packagesoft.CodeDom.Providers.DotNetCompilerPlatform -

www.un.org/spanish/ecosoc 更多信息<>。

这个问题与“演播室视觉”本身无关,因此,提出增加复制档案的步骤的答案相当复杂。 与手工增加汇编本手册合在一起。

Roslyn汇编者来自NuGet包裹,该包裹的某些版本中有/曾经有过ug(我不知道究竟是什么)。 解决办法是将一揽子计划重新注入/提升到免费版本。 最初,在我于2015年写回答复之前,我确定了答案,在具体版本安装了以下包裹:

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

然后,我看上去了.csproj,并确保包裹的道路是正确的(就我的情况而言,是......包装* );在标签栏内,项目和设计;上和<代码>上;Target>,名称为“EnsureNuGetPackageBuildImports” 这一点载于MVC 5和NET Framework 4.5.2。

清洁和重建为我工作!

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

www.un.org/spanish/ecosoc The Roslyn:

你的建筑试图找到<条形状>,因为以下包裹已添加到你的项目中。 仅审查<代码> 包装。 你们都可以在那里有两人。

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.

www.un.org/spanish/ecosoc 如何消除:

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>

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 oslyn isnt created
  5. unload project
  6. reload project
  7. rebuild
  8. observe that the bin oslyn has been created now.

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

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

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.

开放<代码>Web.config文档载于文字编辑或视力室。

<?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.

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


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.

这里是更精干的办法。

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

但我注意到,ros鱼案卷也载于我的双版目录(不是一页)。 但是,似乎工作。

我遵循这些步骤,非常出色地开展工作。

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

Update-Packagesoft.CodeDom.Providers.DotNetCompilerPlatform -

我在管理该项目时也存在同样的问题。 我在此采取的步骤。

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

我当时没有看到同样的错误。 这符合预期。

  1. Clean Solution
  2. Rebuild Solution ,These two steps worked for me.

在尝试所有无香烟的固定装置后,通过在视觉实验室更新这一Nget包:

Microsoft.CodeDom.Providers.DotNetCompilerPlatform

Mine is from 1.0.0 to 2.0.0 for reference (The mis no now show)

“NuGet

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

205. 在2019年5月19日《维也纳行动计划》中,以下条款完全删除:

<system.codedom>
</system.codedom>

在我的案件中,在尝试任何其他解决办法之前,我转而采用“释放”组合,重新构造(fold子制造),然后转而改用“De”,而双手仍然无用。

这是从源头对旧解决方案的控制中进行的检查,而最初的(自动)一揽子方案则在双版目录中恢复和建设该项目。

请注意,在撰写本报告时,被指责的构成部分已达2。

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

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

因此,。 Rob Cannon swer基本上为我工作,但我不得不 t弄一些选择。 具体来说,我不得不取消目标的条件,并改变“包括属性”,因为当项目是在我们的建筑服务器上建造时,CscToolPath是空的。 奇怪的是,CscToolPath在当地经营时是空的。

<Target Name="CopyRoslynFiles" AfterTargets="AfterBuild" >
  <ItemGroup>
    <RoslynFiles Include="$(SolutionDir)packagesMicrosoft.Net.Compilers.1.1.1	ools*" />
  </ItemGroup>
  <MakeDir Directories="$(WebProjectOutputDir)in
oslyn" />
  <Copy SourceFiles="@(RoslynFiles)" DestinationFolder="$(WebProjectOutputDir)in
oslyn" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>

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  in
oslyncsc.exe  relative to  T:workspacemachine.engineMachine.engine.Test : Invalid URI: The format of the URI could not be determined.. See the inner exception for more details. [T:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969: System.Exception: Failed to build the path for  in
oslyncsc.exe  relative to  T:workspacemachine.engineMachine.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:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) [T:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at System.Uri..ctor(String uriString) [T:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at OctoPack.Tasks.Util.OctopusPhysicalFileSystem.GetPathRelativeTo(String fullPath, String relativeTo) in Z:uildAgentworkDir20ba9f2e0d5e4022sourceOctoPack.TasksUtilOctopusPhysicalFileSystem.cs:line 211 [T:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    --- End of inner exception stack trace --- [T:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at OctoPack.Tasks.Util.OctopusPhysicalFileSystem.GetPathRelativeTo(String fullPath, String relativeTo) in Z:uildAgentworkDir20ba9f2e0d5e4022sourceOctoPack.TasksUtilOctopusPhysicalFileSystem.cs:line 224 [T:workspacemachine.engineMachine.engine.TestMachine.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:uildAgentworkDir20ba9f2e0d5e4022sourceOctoPack.TasksCreateOctoPackPackage.cs:line 443 [T:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
MSBUILD : OctoPack error OCT-1676060969:    at OctoPack.Tasks.CreateOctoPackPackage.Execute() in Z:uildAgentworkDir20ba9f2e0d5e4022sourceOctoPack.TasksCreateOctoPackPackage.cs:line 190 [T:workspacemachine.engineMachine.engine.TestMachine.engine.Test.csproj]
Done Building Project "T:workspacemachine.engineMachine.engine.TestMachine.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

我的周围工作是紧接着我们内部部分的工作(回答@malikKhalil)

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

在Jenkins选择C# 7汇编者,而不是C# 6并重建,这就是确保一切工作都正确进行建设。

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.

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

把这个问题降为1.3。

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.

ros鱼的夹子没有被缺席列入。

经过升级的<代码>Microsoft.CodeDom.Providers.DotNetCompilerPlatform从1.0.0到1.0.1对我作了规定。

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)" />

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

在我的案件中,与Basim相似,有一个NuGet包,告诉我们所需要的C# 6,我们这样做了。

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>

在<代码>系统中,编码 页: 1

开放项目档案和remove 所有与进口项目有关的参考资料=”。

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

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

为加以确定,在以下各段的末尾添加以下内容:.csproj file right after xml/2005/4 <Target name=“EnsureNuGetPackageBuildImports” before Targets=“PrepareForBuild”>......</Target>

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

参考:https://support.appharbor.com/discussions/problems/78633-cant-build-aspnet-mvc-project-generated-2015-

删除您的解决方案探索者中的双倍,并再次寻找解决办法。 这将解决问题

我在把我的申请安装在服务器上时也存在同样的问题,因为所有申请都完全在当地进行。

所有这些解决办法都没有被遗忘,我总是有同样的错误:

Could not find a part of the path  C:inetpubwwwrootmyAppin
oslyncsc.exe 

我最后说:

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

这解决了我的问题。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签