fix key sign
This commit is contained in:
parent
7632cd3502
commit
148008d733
2 changed files with 19 additions and 1 deletions
|
@ -32,6 +32,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
|||
new AddPropertyTransform<CommonCompilerOptions>("SignAssembly",
|
||||
"true",
|
||||
compilerOptions => !string.IsNullOrEmpty(compilerOptions.KeyFile))
|
||||
.WithMSBuildCondition(" '$(OS)' == 'Windows_NT' "),
|
||||
new AddPropertyTransform<CommonCompilerOptions>("PublicSign",
|
||||
"true",
|
||||
compilerOptions => !string.IsNullOrEmpty(compilerOptions.KeyFile))
|
||||
.WithMSBuildCondition(" '$(OS)' != 'Windows_NT' ")
|
||||
};
|
||||
|
||||
private AddPropertyTransform<CommonCompilerOptions> DefineTransform => new AddPropertyTransform<CommonCompilerOptions>(
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
private readonly string _propertyValue;
|
||||
private readonly Func<T,string> _propertyValueFunc;
|
||||
|
||||
private string _msbuildCondition = null;
|
||||
|
||||
public AddPropertyTransform(string propertyName, string propertyValue, Func<T,bool> condition)
|
||||
: base(condition)
|
||||
{
|
||||
|
@ -28,13 +30,24 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Transforms
|
|||
_propertyValueFunc = propertyValueFunc;
|
||||
}
|
||||
|
||||
public AddPropertyTransform<T> WithMSBuildCondition(string condition)
|
||||
{
|
||||
_msbuildCondition = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override ProjectPropertyElement ConditionallyTransform(T source)
|
||||
{
|
||||
string propertyValue = GetPropertyValue(source);
|
||||
|
||||
var property = _propertyObjectGenerator.CreatePropertyElement(PropertyName);
|
||||
property.Value = propertyValue;
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(_msbuildCondition))
|
||||
{
|
||||
property.Condition = _msbuildCondition;
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue