从文件内部强制使用MSBuild创建工具版本? [英] Force a tool version with MSBuild from inside the file?

查看:75
本文介绍了从文件内部强制使用MSBuild创建工具版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将项目移到了.NET 4.0,在构建内部运行ASP.NET编译器时遇到了一些麻烦.这是行不通的,因为默认情况下,MSBuild在运行ASP.NET编译器时会使用旧的工具版本.

I've moved my project over to .NET 4.0 recently, and am having some trouble running the ASP.NET compiler inside of my build. This doesn't work because MSBuild by default uses an old tools version when running the ASP.NET Compiler.

我已经能够通过明确指定工具版本来解决它(是的,我正在运行MSBuild 4.0),如下所示:

I've been able to address it my specifying the tools version explicitly (yes, I'm running MSBuild 4.0) like so:

msbuild /t:MyTarget /tv:4.0 mybuildfile.msbuild

我可以在构建文件本身中使用任何指令吗?

Is there any directive I can use from within the build file itself which will allow me to call msbuild in a more plain vanilla fashion like so?

msbuild /t:MyTarget mybuildfile.msbuild

推荐答案

在msbuild文件中将项目ToolsVersion设置为4.0:

Set the project ToolsVersion to 4.0 in your msbuild file :

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   ...
</Project>

这篇关于从文件内部强制使用MSBuild创建工具版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆