我正面临一个来自roslyn编译器的奇怪问题.有时当我构建解决方案时,我在错误列表中面临一个奇怪的问题,这不会让我构建解决方案.这是错误:
严重级代码说明项目文件行抑制状态错误无法将文件"D:\ Sealogical New Website\SealogicalWebsite\packages\Microsoft.Net.Compilers.1.0.0\tools\csc.exe"复制到"bin\roslyn\csc.exe" ".访问路径'bin\roslyn\csc.exe'被拒绝.SealogicalWebsite
严重级代码说明项目文件行抑制状态错误无法将文件"D:\ Sealogical New Website\SealogicalWebsite\packages\Microsoft.Net.Compilers.1.0.0\tools\VBCSCompiler.exe"复制到"bin\roslyn\VBCSCompiler.exe" ".访问路径'bin\roslyn\VBCSCompiler.exe'被拒绝.SealogicalWebsite
我尝试清理解决方案并重建它但不再工作.
试图手动删除文件,但再次显示错误指出我没有权限执行此操作:
尝试删除CMD但再次显示相同的错误:
删除roslyn生成的文件的唯一方法是重新启动PC,重启后我可以手动删除它们没有问题.
我是我的电脑的管理员,所以我猜没有问题.
这个问题似乎发生在Visual Studi0 2015和Visual Studio 2017中.
我不喜欢每天重启PC 4-5次或更多,这就是我在这里问的原因.
其他一些细节:
我是创建这个项目的人,所以理论上做这个动作应该不是问题.
当项目第一次创建时,我确实以管理员模式运行Visual Studion,正如我现在所做的那样.
bin/roslyn/csc和bin/roslyn/VBCSCompiler.我可以找到一个从web.config中删除此部分的解决方案,因此它不会生成这些文件:
<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=\"Web\" /optionInfer+" />
</compilers>
Run Code Online (Sandbox Code Playgroud)
但是这个解决方案会导致新的c#6功能出现问题,所以我无法删除此部分.....
此外,我在CMD中尝试了这个命令来查看是否存在锁定此文件的进程,但无论如何它根本没有显示任何进程:
C:\WINDOWS\system32>tasklist /m D:\SealogicalNewWebsite\SealogicalWebsite\SealogicalWebsite\bin\roslyn\csc.exe
INFO: No tasks are running which match the specified criteria. …Run Code Online (Sandbox Code Playgroud) 这是我自己的定制nuget包,我还没有发布并在本地测试.
nuget包由dll文件和nuspec文件组成,如下所示.
<?xml version="1.0"?>
<package >
<metadata>
<id>MyLib</id>
<version>1.0.0</version>
<authors>Author</authors>
<owners>Owner</owners>
<licenseUrl>license url</licenseUrl>
<projectUrl>project url</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>some description</copyright>
<tags>Tag1 Tage2</tags>
</metadata>
<files>
<file src="bin\Debug\netstandard1.4\*.dll" target="lib" />
<file src="bin\Debug\netstandard1.4\*.pdb" target="lib" />
</files>
</package>
Run Code Online (Sandbox Code Playgroud)
我已将nupkg文件复制到某个位置并将其添加到
Visual studio Tools -> Options -> Packages -> sources directory
Run Code Online (Sandbox Code Playgroud)
错误:
Package MyLib 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package MyLib 1.0.0 supports: net (.NETFramework,Version=v0.0)
Package restore failed. Rolling back package changes for 'WebApplication1'.
Run Code Online (Sandbox Code Playgroud)
不确定如何解决问题或查找更多信息.
更多信息
dll文件是使用模板(.Net Framework 4.5.2)创建的
Templates -> Visual C# -> .NET …Run Code Online (Sandbox Code Playgroud) 我在寻找间谍++.我相信它应该包含在Visual Studio 2017中,因为最新的Visual Studio帮助内容引用它:https: //docs.microsoft.com/en-us/visualstudio/debugger/introducing-spy-increment.
我刚刚完成了Visual Studio 2017的全新安装,但文件系统中不存在Spy ++.我找不到它.
所以我想在安装Visual Studio以安装Spy ++时需要选择某些"工作流程"?谁知道这是否正确?如果是这样,我需要哪个工作流程/功能?
我知道还有另一个问题确实存在同样的问题,但是我通过了所有这些答案,没有人帮助过我.:((这是问题.)
我刚刚创建了一个新的ASP.NET MVC项目,并在解决方案中加入了一些'.dll'.现在,当我尝试构建项目时,我在5个库中的3个库中收到如下所示的错误消息.
Error CS0006 Metadata file 'C:\Users\...\source\Database\bin\Debug\DataAccessLayer.dll' could not be found Logic C:\Users\...\source\Logic\CSC 1 Active
Error CS0006 Metadata file 'C:\Users\...\source\Logic\bin\Debug\Logic.dll' could not be found PTS2-MVC C:\Users\...\source\PTS2-MVC\CSC 1 Active
Error CS0006 Metadata file 'C:\Users\...\source\PTS2-MVC\bin\PTS2-MVC.dll' could not be found PTS2-MVC.Tests C:\Users\...\source\PTS2-MVC.Tests\CSC 1 Active
Run Code Online (Sandbox Code Playgroud)
当我转到该.dll的bin\debug文件夹时,我看到它是空的,而另一个.dll我没有收到错误消息,不是空的.但我无法解决这个问题或者我为实现这一目标所做的工作.
最常见的回答是去性质的的解决方案,去配置和取消 - > 应用 - > 查询和申请了,但没有奏效
我想知道NuGet.Config文件位于Visual Studio 2017项目中的哪个位置?我试图在项目的根目录中创建自己的NuGet.Config文件,但是我没有找到任何新的存储库(NuGet源代码).有人有任何想法吗?
这是我试图为我的.Net Core项目实现的文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetCore" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
<add key="AspNetCoreTools" value="https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
Run Code Online (Sandbox Code Playgroud) 我刚刚开始在Visual Studio 2017中使用我的旧解决方案.只需打开旧IDE中的解决方案即可无缝工作.c#应用程序项目现在默认为c#7.0编译器.这些项目的属性页面(编译/高级)可以轻松选择编译器的目标语言版本,默认为最新版本.
我找不到在asp.net web项目中启用c#7.0的方法.如果我写一个如下声明:
if (int.TryParse("1", out int myInt)) { ... }
Run Code Online (Sandbox Code Playgroud)
IDE警告我说我需要使用该语言的7+版本.
我对这个主题的研究表明,我应该定位web.config文件的system.codedom编译器区域中的特定c#版本,以便定位最新的Roslyn版本.
我现在拥有的是:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
Run Code Online (Sandbox Code Playgroud)
针对c#6的目标是什么.只要我已经使用nuget下载了最新的Roslyn,c#7的正确设置是什么?
更新 下面是Web项目可用的编译选项的屏幕截图(它是意大利语VS2017,但应该很容易理解).没有可能在那里选择目标c#版本.
我编辑project.csproj.并重新打开发生错误的解决方案:操作失败,因为无法加载项目xxx的详细信息
我尝试删除obj&bin文件夹,通过工具>选项清除nuget缓存.但错误仍然存在.
备注:每次都不会发生错误,我只是重启项目三次.第一个和第二个是正确的.但第三个错误发生
vs2017:Microsoft Visual Studio社区2017版本15.0.26228.9 D15RTWSVC Microsoft .NET Framework版本4.6.01586
程序包管理器控制台主机版本4.0.0.2323
无法执行以下代码错误CS5001程序不包含适用于入口点的静态"主"方法
这个错误信息是什么意思?
class Program
{
static async Task MainAsync(string[] args)
{
Account.accountTest accountTest = new Account.accountTest();
bool result = await accountTest.CreateAccountAsync();
}
}
Run Code Online (Sandbox Code Playgroud) c# console console-application visual-studio-2017 .net-core-2.0
我在VS 2017社区中遇到自动完成问题.
以前我从学校开始使用VS 2017 Enterprise,但是密钥已过期.所以我搬到了社区.
以前,一切都很好,但现在它根本不起作用.
我在这里:在这里 输入链接描述
但是没有用,所以在这里找到另一个解决方案:在这里 输入链接描述
我得到了这个:
建立失败.
C:\ Program Files(x86)\ Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1601,5):错误MSB4036:找不到"GetReferenceNearestTargetFrameworkTask"任务.请检查以下内容:1.)项目文件中任务的名称与任务类的名称相同.2.)任务类是"public"并实现Microsoft.Build.Framework.ITask接口.3.)在项目文件中或位于"C:\ Program Files(x86)\ Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"目录中的*.tasks文件中正确声明任务.0警告1错误
时间流逝00:00:00.11
你知道接下来该做什么吗?
谢谢
目前我在c#中使用web api和net core 2.0制作了微服务
在nutget包中我已经找到了2.1版的net core,我决定安装它,以便更新我的应用程序.我改变了目标,如下所示
但是当我尝试编译时会产生这个bug
该项目使用Microsoft.NETCore.App版本2.1.0进行了恢复,但使用当前设置时,将使用版本2.1.0-rtm-26515-03.要解决此问题,请确保使用相同的设置进行还原以及后续操作(如构建或发布).通常,如果在构建或发布期间设置了RuntimeIdentifier属性,但在还原期间未设置,则会发生此问题.
我的依赖依然如此