本文介绍了带有csproj类库的Aspnet Core WebApp:在VS 2015中构建,在VSO中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我有一个简单的问题,它给全球各地的开发人员带来了很多麻烦,但我找不到明确的答案。


我有这个简单的设置:


- 安装的框架:net 461,dotnet core 1.0


- VS 2015与最新的dotnet核心1.0工具


我已创建


- 一个新的Aspnet Core WebApp


- "经典" DLL项目,Csproj1


- 另一个"经典"项目DLL项目,Csproj2,由Csproj1引用。这两个项目都以.NET 4.6.1为框架。


- 我在WebApp中添加了对Csproj1的引用,并将TFM从netcore更改为net461:在project.json中我现在有了


" frameworks":{

" net461":{

" dependencies":{

" Csproj1":{

" target":" project"

}

}

}

},



该解决方案在VS 2015中构建良好。


使用dotnet restore + dotnet run,我不使用CLI构建WebApp,I必须使用nuget restore + dotnet运行与nuget 3.5+。到目前为止,我的想法很清楚,我可以找到很多关于构建这种混合场景的帮助
离线。


现在,来到我真正感兴趣的地方在:尝试使用Visual Studio模板从Visual Studio Online构建它时,它包含2个任务:Nuget Restore + Build Solution,它只是失败:在此步骤中执行以下命令:


2016-08-23T12:36:16.6775539Z CoreCompile:

2016-08-23T12:36:16.6786098Z  C:\Program Files \dotnet \ dotnet.exe build"C:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ --configuration Release --no-dependencies

2016-08-23T12:36:17.8611679Z 欢迎使用.NET Core!
$
2016-08-23T12:36:17.8654269Z  ---------------------


但它失败了,因为没有运行dotnet恢复。


如果我在2之间添加另一个步骤,执行dotnet恢复,它将失败,因为该工具还试图将Csproj1作为nuget包下载,即使在project.json中,依赖的类型是"project"。 。


为了通过反复试验方法达成解决方案,我进行了大量尝试,但无济于事。



那么,这个问题有一个简单而可靠的解决方案吗?提前致谢。



Andrea


解决方案

Hello,

I have a simple problem, which is giving a lot of head aches to developers all around the globe, and yet I couldn't find a definitive answer.

I have this simple setup:

- frameworks installed: net 461, dotnet core 1.0

- VS 2015 with latest dotnet core 1.0 tooling

I've created

- a new Aspnet Core WebApp

- a "classic" DLL project, Csproj1

- another "classic" DLL project, Csproj2, which is referenced by Csproj1. Both projects target framework .NET 4.6.1.

- I've added a reference to Csproj1 from my WebApp, and changed the TFM from netcore to net461: in project.json I now have

"frameworks": {
"net461": {
"dependencies": {
"Csproj1": {
"target": "project"
}
}
}
},

The solution builds fine in VS 2015.

The WebApp doesn't build with the CLI by using dotnet restore + dotnet run, I have to use nuget restore + dotnet run with nuget 3.5+. So far my ideas are clear, and I could find quite a lot of help about building this kind of hybrid scenarios offline.

Now, coming to what I'm really interested in: when trying to build it from Visual Studio Online with the Visual Studio Template, which comprises 2 tasks: Nuget Restore + Build Solution, it just fails: during this step the following command is executed:

2016-08-23T12:36:16.6775539Z CoreCompile:
2016-08-23T12:36:16.6786098Z   C:\Program Files\dotnet\dotnet.exe build "C:\a\1\s\HybridTest\src\HybridTest" --configuration Release --no-dependencies
2016-08-23T12:36:17.8611679Z   Welcome to .NET Core!
2016-08-23T12:36:17.8654269Z   ---------------------

But it fails because dotnet restore was not run.

If I add another step in between the 2, executing the dotnet restore, it will fail because the tool also tried to download Csproj1 as a nuget package, even tho in project.json the type of the dependency is "project".

I performed an enormous number of attempts in order to reach the solution with a trial and error approach, but to no avail.

So, is there a simple and reliable solution to this problem? Thanks in advance.

Andrea

解决方案


这篇关于带有csproj类库的Aspnet Core WebApp:在VS 2015中构建,在VSO中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 14:18