C# 在不使用visual studio的情况下使用.NET Framework 4.6.1构建.NET标准库1.4
为了实现自动化,我们尝试在windows server 2012 RC2中使用命令提示符(不含visual studio)使用.NET Framework 4.6.1构建.NET标准库1.4项目 我已在服务器上安装了以下内容C# 在不使用visual studio的情况下使用.NET Framework 4.6.1构建.NET标准库1.4,c#,windows,command-line,msbuild,.net-4.6.1,C#,Windows,Command Line,Msbuild,.net 4.6.1,为了实现自动化,我们尝试在windows server 2012 RC2中使用命令提示符(不含visual studio)使用.NET Framework 4.6.1构建.NET标准库1.4项目 我已在服务器上安装了以下内容 .Net Framework 4.6.1 .Net Framework 4.6.1 Targeting pack Microsoft Build Tools 2015 此.NET标准库项目表示ProjectA与另外两个.NET标准库项目ProjectB和ProjectC一
.Net Framework 4.6.1
.Net Framework 4.6.1 Targeting pack
Microsoft Build Tools 2015
此.NET标准库项目表示ProjectA与另外两个.NET标准库项目ProjectB和ProjectC一起引用
将ProjectA保留为启动项目
当我尝试在dotnet restore之后使用dotnet buildcmd编译ProjectA时,我得到以下错误:
C:\Document\ProjectA>dotnet build
Project ProjectA (.NETStandard,Version=v1.4) will be compiled because
expected outputs are missing
Compiling ProjectA for .NETStandard,Version=v1.4
C:\Program Files\dotnet\dotnet.exe compile-csc
@C:\Document\ProjectA\obj\Debug\netstandard1.4\dotnet-compile.rsp returned
Exit Code 1
C:\Document\ProjectA\Sample.cs(1,17): error CS0234: The type or namespace name
'ProjectB' does not exist in the namespace 'XYZ' (are you missing an
assembly reference?)
C:\Document\ProjectA\Sample.cs(2,17): error CS0234: The type or namespace name
'ProjectC' does not exist in the namespace 'XYZ' (are you missing an
assembly reference?)
Compilation failed.
0 Warning(s)
2 Error(s)
请帮助我从命令提示符编译解决方案。
示例代码:
using XYZ.ProjectB;
using XYZ.ProjectC;
using System;
namespace XYZ.ProjectA
{
public class Sample : ISample
{
public Void GetMessage()
{
var s=XYZ.ProjectB.GetList();
Console.Write("");
}
}
}
ProjectB和projectc也是.Netstandard Lib我通过使用MSBuild构建项目来解决上述问题 正如我前面提到的,在服务器中安装了以下框架之后
1. .Net Framework 4.6.1
2. .Net Framework 4.6.1 Targeting pack
3. Microsoft Build Tools 201
我正试图从未安装Visual Studio的服务器上构建以.NET标准为目标的可移植项目,我设法将以下文件和文件夹从安装了Visual Studio的计算机复制到我的构建服务器上
C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe MySolution.sln
上述步骤帮助我构建了.NET标准库项目,而无需在构建服务器上安装Visual Studio
我希望上面的信息能帮助别人
名称空间“XYZ”中不存在类型或名称空间名称“ProjectB”
这说明了一切!,这些项目没有相同的根命名空间!谢谢你的回复。它存在于同一命名空间中。它在visual studio中正确编译和执行。但在我使用命令提示符进行编译时,它会抛出错误。您需要在问题中包含的ABC.cs
中提供代码。您仍然使用project.json的原因是什么?我强烈建议您更新到最终1.0工具。这会使一切变得更简单。