我只是想知道如何使用Visual Studio(2005)自动增加我的文件的构建(和版本?).
如果我查找say的属性C:\Windows\notepad.exe,Version选项卡会显示"File version:5.1.2600.2180".我想在我的dll版本中获得这些很酷的数字,而不是版本1.0.0.0,让我们面对它有点沉闷.
我尝试了一些东西,但它似乎不是开箱即用的功能,或者我只是在寻找错误的地方(像往常一样).
我主要从事网络项目....
我看了两个:
我无法相信,做一些事情的努力是标准做法.
编辑: 据我所知,它在VS2005中不起作用(http://www.codeproject.com/KB/dotnet/AutoIncrementVersion.aspx)
我正在使用TFS构建项目来构建一个Visual Studio 2015项目,该项目包含用于编译SASS的gulp文件.我试图了解使用MSBuild任务和任务运行器绑定的事件序列.似乎MSBuild知道足以检测并运行我的默认gulp任务BeforeBuild:
/// <binding BeforeBuild='default' />
var gulp = require('gulp');
var sass = require('gulp-sass');
var importer = require('sass-importer-npm');
gulp.task('sass', function () {
return gulp.src([
'./sass/**/*.scss',
'./node_modules/font-awesome/scss/**/*.scss'
])
.pipe(sass({ importer: importer }).on('error', sass.logError))
.pipe(gulp.dest('./Content/css'));
});
Run Code Online (Sandbox Code Playgroud)
我将使用MSBuild目标在BeforeBuild目标之后运行,以便我可以将生成的文件包含在项目中以供发布:
<Target Name="CopyGulpFiles" AfterTargets="BeforeBuild">
Run Code Online (Sandbox Code Playgroud)
这是我的构建.proj文件中的MSBuild调用,其中包含相关信息:
<ItemGroup>
<ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\MyProject.sln">
<AdditionalProperties>
VisualStudioVersion=$(VisualStudioVersion);
OutputPath=$(OutputRoot);
WebPublishMethod=FileSystem;
publishUrl=$(StageFolder);
DeployOnBuild=false;
DeployTarget=WebPublish;
PublishProfile=$(MSBuildThisFileFullPath)
</AdditionalProperties>
</ProjectsToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectsToBuild)" Properties="Configuration=Dev"/>
Run Code Online (Sandbox Code Playgroud)
每次运行它们时,这两件事似乎都以正确的顺序运行.这提出了一些问题:
我正在向.tt我的项目中添加一个自定义模板生成目标以运行 before CoreBuild,并且似乎有两种方法可以做到:
<Project...>
<Target Name="TransformOnBuild" AfterTargets="BeforeBuild">
</Project>
Run Code Online (Sandbox Code Playgroud)
和
<Project...>
<Target Name="TransformOnBuild" BeforeTargets="CoreBuild">
</Project>
Run Code Online (Sandbox Code Playgroud)
如果我的目标应该在我的项目构建之前运行,因为项目依赖于它,我使用后者会更好吗?我见过前者用来做诸如生成文本模板之类的事情,但这似乎是一种不可靠的方法,因为它可能会在 之后运行CoreBuild,这为时已晚。或者有什么理由为什么AfterTargets="BeforeBuild"仍然保证在核心构建之前运行?
我还看到BeforeTargets="BeforeBuild"哪个会更早构建。这是放置`.tt 文本生成目标的更好地方吗?