[英]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.