예제 #1
0
        public void VerifyTargetFx()
        {
            string sdkPropFilePath = this.FileSys.FindFilePath(RepoRootDirPath, "AzSdk.reference.props");

            Assert.NotNull(sdkPropFilePath);
            MsbuildProject sdkProp = new MsbuildProject(sdkPropFilePath);

            Assert.NotNull(sdkProp);

            string targetFx = sdkProp.GetPropertyValue("targetframework");

            Assert.Empty(targetFx);
            targetFx = sdkProp.GetPropertyValue("SdkTargetFx");
            Assert.NotNull(@"net452;net461;netstandard1.4;netstandard2.0");
            sdkProp.Dispose();
        }
        void InitBaselineTargetFx()
        {
            string azSdkFilePath  = string.Empty;
            string azTestFilePath = string.Empty;


            var azSdkRef = Directory.EnumerateFiles(RepositoryRootDirPath, "AzSdk.reference.props", SearchOption.AllDirectories);

            if (azSdkRef.Any <string>())
            {
                azSdkFilePath = azSdkRef.FirstOrDefault <string>();

                MsbuildProject msbSdk = new MsbuildProject(azSdkFilePath);
                BaseLineSdkTargetFx = msbSdk.GetPropertyValue("SdkTargetFx");
            }

            var azTestRef = Directory.EnumerateFiles(RepositoryRootDirPath, "AzSdk.test.reference.props", SearchOption.AllDirectories);

            if (azTestRef.Any <string>())
            {
                azTestFilePath = azTestRef.FirstOrDefault <string>();
                MsbuildProject msbTest = new MsbuildProject(azTestFilePath);
                BaseLineTestTargetFx = msbTest.GetPropertyValue("TargetFrameworks");
            }
        }
예제 #3
0
        void UpdatePropertyValue(MsbuildProject proj, string propertyName, bool newPropValue)
        {
            string existingVal = proj.GetPropertyValue(propertyName);

            if (string.IsNullOrWhiteSpace(existingVal) && newPropValue == false)
            {
                TaskLogger.LogInfo(MessageImportance.Low, "'{0}' property is not currently set and the new value is '{1}'. No changes will be made", propertyName, newPropValue.ToString());
            }
            else if (existingVal.Equals(newPropValue.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                TaskLogger.LogInfo(MessageImportance.Low, "'{0}' current value is '{1}'. New value requested is '{2}'", propertyName, existingVal, newPropValue.ToString());
            }
            else if (!existingVal.Equals(newPropValue.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                TaskLogger.LogInfo(MessageImportance.Low, "{0} current value:'{1}', new value:'{2}'", propertyName, existingVal, newPropValue.ToString());
                proj.AddUpdateProperty(propertyName, newPropValue.ToString());
            }
        }