diff --git a/.editorconfig b/.editorconfig index 3191da95..2a897ee4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,4 +6,3 @@ indent_size = 4 tab_width = 4 trim_trailing_whitespace = true insert_final_newline = true -charset = utf-8 diff --git a/modules/vstudio/vs2005_dotnetbase.lua b/modules/vstudio/vs2005_dotnetbase.lua index b9bc40c5..785f76d7 100644 --- a/modules/vstudio/vs2005_dotnetbase.lua +++ b/modules/vstudio/vs2005_dotnetbase.lua @@ -398,76 +398,76 @@ -- function dotnetbase.nuGetReferences(prj) - if _ACTION >= "vs2010" and _ACTION < "vs2017" then - for _, package in ipairs(prj.nuget) do - local id = vstudio.nuget2010.packageId(package) - local packageAPIInfo = vstudio.nuget2010.packageAPIInfo(prj, package) + if _ACTION >= "vs2010" and not vstudio.nuget2010.supportsPackageReferences(prj) then + for _, package in ipairs(prj.nuget) do + local id = vstudio.nuget2010.packageId(package) + local packageAPIInfo = vstudio.nuget2010.packageAPIInfo(prj, package) - local cfg = p.project.getfirstconfig(prj) - local action = p.action.current() - local targetFramework = cfg.dotnetframework or action.vstudio.targetFramework + local cfg = p.project.getfirstconfig(prj) + local action = p.action.current() + local targetFramework = cfg.dotnetframework or action.vstudio.targetFramework - local targetVersion = dotnetbase.makeVersionComparable(targetFramework) + local targetVersion = dotnetbase.makeVersionComparable(targetFramework) - -- Figure out what folder contains the files for the nearest - -- supported .NET Framework version. + -- Figure out what folder contains the files for the nearest + -- supported .NET Framework version. - local files = {} + local files = {} - local bestVersion, bestFolder + local bestVersion, bestFolder - for _, file in ipairs(packageAPIInfo.packageEntries) do - local folder = file:match("^lib[\\/](.+)[\\/]") + for _, file in ipairs(packageAPIInfo.packageEntries) do + local folder = file:match("^lib[\\/](.+)[\\/]") - if folder and path.hasextension(file, ".dll") then - local version = dotnetbase.frameworkVersionForFolder(folder) + if folder and path.hasextension(file, ".dll") then + local version = dotnetbase.frameworkVersionForFolder(folder) - if version then - files[folder] = files[folder] or {} - table.insert(files[folder], file) + if version then + files[folder] = files[folder] or {} + table.insert(files[folder], file) - if version <= targetVersion and (not bestVersion or version > bestVersion) then - bestVersion = version - bestFolder = folder - end + if version <= targetVersion and (not bestVersion or version > bestVersion) then + bestVersion = version + bestFolder = folder + end + end + end + end + + if not bestVersion then + p.error("NuGet package '%s' is not compatible with project '%s' .NET Framework version '%s'", id, prj.name, targetFramework) + end + + -- Now, add references for all DLLs in that folder. + + for _, file in ipairs(files[bestFolder]) do + -- There's some stuff missing from this include that we + -- can't get from the API and would need to download and + -- extract the package to figure out. It looks like we can + -- just omit it though. + -- + -- So, for example, instead of: + -- + -- + -- + -- We're just outputting: + -- + -- + + _x(2, '', path.getbasename(file)) + _x(3, '%s', vstudio.path(prj, p.filename(prj.workspace, string.format("packages\\%s.%s\\%s", id, packageAPIInfo.verbatimVersion or packageAPIInfo.version, file)))) + + if config.isCopyLocal(prj, package, true) then + _p(3, 'True') + else + _p(3, 'False') + end + + _p(2, '') + end end - end - end - - if not bestVersion then - p.error("NuGet package '%s' is not compatible with project '%s' .NET Framework version '%s'", id, prj.name, targetFramework) - end - - -- Now, add references for all DLLs in that folder. - - for _, file in ipairs(files[bestFolder]) do - -- There's some stuff missing from this include that we - -- can't get from the API and would need to download and - -- extract the package to figure out. It looks like we can - -- just omit it though. - -- - -- So, for example, instead of: - -- - -- - -- - -- We're just outputting: - -- - -- - - _x(2, '', path.getbasename(file)) - _x(3, '%s', vstudio.path(prj, p.filename(prj.workspace, string.format("packages\\%s.%s\\%s", id, packageAPIInfo.verbatimVersion or packageAPIInfo.version, file)))) - - if config.isCopyLocal(prj, package, true) then - _p(3, 'True') - else - _p(3, 'False') - end - - _p(2, '') - end - end end end @@ -501,33 +501,33 @@ -- Write the list of package dependencies. -- function dotnetbase.packageReferences(prj) - if _ACTION >= "vs2017" then - local hasNuget = prj.nuget and #prj.nuget>0 - for cfg in project.eachconfig(prj) do - if cfg.nuget and #cfg.nuget>0 then - hasNuget = true - end - end - if hasNuget then - _p(1,'') - if prj.nuget and #prj.nuget>0 then - for _, package in ipairs(prj.nuget) do - _p(2,'', vstudio.nuget2010.packageId(package), vstudio.nuget2010.packageVersion(package)) - end - end - for cfg in project.eachconfig(prj) do - if cfg.nuget and #cfg.nuget>0 then - for _, package in ipairs(cfg.nuget) do - if prj.nuget[package]==nil then - _p(2,'', vstudio.nuget2010.packageId(package), vstudio.nuget2010.packageVersion(package), dotnetbase.condition(cfg)) - end + if vstudio.nuget2010.supportsPackageReferences(prj) then + local hasNuget = prj.nuget and #prj.nuget>0 + for cfg in project.eachconfig(prj) do + if cfg.nuget and #cfg.nuget>0 then + hasNuget = true + end + end + if hasNuget then + _p(1,'') + if prj.nuget and #prj.nuget>0 then + for _, package in ipairs(prj.nuget) do + _p(2,'', vstudio.nuget2010.packageId(package), vstudio.nuget2010.packageVersion(package)) + end + end + for cfg in project.eachconfig(prj) do + if cfg.nuget and #cfg.nuget>0 then + for _, package in ipairs(cfg.nuget) do + if prj.nuget[package]==nil then + _p(2,'', vstudio.nuget2010.packageId(package), vstudio.nuget2010.packageVersion(package), dotnetbase.condition(cfg)) + end + end + end + end + _p(1,'') end - end end - _p(1,'') - end end - end -- -- Return the Visual Studio architecture identification string. The logic