Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

msbuild - Build ASP.NET 4.5 without Visual Studio on Build Server

Its been a while since I setup a Build Server so maybe I've forgotten something or maybe .NET 4.5 is different from whatever version I did this with last time, but here is my problem.

I'm trying to setup a build server to monitor a source control repository. Whenever something changes, I want the server to pull the changes and build the project. If there are no errors, I want to deploy the site to a web site running on the build server.

In the past when I did this, I thought that I was able to do this having only .NET installed, but when I try to build this project I get an error that "C:Program FilesMSBuildMicrosoftVisualStudiov11.0WebApplicationsMicrosoft.WebApplication.targets" is missing, and if I go and look I can see that it is missing. In fact there are no Visual Studio 11 targets files.

After a lot of thought and head scratching, I went out and got the "Windows 8/.NET 4.5 SDK" thinking that the .NET 4.5 SDK might install the targets files that I needed, but it did not unless I installed it wrong somehow.

So, what do I need to put on the Build Server in order to get the project to build. I would prefer not to have to install the full Visual Studio 2012.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To run on on your CI server without Visual Studio, you only need to copy a few folders from a development machine to the same location on the CI server. There is no need to install the SDK.

VS 2015:

  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0Web
  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0WebApplications

VS 2013:

  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov12.0Web
  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov12.0WebApplications

VS 2012:

  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0Web
  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0WebApplications

VS 2010:

  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0Web
  • C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0WebApplications

.NET 4.6:

  • C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.6

.NET 4.5.2:

  • C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5.2

.NET 4.5.1:

  • C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5.1

.NET 4.5:

  • C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5

.NET 4.0.1:

  • C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0.1

.NET 4.0:

  • C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0

Or, as Matt suggested, you could copy them into a subdirectory of your project and alter the <MSBuildExtensionsPath32> location in your MSBuild (typically .csproj or .vbproj) file.

Once you have done this, your project will compile.

You should also set the VisualStudioVersion environment variable explicitly to the Visual Studio version (10.0 for VS2010, 11.0 for VS2012, 12.0 for VS2013, 14.0 for VS2015) you are using just to be sure it is set right in your configuration.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...