提交 a7ed5768 编写于 作者: A Andy Gocke

Wire up /runtimemetadataversion to the build task (#11404)

Fixes #5608
上级 13859e84
...@@ -230,6 +230,12 @@ public ITaskItem[] Resources ...@@ -230,6 +230,12 @@ public ITaskItem[] Resources
get { return (ITaskItem[])_store[nameof(Resources)]; } get { return (ITaskItem[])_store[nameof(Resources)]; }
} }
public string RuntimeMetadataVersion
{
set { _store[nameof(RuntimeMetadataVersion)] = value; }
get { return (string)_store[nameof(RuntimeMetadataVersion)]; }
}
public ITaskItem[] ResponseFiles public ITaskItem[] ResponseFiles
{ {
set { _store[nameof(ResponseFiles)] = value; } set { _store[nameof(ResponseFiles)] = value; }
...@@ -691,6 +697,7 @@ internal void AddResponseFileCommandsForSwitchesSinceInitialReleaseThatAreNeeded ...@@ -691,6 +697,7 @@ internal void AddResponseFileCommandsForSwitchesSinceInitialReleaseThatAreNeeded
{ {
commandLine.AppendPlusOrMinusSwitch("/deterministic", _store, nameof(Deterministic)); commandLine.AppendPlusOrMinusSwitch("/deterministic", _store, nameof(Deterministic));
commandLine.AppendPlusOrMinusSwitch("/publicsign", _store, nameof(PublicSign)); commandLine.AppendPlusOrMinusSwitch("/publicsign", _store, nameof(PublicSign));
commandLine.AppendSwitchIfNotNull("/runtimemetadataversion:", RuntimeMetadataVersion);
AddFeatures(commandLine, Features); AddFeatures(commandLine, Features);
} }
......
...@@ -76,6 +76,20 @@ public void PublicSignFlag() ...@@ -76,6 +76,20 @@ public void PublicSignFlag()
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents()); Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
} }
[Fact]
public void RuntimeMetadataVersionFlag()
{
var csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.RuntimeMetadataVersion = "v1234";
Assert.Equal("/out:test.exe /runtimemetadataversion:v1234 test.cs", csc.GenerateResponseFileContents());
csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.RuntimeMetadataVersion = null;
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
}
[Fact] [Fact]
public void TargetTypeDll() public void TargetTypeDll()
{ {
......
...@@ -73,6 +73,20 @@ public void PublicSignFlag() ...@@ -73,6 +73,20 @@ public void PublicSignFlag()
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents()); Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
} }
[Fact]
public void RuntimeMetadataVersionFlag()
{
var vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.RuntimeMetadataVersion = "v1234";
Assert.Equal("/optionstrict:custom /out:test.exe /runtimemetadataversion:v1234 test.vb", vbc.GenerateResponseFileContents());
vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.RuntimeMetadataVersion = null;
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
}
[Fact] [Fact]
public void TargetTypeDll() public void TargetTypeDll()
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册