[英]Command line build solution vs Visual Studio 2012 build
我正在创建CI构建机器。 我使用命令行来构建VS2012解决方案,其中包含许多项目类型(wpf,表单,MFC,c#和c ++)。
我使用以下命令行:
call "%VS110COMNTOOLS%\vsvars32.bat"
devenv.com SolutionName.sln /rebuild "Release|Mixed Platforms"
如果查看构建输出,一切似乎都很好。 与我使用VS时的输出相同,并且100%成功。
但是,以这种方式生成的可执行文件在运行时会出错,而使用Visual Studio生成的同一解决方案可以完美运行。
在显示的第一个WPF视图的InitializeComponent处发生错误。 错误消息指示无效的版本字符串。 我注意到生成的文件(xaml)有所不同
命令行构建(不起作用): Myview.g.cs
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/ProjectName;V3.9.1.*;component/Myview.xaml", System.UriKind.Relative);
#line 1 "..\..\Myview.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
VS 2012构建(工作): Myview.g.cs
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/ProjectName;component/Myview.xaml", System.UriKind.Relative);
#line 1 "..\..\Myview.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
我真的不知道V3.9.1*
为何以及如何出现在生成的文件中,但这似乎是问题所在。 我该如何纠正? 当我使用命令行生成时,.xaml生成的所有文件都具有相同的不正确的V3.9.1*
。
我终于发现了!
我不知道我是否应该知道它,或者它是否写在文档中的某个地方,但是我很高兴终于找到了这个问题。
在我正在构建解决方案的jenkins工作中,有一个名为ASSEMBLYVERSION的字符串参数。 我不知道为什么,但是似乎'devenv'找到了这个变量并决定使用它。
如果我重命名此变量,则devenv将不会使用它,并且一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.